Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WrXI3-0002aJ-Fl for pgsql-bugs@arkaria.postgresql.org; Mon, 02 Jun 2014 18:48:59 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WrXI2-00026B-Lm for pgsql-bugs@arkaria.postgresql.org; Mon, 02 Jun 2014 18:48:58 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1WrXHz-0001zO-6B for pgsql-bugs@postgresql.org; Mon, 02 Jun 2014 18:48:55 +0000 Received: from mail.anarazel.de ([217.115.131.40]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WrXHv-0006sa-5D for pgsql-bugs@postgresql.org; Mon, 02 Jun 2014 18:48:53 +0000 Received: by mail.anarazel.de (Postfix, from userid 108) id 51D7B4E8003; Mon, 2 Jun 2014 20:48:49 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on mail X-Spam-Level: X-Spam-Status: No, score=-6.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from anarazel.de (p5DDC5EA4.dip0.t-ipconnect.de [93.220.94.164]) (Authenticated sender: andres@anarazel.de) by mail.anarazel.de (Postfix) with ESMTPSA id E74F64E8006; Mon, 2 Jun 2014 20:48:43 +0200 (CEST) Received: by anarazel.de (Postfix, from userid 1000) id 6CEF6100923; Mon, 2 Jun 2014 20:48:43 +0200 (CEST) Date: Mon, 2 Jun 2014 20:48:43 +0200 From: Andres Freund To: Alvaro Herrera Cc: Robert Haas , Tom Lane , pgsql-bugs@postgresql.org, Sandro Santilli Subject: Re: uninterruptable loop: concurrent delete in progress within table Message-ID: <20140602184843.GI24145@awork2.anarazel.de> References: <20140530143150.GA11051@localhost> <20140531132841.GC1220@awork2.anarazel.de> <20140602164800.GA5146@eldon.alvh.no-ip.org> <20140602170820.GB24145@awork2.anarazel.de> <20140602172716.GC5146@eldon.alvh.no-ip.org> <20140602173536.GE24145@awork2.anarazel.de> <20140602183922.GF5146@eldon.alvh.no-ip.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140602183922.GF5146@eldon.alvh.no-ip.org> 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-06-02 14:39:22 -0400, Alvaro Herrera wrote: > Andres Freund wrote: > > It essentially is. If xmax aborts you still have to deal with an > > 'INSERT_IN_PROGRESS' tuple because, as you say, xmin is still > > running. That's essentially my point. INSERT_IN_PROGRESS isn't a wrong > > answer. > > Uh. Actually it strikes me that DELETE_IN_PROGRESS is a wrong answer in > the XidIsInProgress(xmin) block anyhow. If the tuple is being inserted > remotely, there is no way we can return DELETE_IN_PROGRESS, is there? I don't think it'd break stuff if we did it in the !IsCurrent() case. But yes, that's why I made the TransactionIdIsInProgress(xmin) block unconditionally return INSERT_IN_PROGRESS. > Another thing I wanted to comment on originally is that I'm not sure > about the CHECK_FOR_INTERRUPTS() additions. Aren't those only to serve > the case of the current bug, or bugs of similar ilk? There is no way > that a valid, non-bug situation is going to cause us to loop forever > there. I think there's other possible cases where it loop for a long while. Think e.g. of a row that's updated under contention by several backends or such. > That said, there isn't much harm in having them there either, > but I think I'd put them before the xact wait, not after. XactLockTableWait() internally catches waits if they happen while waiting, so that's covered. I am mainly concerned with xmax changing frequently... 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