Received: from magus.postgresql.org ([87.238.57.229]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TM5Q7-0002tB-My for pgsql-hackers@postgresql.org; Wed, 10 Oct 2012 23:10:31 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TM5Q4-0003lh-Q2 for pgsql-hackers@postgresql.org; Wed, 10 Oct 2012 23:10:31 +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 q9ANAMQH012762; Wed, 10 Oct 2012 19:10:22 -0400 (EDT) From: Tom Lane To: Tomas Vondra , Robert Haas cc: Thom Brown , pgsql-hackers@postgresql.org Subject: Re: change in LOCK behavior In-reply-to: <5075DFC2.9090306@fuzzy.cz> References: <5075D8DF.6050500@fuzzy.cz> <5075DFC2.9090306@fuzzy.cz> Comments: In-reply-to Tomas Vondra message dated "Wed, 10 Oct 2012 22:51:14 +0200" Date: Wed, 10 Oct 2012 19:10:22 -0400 Message-ID: <12761.1349910622@sss.pgh.pa.us> X-Pg-Spam-Score: -4.0 (----) X-Archive-Number: 201210/531 X-Sequence-Number: 214767 Tomas Vondra writes: > On 10.10.2012 22:43, Thom Brown wrote: >> On 10 October 2012 21:21, Tomas Vondra wrote: >>> A: BEGIN; >>> A: LOCK x IN ACCESS EXCLUSIVE MODE; >>> A: INSERT INTO x VALUES (100); >>> B: SELECT * FROM x; >>> A: COMMIT; >>> >>> Now on 9.1, B receives the value "100" while on 9.2 it gets no rows. >>> >>> Is this expected? I suspect the snapshot is read at different time or >>> something, but I've checked release notes but I haven't seen anything >>> relevant. >>> >>> Without getting the commited version of data, the locking is somehow >>> pointless for us (unless using a different lock, not the table itself). >> I suspect it's this commit: d573e239f03506920938bf0be56c868d9c3416da >> http://archives.postgresql.org/pgsql-committers/2011-12/msg00167.php > Maybe, the description suggests it might be related. I'm still not sure > whether this is a bug or expected behavior, although the commit clearly > states that the change shouldn't be user-visible. Yeah, I think that last is the key point: this patch was sold on the grounds that it wouldn't cause any interesting user-visible behavioral change, but your example blows that claim into tiny little pieces. I'm inclined to think we need to revert this. The performance gain is not worth the prospect of breaking a lot of applications that used to work reliably. Robert? regards, tom lane