Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ePfmE-0004Yz-JU for pgsql-committers@arkaria.postgresql.org; Fri, 15 Dec 2017 02:31:06 +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 1ePfmD-00042p-IF for pgsql-committers@arkaria.postgresql.org; Fri, 15 Dec 2017 02:31:05 +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 1ePfmD-00042b-3B; Fri, 15 Dec 2017 02:31:05 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ePfmA-0003tO-36; Fri, 15 Dec 2017 02:31:03 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id C6F7620D5D; Thu, 14 Dec 2017 21:31:00 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute5.internal (MEProxy); Thu, 14 Dec 2017 21:31:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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=EsIyW2tup50BwCm2ZGnNET3ydgYq8 JBNdsAN6JztTD8=; b=NKGMtvoCMTNSO5OND4CvkeruIAdJeKcF2vIZooEo7Czx1 z0DqwIAs5L4qvg2fK6DqJ8t29p5T3L3h7NNrDHSG9aryKnhpv/AUrCM43Je2OGce b20jJPjNleH1YNJPATnhaZcUtdrYuydaXvnRk+FeW2m6hdWNY05KHZUwBCq4TTml CBRI6AfpXiwiRV4LqeJfTKkKUT0f6qhnLY5QnjldRQKfIM08xGAKHBBfCO+qCusm tdANJE4SmuTtZlqRXT3YDhAmWyNiSKphr0C1no46ddUYy5sjAa1i6aPnE/r6Q9ED q87LkEhh+58L9suJYMVTSJcsVAFTSc87SnFNsCpGw== X-ME-Sender: Received: from intern.anarazel.de (unknown [136.24.76.189]) by mail.messagingengine.com (Postfix) with ESMTPA id 7F06C7E070; Thu, 14 Dec 2017 21:31:00 -0500 (EST) Date: Thu, 14 Dec 2017 18:30:59 -0800 From: Andres Freund To: Alvaro Herrera Cc: "Wood, Dan" , Peter Geoghegan , pgsql-committers@postgresql.org, "Wong, Yi Wen" , Michael Paquier , Robert Haas , Tom Lane , pgsql-hackers@postgresql.org Subject: Re: [HACKERS] [COMMITTERS] pgsql: Fix freezing of a dead HOT-updated tuple Message-ID: <20171215023059.oeyindn57oeis5um@alap3.anarazel.de> References: <20171102112019.33wb7g5wp4zpjelu@alap3.anarazel.de> <20171102124947.hshl7znx6ixy62pf@alvherre.pgsql> <20171102130551.i2w33sqdw3bdvetn@alap3.anarazel.de> <20171103145330.5ycjoje5s6lfwxps@alap3.anarazel.de> <20171114030341.movhteyakqeqx5pm@alap3.anarazel.de> <20171215010029.3dxx56vjlymudvwo@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171215010029.3dxx56vjlymudvwo@alap3.anarazel.de> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2017-12-14 17:00:29 -0800, Andres Freund wrote: > Hi, > > On 2017-11-13 19:03:41 -0800, Andres Freund wrote: > > diff --git a/src/backend/access/heap/rewriteheap.c b/src/backend/access/heap/rewriteheap.c > > index f93c194e182..7d163c91379 100644 > > --- a/src/backend/access/heap/rewriteheap.c > > +++ b/src/backend/access/heap/rewriteheap.c > > @@ -407,7 +407,10 @@ rewrite_heap_tuple(RewriteState state, > > * While we have our hands on the tuple, we may as well freeze any > > * eligible xmin or xmax, so that future VACUUM effort can be saved. > > */ > > - heap_freeze_tuple(new_tuple->t_data, state->rs_freeze_xid, > > + heap_freeze_tuple(new_tuple->t_data, > > + state->rs_old_rel->rd_rel->relfrozenxid, > > + state->rs_old_rel->rd_rel->relminmxid, > > + state->rs_freeze_xid, > > state->rs_cutoff_multi); > > Hm. So this requires backpatching the introduction of > RewriteStateData->rs_old_rel into 9.3, which in turn requires a new > argument to begin_heap_rewrite(). It originally was added in the > logical decoding commit (i.e. 9.4). > > I'm fine with that, but it could theoretically cause issues for somebody > with an extension that calls begin_heap_rewrite() - which seems unlikely > and I couldn't find any that does so. > > Does anybody have a problem with that? Pushed this way. Moved some more relfrozenxid/relminmxid tests outside of the cutoff changes, polished some error messages. Alvaro, Michael, Peter, and everyone else I'd greatly appreciate if you could have a look at the backported version, just about everything but v10 had conflicts, some of them not insubstantial. Greetings, Andres Freund