On 11 October 2012 18:22, Tom Lane <t...@sss.pgh.pa.us> wrote: >> I suggested a way to automatically trigger a second snapshot. I think >> that would be acceptable to backpatch. > > 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.) > It would have to be a rule like "take a new snapshot if we acquired > any new lock since the previous snapshot". While that would work, > we'd end up with no performance gain worth mentioning, since there > would almost always be some lock acquisitions during parsing.
So where's the race? AFAICS it either waits or it doesn't - the code isn't vague on that point. If we wait we set the flag. The point is that lock waits are pretty rare since most locks are compatible, so triggering a second snap if we waited is not any kind of problem, even if we waited for a very short time. -- Simon Riggs http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers