From 3b242a875203185db96563c9abc1bd59a6ee1d3b Mon Sep 17 00:00:00 2001 From: "Chao Li (Evan)" Date: Mon, 2 Feb 2026 14:03:57 +0800 Subject: [PATCH v1] walsender: Assert MyReplicationSlot is set before use Author: Chao Li Reviewed-by: Discussion: https://postgr.es/m/ --- src/backend/replication/walsender.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c index a0e6a3d200c..cff0ee4e74f 100644 --- a/src/backend/replication/walsender.c +++ b/src/backend/replication/walsender.c @@ -1466,6 +1466,8 @@ StartLogicalReplication(StartReplicationCmd *cmd) ReplicationSlotAcquire(cmd->slotname, true, true); + Assert(MyReplicationSlot); + /* * Force a disconnect, so that the decoding code doesn't need to care * about an eventual switch from running in recovery, to running in a @@ -1765,6 +1767,8 @@ NeedToWaitForStandbys(XLogRecPtr flushed_lsn, uint32 *wait_event) int elevel = got_STOPPING ? ERROR : WARNING; bool failover_slot; + Assert(MyReplicationSlot); + failover_slot = (replication_active && MyReplicationSlot->data.failover); /* -- 2.50.1 (Apple Git-155)