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

Commitadaba27

Browse files
committed
Fix spurious warning after vacuuming a page on a table with no indexes.
There is a rare race condition, when a transaction that inserted a tupleaborts while vacuum is processing the page containing the inserted tuple.Vacuum prunes the page first, which normally removes any dead tuples, butif the inserting transaction aborts right after that, the loop afterpruning will see a dead tuple and remove it instead. That's OK, but if thepage is on a table with no indexes, and the page becomes completely emptyafter removing the dead tuple (or tuples) on it, it will be immediatelymarked as all-visible. That's OK, but the sanity check in vacuum wouldthrow a warning because it thinks that the page contains dead tuples andwas nevertheless marked as all-visible, even though it just vacuumed awaythe dead tuples and so it doesn't actually contain any.Spotted this while reading the code. It's difficult to hit the racecondition otherwise, but can be done by putting a breakpoint after theheap_page_prune() call.Backpatch all the way to 8.4, where this code first appeared.
1 parentc2df45a commitadaba27

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

‎src/backend/commands/vacuumlazy.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,7 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats,
900900
{
901901
/* Remove tuples from heap */
902902
lazy_vacuum_page(onerel,blkno,buf,0,vacrelstats,&vmbuffer);
903+
has_dead_tuples= false;
903904

904905
/*
905906
* Forget the now-vacuumed tuples, and press on, but be careful

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp