PS_NITPICKS_2PC_v21.txt

text/plain

Filename: PS_NITPICKS_2PC_v21.txt
Type: text/plain
Part: 0
Message: Re: Slow catchup of 2PC (twophase) transactions on replica in LR
diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c
index 90df32f..da97836 100644
--- a/src/backend/access/transam/twophase.c
+++ b/src/backend/access/transam/twophase.c
@@ -2712,7 +2712,7 @@ IsTwoPhaseTransactionGidForSubid(Oid subid, char *gid)
 	int			ret;
 	Oid			subid_from_gid;
 	TransactionId xid_from_gid;
-	char		gid_generated[GIDSIZE];
+	char		gid_tmp[GIDSIZE];
 
 	/* Extract the subid and xid from the given GID */
 	ret = sscanf(gid, "pg_gid_%u_%u", &subid_from_gid, &xid_from_gid);
@@ -2729,10 +2729,9 @@ IsTwoPhaseTransactionGidForSubid(Oid subid, char *gid)
 	 * the given GID and check whether the temporary GID and the given GID
 	 * match.
 	 */
-	TwoPhaseTransactionGid(subid, xid_from_gid, gid_generated,
-						   sizeof(gid_generated));
+	TwoPhaseTransactionGid(subid, xid_from_gid, gid_tmp, sizeof(gid_tmp));
 
-	return strcmp(gid, gid_generated) == 0;
+	return strcmp(gid, gid_tmp) == 0;
 }
 
 /*
diff --git a/src/backend/commands/subscriptioncmds.c b/src/backend/commands/subscriptioncmds.c
index 2e9f329..5f11235 100644
--- a/src/backend/commands/subscriptioncmds.c
+++ b/src/backend/commands/subscriptioncmds.c
@@ -1071,7 +1071,7 @@ AlterSubscription_refresh(Subscription *sub, bool copy_data,
 }
 
 /*
- * Common checks for altering failover and two_phase option
+ * Common checks for altering failover and two_phase options.
  */
 static void
 CheckAlterSubOption(Subscription *sub, const char *option,
@@ -1337,8 +1337,8 @@ AlterSubscription(ParseState *pstate, AlterSubscriptionStmt *stmt,
 				if (IsSet(opts.specified_opts, SUBOPT_FAILOVER))
 				{
 					/*
-					 * Samilar to two_phase, we need to update the failover
-					 * option for the slot and the subscription.
+					 * Similar to the two_phase case above, we need to update
+					 * the failover option for the slot and the subscription.
 					 */
 					update_failover = true;