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

Commit83eb540

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 parent5f1ab46 commit83eb540

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
@@ -663,6 +663,11 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats,
663663
/* empty pages are always all-visible */
664664
if (!PageIsAllVisible(page))
665665
{
666+
START_CRIT_SECTION();
667+
668+
/* mark buffer dirty before writing a WAL record */
669+
MarkBufferDirty(buf);
670+
666671
/*
667672
* It's possible that another backend has extended the heap,
668673
* initialized the page, and then failed to WAL-log the page
@@ -682,9 +687,9 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats,
682687
log_newpage_buffer(buf);
683688

684689
PageSetAllVisible(page);
685-
MarkBufferDirty(buf);
686690
visibilitymap_set(onerel,blkno,buf,InvalidXLogRecPtr,
687691
vmbuffer,InvalidTransactionId);
692+
END_CRIT_SECTION();
688693
}
689694

690695
UnlockReleaseBuffer(buf);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp