Skip site navigation (1) Skip section navigation (2)

Re: change in LOCK behavior

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Tomas Vondra <tv(at)fuzzy(dot)cz>, Thom Brown <thom(at)linux(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: change in LOCK behavior
Date: 2012-10-11 18:54:47
Message-ID: CA+U5nM+uftwXBoXXLr_d2-nuh6pgDJJg81U+fjLyyksHzL_eDQ@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
On 11 October 2012 19:41, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Simon Riggs <simon(at)2ndQuadrant(dot)com> writes:
>> On 11 October 2012 18:22, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> If it worked, I might be amenable to that, but it doesn't.  You can't
>>> trigger taking a new snapshot off whether we waited for a lock; that
>>> still has race conditions, just ones that are not so trivial to
>>> demonstrate manually.  (The other transaction might have committed
>>> microseconds before you reach the point of waiting for the lock.)
>
>> So where's the race?
>
> Same example as before, except that the exclusive-lock-holding
> transaction commits (and releases its lock) between the time that the
> other transaction takes its parse/plan snapshot and the time that it
> takes AccessShare lock on the table.

A cache invalidation could also set the need-second-snapshot flag.

-- 
 Simon Riggs                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


In response to

pgsql-hackers by date

Next:From: Robert HaasDate: 2012-10-11 18:59:57
Subject: Re: Truncate if exists
Previous:From: Simon RiggsDate: 2012-10-11 18:48:45
Subject: Re: change in LOCK behavior

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group