Re: reindex creates predicate lock on index root

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Dan Ports <drkp(at)csail(dot)mit(dot)edu>, pgsql-hackers(at)postgresql(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: reindex creates predicate lock on index root
Date: 2011-06-08 15:18:31
Message-ID: 4DEF92C7.5040009@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 08.06.2011 18:09, Kevin Grittner wrote:
> Robert Haas<robertmhaas(at)gmail(dot)com> wrote:
>
>> I'm wondering if this shouldn't be linked to whether the scan is
>> using an MVCC snapshot, rather than inserting exceptions for
>> specific operations.
>
> Yeah, that was raised before somewhere and I spaced it. Grabbing
> predicate locks for non-MVCC snapshots is nonsense, and the fix is a
> one-line addition to the SkipSerialization macro defined and used in
> predicate.c. Patch attached.
>
> I agree with your other post that changes which are in the nature of
> improving performance (which for SSI includes changes which reduce
> the number of false positive serialization failures for serializable
> transactions) should be viewed very cautiously in terms of 9.1
> inclusion. We're already at a point where a DBT-2 benchmark only
> shows a 2% hit for SSI overhead, including transaction restarts for
> serialization failures. I'd love to get that down to 1% or lower,
> but I don't want to create any risk of introducing bugs in 9.1 at
> this point. I think this one-liner might be worth considering,
> since it is very low risk and fixes an undesirable behavior which
> some (Tom, at least, it would appear) would have no trouble
> categorizing as a bug.

I also think this should be fixed.

> The attached patch has not yet been tested, but I'll test it today
> along with the latest committed code.

You can't use GetActiveSnapshot() for this. You can have one snapshot
pushed to the active snapshot stack, and do a DDL operation like reindex
using a different snapshot. You'll have to check the snapshot in the
HeapScanDesc.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2011-06-08 15:18:56 Re: Error in PQsetvalue
Previous Message Tom Lane 2011-06-08 15:15:56 Re: reindex creates predicate lock on index root