From 842ed6373804c95cf297612401d8c82a2f9f1a2a Mon Sep 17 00:00:00 2001
From: Hou Zhijie <houzj.fnst@cn.fujitsu.com>
Date: Thu, 15 Feb 2024 11:17:43 +0800
Subject: [PATCH 2/2] Add a log if remote slot didn't catch up to locally
 reserved position

---
 src/backend/replication/logical/slotsync.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/backend/replication/logical/slotsync.c b/src/backend/replication/logical/slotsync.c
index 0aa1bf1ad2..35039bb1ab 100644
--- a/src/backend/replication/logical/slotsync.c
+++ b/src/backend/replication/logical/slotsync.c
@@ -362,6 +362,15 @@ update_and_persist_local_synced_slot(RemoteSlot *remote_slot, Oid remote_dbid)
 		 * take more time to create such a slot. Therefore, we keep this slot
 		 * and attempt the synchronization in the next cycle.
 		 */
+		ereport(LOG,
+				errmsg("waiting for remote slot \"%s\" LSN (%X/%X) and catalog xmin"
+					   " (%u) to pass local slot LSN (%X/%X) and catalog xmin (%u)",
+					   remote_slot->name,
+					   LSN_FORMAT_ARGS(remote_slot->restart_lsn),
+					   remote_slot->catalog_xmin,
+					   LSN_FORMAT_ARGS(slot->data.restart_lsn),
+					   slot->data.catalog_xmin));
+
 		return;
 	}
 
-- 
2.30.0.windows.2

