Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lihlj-0004fi-7J for pgsql-hackers@arkaria.postgresql.org; Mon, 17 May 2021 18:15:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lihlh-0006pu-VC for pgsql-hackers@arkaria.postgresql.org; Mon, 17 May 2021 18:15:05 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lihlh-0006pm-LZ for pgsql-hackers@lists.postgresql.org; Mon, 17 May 2021 18:15:05 +0000 Received: from smtp-fw-2101.amazon.com ([72.21.196.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lihla-0006NJ-Fj for pgsql-hackers@postgresql.org; Mon, 17 May 2021 18:15:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1621275299; x=1652811299; h=to:cc:references:from:message-id:date:mime-version: in-reply-to:subject; bh=0XX9iwKnUwabzXohmACTanSR6UxI3eSO2L1O91nxsfo=; b=XL1CH1+uX6leVOzmUmFY9mccqmuxBZFDr0nTI/Ta/PZb6PSGquy6W1U4 Hii1L2TNj/K9qYkwu43qfQR+VZsesFqJ9QS+kz/TFs4b+UW55MdkDj7zb 16h6NO4CZg60xOWu1sqR80UTZ1Zc3dbqjsy/B76iRM4qr7xyaJwSF1tsA o=; X-IronPort-AV: E=Sophos;i="5.82,307,1613433600"; d="scan'208,217";a="109780432" Subject: Re: prion failed with ERROR: missing chunk number 0 for toast value 14334 in pg_toast_2619 Received: from iad12-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-1d-37fd6b3d.us-east-1.amazon.com) ([10.43.8.2]) by smtp-border-fw-2101.iad2.amazon.com with ESMTP; 17 May 2021 18:14:49 +0000 Received: from EX13D03EUC003.ant.amazon.com (iad12-ws-svc-p26-lb9-vlan2.iad.amazon.com [10.40.163.34]) by email-inbound-relay-1d-37fd6b3d.us-east-1.amazon.com (Postfix) with ESMTPS id 6FDAC282E35; Mon, 17 May 2021 18:14:47 +0000 (UTC) Received: from 38f9d36c4abb.ant.amazon.com (10.43.160.137) by EX13D03EUC003.ant.amazon.com (10.43.164.192) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Mon, 17 May 2021 18:14:44 +0000 To: Andres Freund , Tom Lane CC: Peter Geoghegan , Heikki Linnakangas , pgsql-hackers , Justin Pryzby References: <2472976.1621117273@sss.pgh.pa.us> <2591376.1621196582@sss.pgh.pa.us> <2595981.1621203681@sss.pgh.pa.us> <20210516223513.outnhdfibafroqc4@alap3.anarazel.de> <2601445.1621204973@sss.pgh.pa.us> <20210516232833.qfrjcb7jgbzzpo5h@alap3.anarazel.de> From: "Drouvot, Bertrand" Message-ID: <7d8045e5-c23f-4090-3553-6092804441e3@amazon.com> Date: Mon, 17 May 2021 20:14:40 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <20210516232833.qfrjcb7jgbzzpo5h@alap3.anarazel.de> Content-Type: multipart/alternative; boundary="------------88C5175CBBAF6094E6D70238" Content-Language: en-US X-Originating-IP: [10.43.160.137] X-ClientProxiedBy: EX13D30UWC001.ant.amazon.com (10.43.162.128) To EX13D03EUC003.ant.amazon.com (10.43.164.192) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --------------88C5175CBBAF6094E6D70238 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit Hi, On 5/17/21 1:28 AM, Andres Freund wrote: > CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe. > > > > Hi, > > On 2021-05-16 18:42:53 -0400, Tom Lane wrote: >> Andres Freund writes: >>> Why would it not be safe? >> I'm just wondering about the catalog tuples set up by pg_upgrade >> itself. If they're all frozen then they probably don't matter to >> this, but it might take some thought. > There shouldn't be any catalog objects (vs tuples) set up by pg_upgrade > at the time of the resetwal, as far as I can see. copy_xact_xlog_xid(), > which includes the resetwal calls, is done before any new objects are > created/restored. > > The only thing that happens before copy_xact_xlog_xid() is > prepare_new_cluster(), which analyzes/freezes the catalog of the new > cluster. Of course that does create new stats tuples for catalog tables, > but if the freezing of those doesn't work, we'd be in deep trouble > regardless of which concrete oldestXid value we choose - that happens > with xids as they are in a freshly initdb' cluster, which might be in > the future in the old cluster, or might have aborted. Their pg_xact will > be overwritten in copy_xact_xlog_xid(). FWIW a patch proposal to copy the oldest unfrozen XID during pg_upgrade (it adds a new (- u) parameter to pg_resetwal) has been submitted a couple of weeks ago, see: https://commitfest.postgresql.org/33/3105/ I was also wondering if: * We should keep the old behavior in case pg_resetwal -x is being used without -u?
 (The proposed patch does not set an arbitrary oldestXID anymore in 
case -x is used) * We should ensure that the xid provided with -x or -u is >=
FirstNormalTransactionId (Currently the only check is that it is # 0)? Thanks Bertrand --------------88C5175CBBAF6094E6D70238 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: 8bit

Hi,

On 5/17/21 1:28 AM, Andres Freund wrote:
CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe.



Hi,

On 2021-05-16 18:42:53 -0400, Tom Lane wrote:
Andres Freund <andres@anarazel.de> writes:
Why would it not be safe?
I'm just wondering about the catalog tuples set up by pg_upgrade
itself.  If they're all frozen then they probably don't matter to
this, but it might take some thought.
There shouldn't be any catalog objects (vs tuples) set up by pg_upgrade
at the time of the resetwal, as far as I can see. copy_xact_xlog_xid(),
which includes the resetwal calls, is done before any new objects are
created/restored.

The only thing that happens before copy_xact_xlog_xid() is
prepare_new_cluster(), which analyzes/freezes the catalog of the new
cluster. Of course that does create new stats tuples for catalog tables,
but if the freezing of those doesn't work, we'd be in deep trouble
regardless of which concrete oldestXid value we choose - that happens
with xids as they are in a freshly initdb' cluster, which might be in
the future in the old cluster, or might have aborted. Their pg_xact will
be overwritten in copy_xact_xlog_xid().


FWIW a patch proposal to copy the oldest unfrozen XID during pg_upgrade (it adds a new (- u) parameter to pg_resetwal) has been submitted a couple of weeks ago, see: https://commitfest.postgresql.org/33/3105/

I was also wondering if:

  • We should keep the old behavior in case pg_resetwal -x is being used without -u?
 (The proposed patch does not set an arbitrary oldestXID anymore in 
case -x is used)
  • We should ensure that the xid provided with -x or -u is >=
FirstNormalTransactionId (Currently the only check is that it is # 0)?

Thanks

Bertrand

--------------88C5175CBBAF6094E6D70238--