PS_NITPICKS_20240816_seq_0004.txt

text/plain

Filename: PS_NITPICKS_20240816_seq_0004.txt
Type: text/plain
Part: 0
Message: Re: Logical Replication of sequences
diff --git a/src/backend/commands/subscriptioncmds.c b/src/backend/commands/subscriptioncmds.c
index 534d385..e799a41 100644
--- a/src/backend/commands/subscriptioncmds.c
+++ b/src/backend/commands/subscriptioncmds.c
@@ -800,9 +800,9 @@ CreateSubscription(ParseState *pstate, CreateSubscriptionStmt *stmt,
 			 * export it.
 			 *
 			 * XXX: If the subscription is for a sequence-only publication,
-			 * creating this slot. It can be created later during the ALTER
-			 * SUBSCRIPTION ... REFRESH command, if the publication is updated
-			 * to include tables or tables in schema.
+			 * creating this slot is unnecessary. It can be created later
+			 * during the ALTER SUBSCRIPTION ... REFRESH command, if the
+			 * publication is updated to include tables or tables in schema.
 			 */
 			if (opts.create_slot)
 			{
diff --git a/src/backend/replication/logical/sequencesync.c b/src/backend/replication/logical/sequencesync.c
index 1aa5ab8..934646f 100644
--- a/src/backend/replication/logical/sequencesync.c
+++ b/src/backend/replication/logical/sequencesync.c
@@ -264,17 +264,17 @@ copy_sequence(WalReceiverConn *conn, Relation rel,
  * Report any sequence mismatches as a single warning log.
  */
 static void
-report_mismatched_sequences(StringInfo warning_sequences)
+report_mismatched_sequences(StringInfo mismatched_seqs)
 {
-	if (warning_sequences->len)
+	if (mismatched_seqs->len)
 	{
 		ereport(WARNING,
 				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				errmsg("parameters differ for the remote and local sequences (%s) for subscription \"%s\"",
-					   warning_sequences->data, MySubscription->name),
+					   mismatched_seqs->data, MySubscription->name),
 				errhint("Alter/Re-create local sequences to have the same parameters as the remote sequences."));
 
-		resetStringInfo(warning_sequences);
+		resetStringInfo(mismatched_seqs);
 	}
 }
 
@@ -282,15 +282,15 @@ report_mismatched_sequences(StringInfo warning_sequences)
  * append_mismatched_sequences
  *
  * Appends details of sequences that have discrepancies between the publisher
- * and subscriber to the warning_sequences string.
+ * and subscriber to the mismatched_seqs string.
  */
 static void
-append_mismatched_sequences(StringInfo warning_sequences, Relation seqrel)
+append_mismatched_sequences(StringInfo mismatched_seqs, Relation seqrel)
 {
-	if (warning_sequences->len)
-		appendStringInfoString(warning_sequences, ", ");
+	if (mismatched_seqs->len)
+		appendStringInfoString(mismatched_seqs, ", ");
 
-	appendStringInfo(warning_sequences, "\"%s.%s\"",
+	appendStringInfo(mismatched_seqs, "\"%s.%s\"",
 					 get_namespace_name(RelationGetNamespace(seqrel)),
 					 RelationGetRelationName(seqrel));
 }
@@ -314,7 +314,7 @@ LogicalRepSyncSequences(void)
 	bool		start_txn = true;
 	Oid			subid = MyLogicalRepWorker->subid;
 	MemoryContext oldctx;
-	StringInfo	warning_sequences = makeStringInfo();
+	StringInfo	mismatched_seqs = makeStringInfo();
 
 /*
  * Synchronizing each sequence individually incurs overhead from starting
@@ -425,15 +425,15 @@ LogicalRepSyncSequences(void)
 		PG_CATCH();
 		{
 			if (sequence_mismatch)
-				append_mismatched_sequences(warning_sequences, sequence_rel);
+				append_mismatched_sequences(mismatched_seqs, sequence_rel);
 
-			report_mismatched_sequences(warning_sequences);
+			report_mismatched_sequences(mismatched_seqs);
 			PG_RE_THROW();
 		}
 		PG_END_TRY();
 
 		if (sequence_mismatch)
-			append_mismatched_sequences(warning_sequences, sequence_rel);
+			append_mismatched_sequences(mismatched_seqs, sequence_rel);
 
 		UpdateSubscriptionRelState(subid, seqinfo->relid, SUBREL_STATE_READY,
 								   sequence_lsn);
@@ -462,7 +462,7 @@ LogicalRepSyncSequences(void)
 										get_subscription_name(subid, false), get_rel_name(done_seq->relid)));
 			}
 
-			report_mismatched_sequences(warning_sequences);
+			report_mismatched_sequences(mismatched_seqs);
 
 			ereport(LOG,
 					errmsg("logical replication synchronized %d of %d sequences for subscription \"%s\" ",