Hi,

I noticed that the comment for ReplicationSlotCreate function contains this
description for the "two_phase" option :

 * two_phase: Allows decoding of prepared transactions. We allow this option
 *     to be enabled only at the slot creation time. If we allow this option
 *     to be changed during decoding then it is quite possible that we skip
 *     prepare first time because this option was not enabled. Now next time
 *     during getting changes, if the two_phase option is enabled it can skip
 *     prepare because by that time start decoding point has been moved. So the
 *     user will only get commit prepared.

But commit [1] introduced the ability to alter the "two_phase" option for the
replication slot. Thus, I guess that the comment mentioned above is
outdated and we should change it.

[1] 1462aad2e4474ab61174f8ab00992cd3d6d57c7b

--
Best regards,
Daniil Davydov
From 9545671c48ee75ee7f9eed26af0902fcd3114573 Mon Sep 17 00:00:00 2001
From: Daniil Davidov <[email protected]>
Date: Mon, 29 Dec 2025 20:27:11 +0700
Subject: [PATCH] Fix comment for ReplicationSlotCreate

---
 src/backend/replication/slot.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/src/backend/replication/slot.c b/src/backend/replication/slot.c
index 58c41d45516..310dcfcbd5f 100644
--- a/src/backend/replication/slot.c
+++ b/src/backend/replication/slot.c
@@ -369,13 +369,7 @@ IsSlotForConflictCheck(const char *name)
  * name: Name of the slot
  * db_specific: logical decoding is db specific; if the slot is going to
  *	   be used for that pass true, otherwise false.
- * two_phase: Allows decoding of prepared transactions. We allow this option
- *     to be enabled only at the slot creation time. If we allow this option
- *     to be changed during decoding then it is quite possible that we skip
- *     prepare first time because this option was not enabled. Now next time
- *     during getting changes, if the two_phase option is enabled it can skip
- *     prepare because by that time start decoding point has been moved. So the
- *     user will only get commit prepared.
+ * two_phase: If enabled, allows decoding of prepared transactions.
  * failover: If enabled, allows the slot to be synced to standbys so
  *     that logical replication can be resumed after failover.
  * synced: True if the slot is synchronized from the primary server.
-- 
2.43.0

Reply via email to