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 1nrdIM-00058t-VS for pgsql-hackers@arkaria.postgresql.org; Thu, 19 May 2022 10:22:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nrdIK-0004RR-2p for pgsql-hackers@arkaria.postgresql.org; Thu, 19 May 2022 10:22:12 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nrdII-0004RH-SR for pgsql-hackers@lists.postgresql.org; Thu, 19 May 2022 10:22:11 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nrdIB-0006rj-DD for pgsql-hackers@lists.postgresql.org; Thu, 19 May 2022 10:22:09 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 6AB775C016A; Thu, 19 May 2022 06:22:02 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Thu, 19 May 2022 06:22:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1652955722; x=1653042122; bh=f HwDxgLu37+15niHSgoFffvki/EHUHKtYtjFidmazgI=; b=n/VjRnhGufCKNmrdg SDVP0eB1s8DijDIDvZJnNTDc9XiNfLVj8XMsX08170xtqOtMUFv242er4mIeL4zE b68eUiGKg48rSOFP34cAFJ7pok5T1DZzxvKweAQ30Ps2DXMxSs71WW5WB9SkB2Fu FiC5Pie3m6IG+f97AwtjEtYLxoh+v2sG3O5l/jQWTnS86xS0V7KA9j/ITDk689ze z+0kxsYc52b/HJgu08GQdE6SdgrVkh3wYHp8srW7IOZ/G8rDk+FeZFI7G2hRDgr+ RfXZW4i/Idym5eJLhnBksgKhQF/5kqqdYaUNOkYPWjqPsgJJsC3UmxMaxyM4owZ+ L16ng== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedriedugddviecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvvefukfggtggugfgjsehmkeerredttdejnecuhfhrohhmpeetlhhvrghr ohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhgqe enucggtffrrghtthgvrhhnpeduleekkefgtddttedtkefguddvieffleetgeejiefhteeh keevfeettdduvdfhueenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtohhmne cuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlvhhh vghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 19 May 2022 06:22:01 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id A5ACE2A0C19; Thu, 19 May 2022 12:21:58 +0200 (CEST) Date: Thu, 19 May 2022 12:21:58 +0200 From: Alvaro Herrera To: Tom Lane Cc: Andres Freund , pgsql-hackers@lists.postgresql.org, Noah Misch , Peter Geoghegan , David Rowley , Amit Kapila , Masahiko Sawada Subject: Re: Intermittent buildfarm failures on wrasse Message-ID: <202205191021.fvy2wgxpxaak@alvherre.pgsql> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="gseizntho2k3boor" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <202204191637.eldwa2exvguw@alvherre.pgsql> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --gseizntho2k3boor Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit I was looking at backpatching this to pg13. That made me realize that commit dc7420c2c927 changed things in 14; and before that commit, the bitmask that is checked is PROCARRAY_FLAGS_VACUUM, which has a definition independently from whatever proc.h says. As far as I can tell, there's no problem with the patches I post here (the backpatched version for pg13 and p14). But's it's something to be aware of; and if we do want to add the additional bits to the bitmask, we should do that in a separate master-only commit. -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/ --gseizntho2k3boor Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename="v13-0001-Repurpose-PROC_COPYABLE_FLAGS-as-PROC_XMIN_FLAGS.patch" From 6595af9af208de33ab431b502e2f178f7d0f8007 Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Sat, 14 May 2022 16:51:23 +0200 Subject: [PATCH] Repurpose PROC_COPYABLE_FLAGS as PROC_XMIN_FLAGS This is a slight, convenient semantics change from what commit 0f0cfb494004 introduced that lets us simplify the coding in the one place where it is used. --- src/backend/storage/ipc/procarray.c | 11 ++++++----- src/include/storage/proc.h | 7 +++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c index 6ff8d8699b..447b6e3de7 100644 --- a/src/backend/storage/ipc/procarray.c +++ b/src/backend/storage/ipc/procarray.c @@ -1916,12 +1916,13 @@ ProcArrayInstallRestoredXmin(TransactionId xmin, PGPROC *proc) TransactionIdIsNormal(xid) && TransactionIdPrecedesOrEquals(xid, xmin)) { - /* Install xmin */ + /* + * Install xmin and propagate the vacuumFlags that affect how the + * value is interpreted by vacuum. + */ MyPgXact->xmin = TransactionXmin = xmin; - - /* Flags being copied must be valid copy-able flags. */ - Assert((pgxact->vacuumFlags & (~PROC_COPYABLE_FLAGS)) == 0); - MyPgXact->vacuumFlags = pgxact->vacuumFlags; + MyPgXact->vacuumFlags = (MyPgXact->vacuumFlags & ~PROC_XMIN_FLAGS) | + (pgxact->vacuumFlags & PROC_XMIN_FLAGS); result = true; } diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h index 9cf9684b41..7c85b5645b 100644 --- a/src/include/storage/proc.h +++ b/src/include/storage/proc.h @@ -63,11 +63,10 @@ struct XidCache (PROC_IN_VACUUM | PROC_IN_ANALYZE | PROC_VACUUM_FOR_WRAPAROUND) /* - * Flags that are valid to copy from another proc, the parallel leader - * process in practice. Currently, a flag that is set during parallel - * vacuum is allowed. + * Xmin-related flags. Make sure any flags that affect how the process' Xmin + * value is interpreted by VACUUM are included here. */ -#define PROC_COPYABLE_FLAGS (PROC_IN_VACUUM) +#define PROC_XMIN_FLAGS (PROC_IN_VACUUM) /* * We allow a small number of "weak" relation locks (AccessShareLock, -- 2.30.2 --gseizntho2k3boor Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename="v14-0001-Repurpose-PROC_COPYABLE_FLAGS-as-PROC_XMIN_FLAGS.patch" From 35197d187fe3e7c9e4bd563396c9c7459e39a7ff Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Sat, 14 May 2022 16:51:23 +0200 Subject: [PATCH] Repurpose PROC_COPYABLE_FLAGS as PROC_XMIN_FLAGS This is a slight, convenient semantics change from what commit 0f0cfb494004 introduced that lets us simplify the coding in the one place where it is used. --- src/backend/storage/ipc/procarray.c | 11 ++++++----- src/include/storage/proc.h | 7 +++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c index 127be9c017..08053a7e8f 100644 --- a/src/backend/storage/ipc/procarray.c +++ b/src/backend/storage/ipc/procarray.c @@ -2686,12 +2686,13 @@ ProcArrayInstallRestoredXmin(TransactionId xmin, PGPROC *proc) TransactionIdIsNormal(xid) && TransactionIdPrecedesOrEquals(xid, xmin)) { - /* Install xmin */ + /* + * Install xmin and propagate the statusFlags that affect how the + * value is interpreted by vacuum. + */ MyProc->xmin = TransactionXmin = xmin; - - /* Flags being copied must be valid copy-able flags. */ - Assert((proc->statusFlags & (~PROC_COPYABLE_FLAGS)) == 0); - MyProc->statusFlags = proc->statusFlags; + MyProc->statusFlags = (MyProc->statusFlags & ~PROC_XMIN_FLAGS) | + (proc->statusFlags & PROC_XMIN_FLAGS); ProcGlobal->statusFlags[MyProc->pgxactoff] = MyProc->statusFlags; result = true; diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h index 11b514c9ae..1464fad9b9 100644 --- a/src/include/storage/proc.h +++ b/src/include/storage/proc.h @@ -66,11 +66,10 @@ struct XidCache (PROC_IN_VACUUM | PROC_IN_SAFE_IC | PROC_VACUUM_FOR_WRAPAROUND) /* - * Flags that are valid to copy from another proc, the parallel leader - * process in practice. Currently, flags that are set during parallel - * vacuum and parallel index creation are allowed. + * Xmin-related flags. Make sure any flags that affect how the process' Xmin + * value is interpreted by VACUUM are included here. */ -#define PROC_COPYABLE_FLAGS (PROC_IN_VACUUM | PROC_IN_SAFE_IC) +#define PROC_XMIN_FLAGS (PROC_IN_VACUUM | PROC_IN_SAFE_IC) /* * We allow a small number of "weak" relation locks (AccessShareLock, -- 2.30.2 --gseizntho2k3boor--