Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eWZz2-0007ny-Vt for pgsql-committers@arkaria.postgresql.org; Wed, 03 Jan 2018 03:44:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eWZz2-0004p7-Bv for pgsql-committers@arkaria.postgresql.org; Wed, 03 Jan 2018 03:44:52 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eWZz2-0004ox-4D for pgsql-committers@lists.postgresql.org; Wed, 03 Jan 2018 03:44:52 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eWZyy-0007Mr-Do for pgsql-committers@postgresql.org; Wed, 03 Jan 2018 03:44:50 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 0B5D820DB8; Tue, 2 Jan 2018 22:44:47 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute5.internal (MEProxy); Tue, 02 Jan 2018 22:44:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=ctPAbV CGTcRasUr58kvzuG23Dl2smFZWcmvRH4Ne6g8=; b=cGUb9xvKrndC8v5dO1Zl0P PVhd+Zs7vQjB1fmnxuM31+I+XASYaaIvZfXHtzLCw/EHx8bVHXlAJBcIi9kq3afL +ebLtjDdmZo3BwIjg3LEORtl2+PqtaC0agUxjsKqGkoeXbSrDgx6oQMLxI4qEgrA HRLCaquL/avBkPnEQtCXIaeDGDFs5i2IN/etGtyc/omUaEEM4s2j7+XHrbbvpryn mM81QBW2VBnFvVYhA6N2VfnWC4xIWdd1tED44SYgTo5fFrpIPMLXcdveEviJqjkX VZr3DX6pW5c/OMP9yvmGUO72QEkhyU1AUdMl0/6Xm9lPx3zEIHKXCd9P0l7mKbsg == X-ME-Sender: Received: from intern.anarazel.de (unknown [136.24.76.189]) by mail.messagingengine.com (Postfix) with ESMTPA id B279B7E34B; Tue, 2 Jan 2018 22:44:46 -0500 (EST) Date: Tue, 2 Jan 2018 19:44:45 -0800 From: Andres Freund To: Alvaro Herrera , Jeff Janes Cc: pgsql-committers@postgresql.org Subject: Re: pgsql: Fix deadlock hazard in CREATE INDEX CONCURRENTLY Message-ID: <20180103034445.t3utrtrnrevfsghm@alap3.anarazel.de> References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, On 2018-01-03 02:20:14 +0000, Alvaro Herrera wrote: > Fix deadlock hazard in CREATE INDEX CONCURRENTLY > > Multiple sessions doing CREATE INDEX CONCURRENTLY simultaneously are > supposed to be able to work in parallel, as evidenced by fixes in commit > c3d09b3bd23f specifically to support this case. In reality, one of the > sessions would be aborted by a misterious "deadlock detected" error. > > Jeff Janes diagnosed that this is because of leftover snapshots used for > system catalog scans -- this was broken by 8aa3e47510b9 keeping track of > (registering) the catalog snapshot. To fix the deadlocks, it's enough > to de-register that snapshot prior to waiting. > > Backpatch to 9.4, which introduced MVCC catalog scans. > > Include an isolationtester spec that 8 out of 10 times reproduces the > deadlock with the unpatched code for me (Álvaro). The isolation test doesn't appear to be fully stable: https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=baiji&dt=2018-01-03%2003%3A00%3A01 Greetings, Andres Freund