1. reset phdr->pd_lower before checksum

2. CalRealWriteSize return BLCKSZ when phdr->pd_lower & COMP_ASIGNMENT is true: COMP_ASIGNMENT means uncompressed page
This commit is contained in:
wuyuechuan
2024-05-20 16:35:44 +08:00
committed by yaoxin
parent 162bedd04d
commit 7bdaf0cb51
2 changed files with 7 additions and 1 deletions

View File

@ -114,9 +114,15 @@ uint16 pg_checksum_page(char* page, BlockNumber blkno)
* the API of this function.
*/
save_checksum = phdr->pd_checksum;
uint16 lower = phdr->pd_lower;
phdr->pd_checksum = 0;
phdr->pd_lower &= (COMP_ASIGNMENT - 1);
checksum = pg_checksum_block(page, BLCKSZ);
phdr->pd_checksum = save_checksum;
phdr->pd_lower = lower;
/* Mix in the block number to detect transposed pages */
checksum ^= blkno;

View File

@ -302,7 +302,7 @@ size_t CalRealWriteSize(char *buffer)
}
/* check the assignment made during backup */
if ((phdr->pd_lower & COMP_ASIGNMENT) == 0) {
if (phdr->pd_lower & COMP_ASIGNMENT) {
return BLCKSZ;
}