summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmit Kapila2024-02-16 03:32:54 +0000
committerAmit Kapila2024-02-16 03:32:54 +0000
commit7a424ece4828fa107f36e1c77985eabdbe69e50b (patch)
tree1f30100fd4058a0b3687177c7bd04b7446278de6
parent1fe66680c09b6cc1ed20236c84f0913a7b786bbc (diff)
Add more LOG and DEBUG messages for slot synchronization.
This provides more information about remote slots during synchronization which helps in debugging bugs and BF failures due to test case issues. We might later want to change the LOG message added by this patch to DEBUG1. Author: Hou Zhijie Reviewed-by: Amit Kapila, Bertrand Drouvot Discussion: https://postgr.es/m/[email protected] Discussion: https://postgr.es/m/OS0PR01MB571633C23B2A4CAC5FB0371A944C2@OS0PR01MB5716.jpnprd01.prod.outlook.com
-rw-r--r--src/backend/replication/logical/slotsync.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/backend/replication/logical/slotsync.c b/src/backend/replication/logical/slotsync.c
index 0aa1bf1ad28..f1542ef0e96 100644
--- a/src/backend/replication/logical/slotsync.c
+++ b/src/backend/replication/logical/slotsync.c
@@ -321,6 +321,9 @@ reserve_wal_for_local_slot(XLogRecPtr restart_lsn)
oldest_segno = XLogGetOldestSegno(cur_timeline);
}
+ elog(DEBUG1, "segno: %ld of purposed restart_lsn for the synced slot, oldest_segno: %ld available",
+ segno, oldest_segno);
+
/*
* If all required WAL is still there, great, otherwise retry. The
* slot should prevent further removal of WAL, unless there's a
@@ -361,7 +364,18 @@ update_and_persist_local_synced_slot(RemoteSlot *remote_slot, Oid remote_dbid)
* current location when recreating the slot in the next cycle. It may
* take more time to create such a slot. Therefore, we keep this slot
* and attempt the synchronization in the next cycle.
+ *
+ * XXX should this be changed to elog(DEBUG1) perhaps?
*/
+ ereport(LOG,
+ errmsg("could not sync slot information as remote slot precedes local slot:"
+ " remote slot \"%s\": LSN (%X/%X), catalog xmin (%u) local slot: LSN (%X/%X), 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;
}