How to build a Durable Write Ahead Log in Go | Segmentation, Auto Recovery, Checksums

Поделиться
HTML-код
  • Опубликовано: 5 окт 2024

Комментарии • 13

  • @EugeneTolbakov
    @EugeneTolbakov 2 месяца назад +1

    Nice walkthrough Jyotinder! Thank you for the video!

  • @prashlovessamosa
    @prashlovessamosa 8 месяцев назад +1

    Great video please make more videos on low level stuff

  • @sids027
    @sids027 8 месяцев назад +1

    Great video on a topic I was curious about. Thanks!

  • @abhishekmehandiratta4241
    @abhishekmehandiratta4241 8 месяцев назад +2

    What a great video! thanks for the clear explanation!

  • @damercy
    @damercy 8 месяцев назад +1

    Great stuff! Thanks a lot! Please keep posting such videos with such clear explanation. 👌

    • @JyotinderSingh
      @JyotinderSingh  8 месяцев назад +1

      Thanks! More videos and articles coming!

  • @chhayakumardas9539
    @chhayakumardas9539 5 месяцев назад

    A very insightful video. Just had one question around repair. Once we find a corrupted log wouldn't the data be insconsistent even after the repair? I am coming from the place where I have to use repair for a DB recovery

    • @JyotinderSingh
      @JyotinderSingh  5 месяцев назад

      The repair is essentially discarding all data that it cannot read. It preserves entries up till the last row of data that the system is able to read successfully. We work on the assumption that all data which we can read is correctly stored in the WAL (Reinforced by the checksum).
      The recovery mechanism is on best effort basis, and attempts to retrieve all data that it can successfully read.

  • @vaibhavmewada4508
    @vaibhavmewada4508 4 месяца назад +1

    nice explanation

  • @Genji_hehe
    @Genji_hehe 15 дней назад

    Great video and git repo. I had one question though, before writting the entry to the segment file we are checking if rotation is needed right? But we are calling the rotateIfNeeded() before adding anyting to the writer buffer. So when it checks for a overflow of file size then the wal.bufWriter.Buffered() return 0 as the buffer is empty because entry is being filled after the rotateIfNeeded() call?

    • @Genji_hehe
      @Genji_hehe 15 дней назад

      Like shouldnt we first fill the buffer then check if the file size would exceed? Or maybe im wrong about the Buffered() function's working?

    • @Genji_hehe
      @Genji_hehe 15 дней назад

      For eg if we have a log segment file lets say "f" filled with "x" bytes and assume that f is the last segment file written to. We have the file limit of x+1 bytes. Which makes 1 bytes yet to be filled. Lets say we boot up the system and write a log entry of say 3 bytes. Now, the buffer is currently empty so the rotation check of f.Size()+int(bufwriter.Buffered()) would still be x bytes which would be less than file size limit. But we wouldnt have space in the file would we?