From 8cd7318575a65172d40f1cd66a6c5fc807d3366a Mon Sep 17 00:00:00 2001 From: Fujii Masao Date: Fri, 27 Feb 2026 23:02:23 +0900 Subject: [PATCH v1] Fix slotsync worker busy loop causing repeated logical decoding logs. Previously, the slotsync worker could enter a busy loop and emit four logical log messages every 200 ms, even when both the primary and standby were idle. This happened because the worker incorrectly treated certain cases as successful slot updates, causing it to use the minimum sleep interval and repeatedly restart slot syncing. This commit fixes this by ensuring the worker does not treat such cases as updates, allowing it to sleep normally and avoid excessive log output. --- src/backend/replication/logical/slotsync.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/backend/replication/logical/slotsync.c b/src/backend/replication/logical/slotsync.c index 062a08ccb88..fc2153e243b 100644 --- a/src/backend/replication/logical/slotsync.c +++ b/src/backend/replication/logical/slotsync.c @@ -310,8 +310,10 @@ update_local_synced_slot(RemoteSlot *remote_slot, Oid remote_dbid) slot->data.confirmed_flush = remote_slot->confirmed_lsn; slot->data.catalog_xmin = remote_slot->catalog_xmin; SpinLockRelease(&slot->mutex); + + updated_xmin_or_lsn = true; } - else + else if (remote_slot->confirmed_lsn > slot->data.confirmed_flush) { bool found_consistent_snapshot; @@ -343,9 +345,9 @@ update_local_synced_slot(RemoteSlot *remote_slot, Oid remote_dbid) skip_reason = SS_SKIP_NO_CONSISTENT_SNAPSHOT; } - } - updated_xmin_or_lsn = true; + updated_xmin_or_lsn = true; + } } /* Update slot sync skip stats */ -- 2.51.2