Fix aboriginal mistake in lazy VACUUM's code for truncating away
authorTom Lane <[email protected]>
Sun, 16 Sep 2007 02:37:54 +0000 (02:37 +0000)
committerTom Lane <[email protected]>
Sun, 16 Sep 2007 02:37:54 +0000 (02:37 +0000)
commit029b66bb6050f7767457b85a326e5f3582b6846c
treeb0c28c295b0ddb01ba6d4164fe50e82acc55e023
parentb6e79152a80364402167c69f5d7cfb4bd08fd79d
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