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

From: Jan Wieck <JanWieck(at)Yahoo(dot)com>
To: Tom Lane <tgl(at)postgresql(dot)org>
Cc: pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql: Fix aboriginal mistake in lazy VACUUM's code for truncating away
Date: 2007-09-16 04:10:42
Message-ID: 46ECACC2.9060106@Yahoo.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

On 9/15/2007 10:37 PM, Tom Lane wrote:
> 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.

You mean symptoms like multiple index tuples pointing to the same heap
tuple, thus presenting the same heap tuple twice during an index scan,
don't you?

Jan

>
> 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)
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend

--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2007-09-16 05:02:36 Re: pgsql: Fix aboriginal mistake in lazy VACUUM's code for truncating away
Previous Message Tom Lane 2007-09-16 03:04:10 pgsql: Update release notes for last-minute fix.