v14-0005-Reorder-steps-of-2PC-preparation.patch

application/octet-stream

Filename: v14-0005-Reorder-steps-of-2PC-preparation.patch
Type: application/octet-stream
Part: 4
Message: Re: CREATE INDEX CONCURRENTLY does not index prepared xact's data

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: format-patch
Series: patch v14-0005
Subject: Reorder steps of 2PC preparation
File+
src/backend/access/transam/xact.c 9 7
From 88f4e21a9d8cec4fbe60029599d6001113d52585 Mon Sep 17 00:00:00 2001
From: Andrey Borodin <amborodin@acm.org>
Date: Sat, 7 Aug 2021 20:27:14 +0500
Subject: [PATCH v14 5/6] Reorder steps of 2PC preparation

Currently we remove xid from PGPROC being referenced by locks.
We can do so only when locks are transfered to 2PC PGPROC.
---
 src/backend/access/transam/xact.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index 387f80419a..bebd08f598 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -2495,13 +2495,6 @@ PrepareTransaction(void)
 	/* Reset XactLastRecEnd until the next transaction writes something */
 	XactLastRecEnd = 0;
 
-	/*
-	 * Let others know about no transaction in progress by me.  This has to be
-	 * done *after* the prepared transaction has been marked valid, else
-	 * someone may think it is unlocked and recyclable.
-	 */
-	ProcArrayClearTransaction(MyProc);
-
 	/*
 	 * In normal commit-processing, this is all non-critical post-transaction
 	 * cleanup.  When the transaction is prepared, however, it's important
@@ -2535,6 +2528,15 @@ PrepareTransaction(void)
 	PostPrepare_MultiXact(xid);
 
 	PostPrepare_Locks(xid);
+
+	/*
+	 * Let others know about no transaction in progress by me.  This has to be
+	 * done *after* the prepared transaction has been marked valid and locks
+	 * transfered to new PGPROC, else someone may think it is unlocked and
+	 * recyclable.
+	 */
+	ProcArrayClearTransaction(MyProc);
+
 	PostPrepare_PredicateLocks(xid);
 
 	ResourceOwnerRelease(TopTransactionResourceOwner,
-- 
2.24.3 (Apple Git-128)