pgsql: Fix aboriginal mistake in lazy VACUUM's code for truncating away - Mailing list pgsql-committers

From tgl@postgresql.org (Tom Lane)
Subject pgsql: Fix aboriginal mistake in lazy VACUUM's code for truncating away
Date
Msg-id 20070916023754.8C1FF753E4C@cvs.postgresql.org
Whole thread Raw
Responses Re: pgsql: Fix aboriginal mistake in lazy VACUUM's code for truncating away
List pgsql-committers
Log Message:
-----------
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.

Tags:
----
REL8_2_STABLE

Modified Files:
--------------
    pgsql/src/backend/commands:
        vacuumlazy.c (r1.81.2.2 -> r1.81.2.3)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/vacuumlazy.c?r1=1.81.2.2&r2=1.81.2.3)

pgsql-committers by date:

Previous
From: tgl@postgresql.org (Tom Lane)
Date:
Subject: pgsql: Fix aboriginal mistake in lazy VACUUM's code for truncating away
Next
From: tgl@postgresql.org (Tom Lane)
Date:
Subject: pgsql: Fix aboriginal mistake in lazy VACUUM's code for truncating away