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

Commit4da24f1

Browse files
committed
Fix two bugs in setting the vm bit of empty pages.
Use a critical section when setting the all-visible flag on an empty page,and WAL-logging it. log_newpage_buffer() contains an assertion that itmust be called inside a critical section, and it's the right thing to dowhen modifying a buffer anyway.Also, the page should be marked dirty before calling log_newpage_buffer(),per the comment in log_newpage_buffer() and src/backend/access/transam/README.Patch by Andres Freund, in response to my report. Backpatch to 9.2, likethe patch that introduced these bugs (a6370fd).
1 parentb89cede commit4da24f1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

‎src/backend/commands/vacuumlazy.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,11 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats,
650650
/* empty pages are always all-visible */
651651
if (!PageIsAllVisible(page))
652652
{
653+
START_CRIT_SECTION();
654+
655+
/* mark buffer dirty before writing a WAL record */
656+
MarkBufferDirty(buf);
657+
653658
/*
654659
* It's possible that another backend has extended the heap,
655660
* initialized the page, and then failed to WAL-log the page
@@ -669,9 +674,9 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats,
669674
log_newpage_buffer(buf);
670675

671676
PageSetAllVisible(page);
672-
MarkBufferDirty(buf);
673677
visibilitymap_set(onerel,blkno,InvalidXLogRecPtr,vmbuffer,
674678
InvalidTransactionId);
679+
END_CRIT_SECTION();
675680
}
676681

677682
UnlockReleaseBuffer(buf);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp