pgsql: Fix aboriginal mistake in lazy VACUUM's code for truncating away

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix aboriginal mistake in lazy VACUUM's code for truncating away
Date: 2007-09-16 02:37:46
Message-ID: 20070916023746.5F213753E4C@cvs.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: 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.

Modified Files:
--------------
pgsql/src/backend/commands:
vacuumlazy.c (r1.95 -> r1.96)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/vacuumlazy.c?r1=1.95&r2=1.96)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2007-09-16 02:37:54 pgsql: Fix aboriginal mistake in lazy VACUUM's code for truncating away
Previous Message Bruce Momjian 2007-09-15 00:58:19 pgsql: Update Japanese FAQ.