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:
@ -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;
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user