Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-13549

Investigate block checksum getting cleared when performing read()

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Storage Engines
    • StorEng - 2024-11-12

      From the PM-3857 Q3 testing initative, we have found a potential bug that requires investigation if it is intended. Follow the piece of code here:

              blk = WT_BLOCK_HEADER_REF(buf->mem);
              __wt_block_header_byteswap_copy(blk, &swap);
              check_size = F_ISSET(&swap, WT_BLOCK_DATA_CKSUM) ? size : WT_BLOCK_COMPRESS_SKIP;
              if (swap.checksum == checksum) {
                  blk->checksum = 0;
                  if (__wt_checksum_match(buf->mem, check_size, checksum)) {
                      /*
                       * Swap the page-header as needed; this doesn't belong here, but it's the best place
                       * to catch all callers.
                       */
                      __wt_page_header_byteswap(buf->mem);
                      return (0);
                  }
                  full_checksum_mismatch = true;
              }
      

      Whenever the block manager performs a write, a checksum is written into the block header and following written into the file. Furthermore when the block manager performs a read, the block's checksum is checked. As part of checking it clears the blk->checksum and calls the checksum function again to make sure that the content has not been modified underneath. However we do not assign the block checksum again. Should the blk->checksum be cleared at this stage? What happens if we don't?

            Assignee:
            backlog-server-storage-engines [DO NOT USE] Backlog - Storage Engines Team
            Reporter:
            jie.chen@mongodb.com Jie Chen
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: