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

Commit615299c

Browse files
committed
Fix WAL-logging of setting the visibility map bit.
The operation that removes the remaining dead tuples from the page mustbe WAL-logged before the setting of the VM bit. Otherwise, if you replaythe WAL to between those two records, you end up with the VM bit set, butthe dead tuples are still there.Backpatch to 9.3, where this bug was introduced.
1 parentb57947a commit615299c

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

‎src/backend/commands/vacuumlazy.c

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,12 +1185,21 @@ lazy_vacuum_page(Relation onerel, BlockNumber blkno, Buffer buffer,
11851185

11861186
/*
11871187
* Mark buffer dirty before we write WAL.
1188-
*
1189-
* If checksums are enabled, visibilitymap_set() may log the heap page, so
1190-
* we must mark heap buffer dirty before calling visibilitymap_set().
11911188
*/
11921189
MarkBufferDirty(buffer);
11931190

1191+
/* XLOG stuff */
1192+
if (RelationNeedsWAL(onerel))
1193+
{
1194+
XLogRecPtrrecptr;
1195+
1196+
recptr=log_heap_clean(onerel,buffer,
1197+
NULL,0,NULL,0,
1198+
unused,uncnt,
1199+
vacrelstats->latestRemovedXid);
1200+
PageSetLSN(page,recptr);
1201+
}
1202+
11941203
/*
11951204
* Now that we have removed the dead tuples from the page, once again
11961205
* check if the page has become all-visible.
@@ -1204,18 +1213,6 @@ lazy_vacuum_page(Relation onerel, BlockNumber blkno, Buffer buffer,
12041213
visibility_cutoff_xid);
12051214
}
12061215

1207-
/* XLOG stuff */
1208-
if (RelationNeedsWAL(onerel))
1209-
{
1210-
XLogRecPtrrecptr;
1211-
1212-
recptr=log_heap_clean(onerel,buffer,
1213-
NULL,0,NULL,0,
1214-
unused,uncnt,
1215-
vacrelstats->latestRemovedXid);
1216-
PageSetLSN(page,recptr);
1217-
}
1218-
12191216
END_CRIT_SECTION();
12201217

12211218
returntupindex;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp