Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WqP8v-0006cQ-M2 for pgsql-bugs@arkaria.postgresql.org; Fri, 30 May 2014 15:54:53 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WqP8v-0005sS-5Y for pgsql-bugs@arkaria.postgresql.org; Fri, 30 May 2014 15:54:53 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1WqP8u-0005sM-CH for pgsql-bugs@postgresql.org; Fri, 30 May 2014 15:54:52 +0000 Received: from mail.anarazel.de ([217.115.131.40]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WqP8q-0005z6-1m for pgsql-bugs@postgresql.org; Fri, 30 May 2014 15:54:50 +0000 Received: by mail.anarazel.de (Postfix, from userid 108) id 2C5BB4F0001; Fri, 30 May 2014 17:54:46 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on mail X-Spam-Level: X-Spam-Status: No, score=-6.2 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from anarazel.de (p5DDC7282.dip0.t-ipconnect.de [93.220.114.130]) (Authenticated sender: andres@anarazel.de) by mail.anarazel.de (Postfix) with ESMTPSA id 0BDF1500001; Fri, 30 May 2014 17:54:43 +0200 (CEST) Received: by anarazel.de (Postfix, from userid 1000) id 8A465100F08; Fri, 30 May 2014 17:54:42 +0200 (CEST) Date: Fri, 30 May 2014 17:54:42 +0200 From: Andres Freund To: Sandro Santilli Cc: pgsql-bugs@postgresql.org Subject: Re: uninterruptable loop: concurrent delete in progress within table Message-ID: <20140530155442.GE30516@awork2.anarazel.de> References: <20140530143150.GA11051@localhost> <20140530144535.GA30516@awork2.anarazel.de> <20140530145910.GC11051@localhost> <20140530152803.GA13871@localhost> <20140530153322.GD30516@awork2.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140530153322.GD30516@awork2.anarazel.de> X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On 2014-05-30 17:33:22 +0200, Andres Freund wrote: > > Actually, I further reduced it to not rely on PostGIS > > and it is attached here. > > Thanks. I've reproduced it and I am looking at it right now. The problem is that HeapTupleSatisfiesVacuum() doesn't really check xmax in the TransactionIdIsInProgress(HeapTupleHeaderGetRawXmin(tuple)) case. That seems to be a longstanding omission. Thus the case where xmin = current xid, xmax = aborted subtransaction of the current backend isn't handled correctly an HEAPTUPLE_DELETE_IN_PROGRESS is returned. That in turn leads to an endless goto loop in IndexBuildHeapScan() because waiting for an aborted xact doesn't do much good. That itself is obviously easy to fix, but I wonder whether there aren't other such omissions in HeapTupleSatisfiesVacuum() - from the looks of it it wasn't originally written to support the case where the current xact performed changes itself. Not generally unreasonable, but long since obsolete. Greetings, Andres Freund -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs