Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TMNhy-0003Su-AM for pgsql-hackers@postgresql.org; Thu, 11 Oct 2012 18:42:10 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TMNhs-0004Pe-UD for pgsql-hackers@postgresql.org; Thu, 11 Oct 2012 18:42:10 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id q9BIfw8m024392; Thu, 11 Oct 2012 14:41:58 -0400 (EDT) From: Tom Lane To: Simon Riggs cc: Robert Haas , Tomas Vondra , Thom Brown , pgsql-hackers@postgresql.org Subject: Re: change in LOCK behavior In-reply-to: References: <5075D8DF.6050500@fuzzy.cz> <5075DFC2.9090306@fuzzy.cz> <12761.1349910622@sss.pgh.pa.us> <14951.1349916214@sss.pgh.pa.us> <19901.1349974420@sss.pgh.pa.us> <21922.1349976162@sss.pgh.pa.us> Comments: In-reply-to Simon Riggs message dated "Thu, 11 Oct 2012 19:23:56 +0100" Date: Thu, 11 Oct 2012 14:41:58 -0400 Message-ID: <24391.1349980918@sss.pgh.pa.us> X-Pg-Spam-Score: -4.0 (----) X-Archive-Number: 201210/595 X-Sequence-Number: 214831 Simon Riggs writes: > On 11 October 2012 18:22, Tom Lane 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. regards, tom lane