Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6a2fa09

Browse files
committed
For wal_consistency_checking, mask page checksum as well as page LSN.
If the LSN is different, the checksum will be different, too.Ashwin Agrawal, reviewed by Michael Paquier and Kuntal GhoshDiscussion:http://postgr.es/m/CALfoeis5iqrAU-+JAN+ZzXkpPr7+-0OAGv7QUHwFn=-wDy4o4Q@mail.gmail.com
1 parent7c75ef5 commit6a2fa09

File tree

11 files changed

+16
-14
lines changed

11 files changed

+16
-14
lines changed

‎src/backend/access/brin/brin_xlog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ brin_mask(char *pagedata, BlockNumber blkno)
332332
{
333333
Pagepage= (Page)pagedata;
334334

335-
mask_page_lsn(page);
335+
mask_page_lsn_and_checksum(page);
336336

337337
mask_page_hint_bits(page);
338338

‎src/backend/access/common/bufmask.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,17 @@
2323
* mask_page_lsn
2424
*
2525
* In consistency checks, the LSN of the two pages compared will likely be
26-
* different because of concurrent operations when the WAL is generated
27-
* and the state of the page when WAL is applied.
26+
* different because of concurrent operations when the WAL is generated and
27+
* the state of the page when WAL is applied. Also, mask out checksum as
28+
* masking anything else on page means checksum is not going to match as well.
2829
*/
2930
void
30-
mask_page_lsn(Pagepage)
31+
mask_page_lsn_and_checksum(Pagepage)
3132
{
3233
PageHeaderphdr= (PageHeader)page;
3334

3435
PageXLogRecPtrSet(phdr->pd_lsn, (uint64)MASK_MARKER);
36+
phdr->pd_checksum=MASK_MARKER;
3537
}
3638

3739
/*

‎src/backend/access/gin/ginxlog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ gin_mask(char *pagedata, BlockNumber blkno)
770770
Pagepage= (Page)pagedata;
771771
GinPageOpaqueopaque;
772772

773-
mask_page_lsn(page);
773+
mask_page_lsn_and_checksum(page);
774774
opaque=GinPageGetOpaque(page);
775775

776776
mask_page_hint_bits(page);

‎src/backend/access/gist/gistxlog.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,14 +352,14 @@ gist_mask(char *pagedata, BlockNumber blkno)
352352
{
353353
Pagepage= (Page)pagedata;
354354

355-
mask_page_lsn(page);
355+
mask_page_lsn_and_checksum(page);
356356

357357
mask_page_hint_bits(page);
358358
mask_unused_space(page);
359359

360360
/*
361361
* NSN is nothing but a special purpose LSN. Hence, mask it for the same
362-
* reason asmask_page_lsn.
362+
* reason asmask_page_lsn_and_checksum.
363363
*/
364364
GistPageSetNSN(page, (uint64)MASK_MARKER);
365365

‎src/backend/access/hash/hash_xlog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1263,7 +1263,7 @@ hash_mask(char *pagedata, BlockNumber blkno)
12631263
HashPageOpaqueopaque;
12641264
intpagetype;
12651265

1266-
mask_page_lsn(page);
1266+
mask_page_lsn_and_checksum(page);
12671267

12681268
mask_page_hint_bits(page);
12691269
mask_unused_space(page);

‎src/backend/access/heap/heapam.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9166,7 +9166,7 @@ heap_mask(char *pagedata, BlockNumber blkno)
91669166
Pagepage= (Page)pagedata;
91679167
OffsetNumberoff;
91689168

9169-
mask_page_lsn(page);
9169+
mask_page_lsn_and_checksum(page);
91709170

91719171
mask_page_hint_bits(page);
91729172
mask_unused_space(page);

‎src/backend/access/nbtree/nbtxlog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,7 @@ btree_mask(char *pagedata, BlockNumber blkno)
10341034
Pagepage= (Page)pagedata;
10351035
BTPageOpaquemaskopaq;
10361036

1037-
mask_page_lsn(page);
1037+
mask_page_lsn_and_checksum(page);
10381038

10391039
mask_page_hint_bits(page);
10401040
mask_unused_space(page);

‎src/backend/access/spgist/spgxlog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,7 @@ spg_mask(char *pagedata, BlockNumber blkno)
10341034
{
10351035
Pagepage= (Page)pagedata;
10361036

1037-
mask_page_lsn(page);
1037+
mask_page_lsn_and_checksum(page);
10381038

10391039
mask_page_hint_bits(page);
10401040

‎src/backend/access/transam/generic_xlog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ generic_redo(XLogReaderState *record)
541541
void
542542
generic_mask(char*page,BlockNumberblkno)
543543
{
544-
mask_page_lsn(page);
544+
mask_page_lsn_and_checksum(page);
545545

546546
mask_unused_space(page);
547547
}

‎src/backend/commands/sequence.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1941,7 +1941,7 @@ ResetSequenceCaches(void)
19411941
void
19421942
seq_mask(char*page,BlockNumberblkno)
19431943
{
1944-
mask_page_lsn(page);
1944+
mask_page_lsn_and_checksum(page);
19451945

19461946
mask_unused_space(page);
19471947
}

‎src/include/access/bufmask.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
/* Marker used to mask pages consistently */
2424
#defineMASK_MARKER0
2525

26-
externvoidmask_page_lsn(Pagepage);
26+
externvoidmask_page_lsn_and_checksum(Pagepage);
2727
externvoidmask_page_hint_bits(Pagepage);
2828
externvoidmask_unused_space(Pagepage);
2929
externvoidmask_lp_flags(Pagepage);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp