-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: Block Manager
-
Storage Engines
-
StorEng - 2024-11-12, StorEng - 2024-12-10
-
5
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?