=== Applying patches on top of PostgreSQL commit ID 158d8fadd79f90935cb9bc1ae0bec366cbf09f42 === /etc/rc.d/jail: WARNING: Per-jail configuration via jail_* variables is obsolete. Please consider migrating to /etc/jail.conf. Mon Apr 20 12:25:22 UTC 2026 On branch cf/6546 nothing to commit, working tree clean === using 'git am' to apply patch ./v4-0001-Fix-slotsync-worker-busy-loop-causing-repeated-lo.patch === Applying: Fix slotsync worker busy loop causing repeated logical decoding logs. Using index info to reconstruct a base tree... M src/backend/replication/logical/slotsync.c Falling back to patching base and 3-way merge... Auto-merging src/backend/replication/logical/slotsync.c No changes -- Patch already applied. === using 'git am' to apply patch ./v4_PG17_18-0001-Fix-slotsync-worker-busy-loop-causing-rep.patch === Applying: Fix slotsync worker busy loop causing repeated logical decoding logs. Using index info to reconstruct a base tree... M src/backend/replication/logical/slotsync.c Falling back to patching base and 3-way merge... Auto-merging src/backend/replication/logical/slotsync.c CONFLICT (content): Merge conflict in src/backend/replication/logical/slotsync.c error: Failed to merge in the changes. hint: Use 'git am --show-current-patch=diff' to see the failed patch Patch failed at 0001 Fix slotsync worker busy loop causing repeated logical decoding logs. When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort". === using patch(1) to apply patch ./v4_PG17_18-0001-Fix-slotsync-worker-busy-loop-causing-rep.patch === patching file src/backend/replication/logical/slotsync.c Hunk #1 FAILED at 275. Hunk #2 FAILED at 289. 2 out of 2 hunks FAILED -- saving rejects to file src/backend/replication/logical/slotsync.c.rej Removing src/backend/replication/logical/slotsync.c.rej === using 'git apply' to apply patch ./v4_PG17_18-0001-Fix-slotsync-worker-busy-loop-causing-rep.patch === Applied patch to 'src/backend/replication/logical/slotsync.c' with conflicts. U src/backend/replication/logical/slotsync.c diff --cc src/backend/replication/logical/slotsync.c index ad3747e598c,3cbcd77d12f..00000000000 --- a/src/backend/replication/logical/slotsync.c +++ b/src/backend/replication/logical/slotsync.c @@@ -333,11 -273,13 +333,20 @@@ update_local_synced_slot(RemoteSlot *re slot->data.catalog_xmin = remote_slot->catalog_xmin; SpinLockRelease(&slot->mutex); ++<<<<<<< ours ++======= + if (found_consistent_snapshot) + *found_consistent_snapshot = true; + ++>>>>>>> theirs updated_xmin_or_lsn = true; } else { ++<<<<<<< ours + bool found_consistent_snapshot; ++======= ++>>>>>>> theirs XLogRecPtr old_confirmed_lsn = slot->data.confirmed_flush; XLogRecPtr old_restart_lsn = slot->data.restart_lsn; XLogRecPtr old_catalog_xmin = slot->data.catalog_xmin; @@@ -355,23 -297,6 +364,26 @@@ LSN_FORMAT_ARGS(slot->data.confirmed_flush))); /* ++<<<<<<< ours + * If we can't reach a consistent snapshot, the slot won't be + * persisted. See update_and_persist_local_synced_slot(). + */ + if (!found_consistent_snapshot) + { + Assert(MyReplicationSlot->data.persistency == RS_TEMPORARY); + + ereport(LOG, + errmsg("could not synchronize replication slot \"%s\"", + remote_slot->name), + errdetail("Synchronization could lead to data loss, because the standby could not build a consistent snapshot to decode WALs at LSN %X/%08X.", + LSN_FORMAT_ARGS(slot->data.restart_lsn))); + + skip_reason = SS_SKIP_NO_CONSISTENT_SNAPSHOT; + } + + /* ++======= ++>>>>>>> theirs * It is possible that the slot's xmin or LSNs are not updated, * when the synced slot has reached consistent snapshot state or * cannot build one at all.