If the LSN is different, the checksum will be different, too.
Ashwin Agrawal, reviewed by Michael Paquier and Kuntal Ghosh
Discussion: http://postgr.es/m/CALfoeis5iqrAU-+JAN+ZzXkpPr7+-0OAGv7QUHwFn=-wDy4o4Q@mail.gmail.com
{
Page page = (Page) pagedata;
- mask_page_lsn(page);
+ mask_page_lsn_and_checksum(page);
mask_page_hint_bits(page);
* mask_page_lsn
*
* In consistency checks, the LSN of the two pages compared will likely be
- * different because of concurrent operations when the WAL is generated
- * and the state of the page when WAL is applied.
+ * different because of concurrent operations when the WAL is generated and
+ * the state of the page when WAL is applied. Also, mask out checksum as
+ * masking anything else on page means checksum is not going to match as well.
*/
void
-mask_page_lsn(Page page)
+mask_page_lsn_and_checksum(Page page)
{
PageHeader phdr = (PageHeader) page;
PageXLogRecPtrSet(phdr->pd_lsn, (uint64) MASK_MARKER);
+ phdr->pd_checksum = MASK_MARKER;
}
/*
Page page = (Page) pagedata;
GinPageOpaque opaque;
- mask_page_lsn(page);
+ mask_page_lsn_and_checksum(page);
opaque = GinPageGetOpaque(page);
mask_page_hint_bits(page);
{
Page page = (Page) pagedata;
- mask_page_lsn(page);
+ mask_page_lsn_and_checksum(page);
mask_page_hint_bits(page);
mask_unused_space(page);
/*
* NSN is nothing but a special purpose LSN. Hence, mask it for the same
- * reason as mask_page_lsn.
+ * reason as mask_page_lsn_and_checksum.
*/
GistPageSetNSN(page, (uint64) MASK_MARKER);
HashPageOpaque opaque;
int pagetype;
- mask_page_lsn(page);
+ mask_page_lsn_and_checksum(page);
mask_page_hint_bits(page);
mask_unused_space(page);
Page page = (Page) pagedata;
OffsetNumber off;
- mask_page_lsn(page);
+ mask_page_lsn_and_checksum(page);
mask_page_hint_bits(page);
mask_unused_space(page);
Page page = (Page) pagedata;
BTPageOpaque maskopaq;
- mask_page_lsn(page);
+ mask_page_lsn_and_checksum(page);
mask_page_hint_bits(page);
mask_unused_space(page);
{
Page page = (Page) pagedata;
- mask_page_lsn(page);
+ mask_page_lsn_and_checksum(page);
mask_page_hint_bits(page);
void
generic_mask(char *page, BlockNumber blkno)
{
- mask_page_lsn(page);
+ mask_page_lsn_and_checksum(page);
mask_unused_space(page);
}
void
seq_mask(char *page, BlockNumber blkno)
{
- mask_page_lsn(page);
+ mask_page_lsn_and_checksum(page);
mask_unused_space(page);
}
/* Marker used to mask pages consistently */
#define MASK_MARKER 0
-extern void mask_page_lsn(Page page);
+extern void mask_page_lsn_and_checksum(Page page);
extern void mask_page_hint_bits(Page page);
extern void mask_unused_space(Page page);
extern void mask_lp_flags(Page page);