]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix aboriginal mistake in lazy VACUUM's code for truncating away
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 16 Sep 2007 02:38:02 +0000 (02:38 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 16 Sep 2007 02:38:02 +0000 (02:38 +0000)
commitbe706260f0191f596a3b92baac7791acaa0957bf
treea27bca86ff9565c1a147b013d9c44135ffd56404
parentcf45f1f4c082abb2f2d7ad967c83ab155f4a9552
Fix aboriginal mistake in lazy VACUUM's code for truncating away
no-longer-needed pages at the end of a table.  We thought we could throw away
pages containing HEAPTUPLE_DEAD tuples; but this is not so, because such
tuples very likely have index entries pointing at them, and we wouldn't have
removed the index entries.  The problem only emerges in a somewhat unlikely
race condition: the dead tuples have to have been inserted by a transaction
that later aborted, and this has to have happened between VACUUM's initial
scan of the page and then rechecking it for empty in count_nondeletable_pages.
But that timespan will include an index-cleaning pass, so it's not all that
hard to hit.  This seems to explain a couple of previously unsolved bug
reports.
src/backend/commands/vacuumlazy.c