Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aU5SM-0007u9-Vu for pgsql-hackers@arkaria.postgresql.org; Fri, 12 Feb 2016 04:35:47 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aU5SM-00072x-HW for pgsql-hackers@arkaria.postgresql.org; Fri, 12 Feb 2016 04:35:46 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aU5R2-0005Vt-6B for pgsql-hackers@postgresql.org; Fri, 12 Feb 2016 04:34:24 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aU5Qv-0000C8-Di for pgsql-hackers@postgresql.org; Fri, 12 Feb 2016 04:34:23 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u1C4YE0X024445; Thu, 11 Feb 2016 23:34:14 -0500 From: Tom Lane To: Robert Haas cc: "pgsql-hackers@postgresql.org" Subject: Re: Re: [COMMITTERS] pgsql: Add some isolation tests for deadlock detection and resolution. In-reply-to: <20201.1455210279@sss.pgh.pa.us> References: <21023.1455200996@sss.pgh.pa.us> <14581.1455205343@sss.pgh.pa.us> <20201.1455210279@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Thu, 11 Feb 2016 12:04:39 -0500" Date: Thu, 11 Feb 2016 23:34:14 -0500 Message-ID: <24444.1455251654@sss.pgh.pa.us> X-Pg-Spam-Score: -2.1 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org We're not out of the woods on this :-( ... jaguarundi, which is the first of the CLOBBER_CACHE_ALWAYS animals to run these tests, didn't like them at all. I think I fixed the deadlock-soft-2 failure, but its take on deadlock-hard is: *** 17,25 **** step s6a7: LOCK TABLE a7; step s7a8: LOCK TABLE a8; step s8a1: LOCK TABLE a1; - step s8a1: <... completed> step s7a8: <... completed> ! error in steps s8a1 s7a8: ERROR: deadlock detected step s8c: COMMIT; step s7c: COMMIT; step s6a7: <... completed> --- 17,25 ---- step s6a7: LOCK TABLE a7; step s7a8: LOCK TABLE a8; step s8a1: LOCK TABLE a1; step s7a8: <... completed> ! step s8a1: <... completed> ! ERROR: deadlock detected step s8c: COMMIT; step s7c: COMMIT; step s6a7: <... completed> The problem here is that when the deadlock detector kills s8's transaction, s7a8 is also left free to proceed, so there is a race condition as to which query completion will get back to isolationtester first. One grotty way to handle that would be something like -step "s7a8" { LOCK TABLE a8; } +step "s7a8" { LOCK TABLE a8; SELECT pg_sleep(5); } Or we could simplify the locking structure enough so that no other transactions are released by the deadlock failure. I do not know exactly what you had in mind to be testing here? regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers