Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1erBTy-0005x8-8y for pgsql-admin@arkaria.postgresql.org; Wed, 28 Feb 2018 23:49:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1erBTw-0007X6-7T for pgsql-admin@arkaria.postgresql.org; Wed, 28 Feb 2018 23:49:56 +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.89) (envelope-from ) id 1erBTv-0007Ww-Mz for pgsql-admin@lists.postgresql.org; Wed, 28 Feb 2018 23:49:56 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1erBTo-0006RB-1w for pgsql-admin@postgresql.org; Wed, 28 Feb 2018 23:49:54 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 2AD0520A85; Wed, 28 Feb 2018 18:49:46 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute5.internal (MEProxy); Wed, 28 Feb 2018 18:49:46 -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=fm2; bh=vCnti99m6BKAa2DOp5jIadZo5anjX SztUGtO/dq6E/g=; b=izFyknCo+VNQFuGqbp3l3bpO1ROCP7Pk2xi4dpJoWgo/T itQYbANpT0GOWn+PAG08s3BMrNuCRrCT8EpvxVWYxX2+syjhA2WW2jFeDpOqeqqI SfqsoRyo3LhFEDgtt4x1YEUSsNFkMkZ0s2qnxKzhmLrV96tchtB+nEp0wuAilzML gjrEU7jkrkrirni1yguBDMIu68V1yz1/k71j4iQf09/znsWlR0oYph2jeIoKBuRV dnm0L8uXtjyQcdiGeErBT1s4AItSN4IPfh/3xsrII4nG17K0UmbCSlPduJUs3EzR 4YIIcayQUwGGlfGigfFSl2C52hqicaCE+LPRSc50g== X-ME-Sender: Received: from intern.anarazel.de (unknown [136.24.76.189]) by mail.messagingengine.com (Postfix) with ESMTPA id E0F39246A3; Wed, 28 Feb 2018 18:49:45 -0500 (EST) Date: Wed, 28 Feb 2018 15:49:44 -0800 From: Andres Freund To: Alvaro Herrera Cc: Alexandre Garcia , "pgsql-admin@postgresql.org" Subject: Re: postgresql 9.6 - cannot freeze committed xmax Message-ID: <20180228234944.hjastb2mqr7rdnw5@alap3.anarazel.de> References: <20180228233019.qydod7ez3xbgn5ot@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180228233019.qydod7ez3xbgn5ot@alvherre.pgsql> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, On 2018-02-28 20:30:19 -0300, Alvaro Herrera wrote: > From 4ecaa6cdc041d9f44d54f9d56588ea73c1c6f3c7 Mon Sep 17 00:00:00 2001 > From: Alvaro Herrera > Date: Wed, 28 Feb 2018 20:16:35 -0300 > Subject: [PATCH] Fix freeze xmax bug > > --- > src/backend/access/heap/heapam.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c > index 8a846e7dba..dc762f913d 100644 > --- a/src/backend/access/heap/heapam.c > +++ b/src/backend/access/heap/heapam.c > @@ -6799,7 +6799,7 @@ heap_prepare_freeze_tuple(HeapTupleHeader tuple, > * independent of committedness, since a committed lock holder has > * released the lock). > */ > - if (!(tuple->t_infomask & HEAP_XMAX_LOCK_ONLY) && > + if (!HEAP_XMAX_IS_LOCKED_ONLY(tuple->t_infomask) > && Good catch. Wonder if this a big enough fix? Isn't the bug "one layer up"? We shouldn't do the TransactionIdPrecedes() calls in the surrounding block, in the first place, right? Right now we could very well hit both ERROR: found xmax %u from before relfrozenxid %u and ERROR: cannot freeze committed xmax %u and freeze_xmax, totally_frozen will be wrong. I think that's largely harmless, but we should fix it nonetheless, and inspect other relevant sites. Greetings, Andres Freund