=== Applying patches on top of PostgreSQL commit ID 7da9d8f2db655eefba8757a66097bfabd3660a82 === /etc/rc.d/jail: WARNING: Per-jail configuration via jail_* variables is obsolete. Please consider migrating to /etc/jail.conf. Tue Dec 30 04:09:22 UTC 2025 On branch cf/6338 nothing to commit, working tree clean === using 'git am' to apply patch ./REL_13_0001-Fix-a-race-condition-in-updating-procArray-replicati.patch === Applying: Fix a race condition in updating procArray->replication_slot_xmin. === using 'git am' to apply patch ./REL_14_0001-Fix-a-race-condition-in-updating-procArray-replicati.patch === Applying: Fix a race condition in updating procArray->replication_slot_xmin. Using index info to reconstruct a base tree... M src/backend/replication/logical/logical.c M src/backend/replication/slot.c Falling back to patching base and 3-way merge... Auto-merging src/backend/replication/slot.c Auto-merging src/backend/replication/logical/logical.c No changes -- Patch already applied. === using 'git am' to apply patch ./REL_15_0001-Fix-a-race-condition-in-updating-procArray-replicati.patch === Applying: Fix a race condition in updating procArray->replication_slot_xmin. Using index info to reconstruct a base tree... M src/backend/replication/logical/logical.c M src/backend/replication/slot.c Falling back to patching base and 3-way merge... Auto-merging src/backend/replication/slot.c Auto-merging src/backend/replication/logical/logical.c No changes -- Patch already applied. === using 'git am' to apply patch ./REL_16_0001-Fix-a-race-condition-in-updating-procArray-replicati.patch === Applying: Fix a race condition in updating procArray->replication_slot_xmin. Using index info to reconstruct a base tree... M src/backend/replication/logical/logical.c M src/backend/replication/slot.c Falling back to patching base and 3-way merge... Auto-merging src/backend/replication/slot.c Auto-merging src/backend/replication/logical/logical.c No changes -- Patch already applied. === using 'git am' to apply patch ./REL_17_0001-Fix-a-race-condition-in-updating-procArray-replicati.patch === Applying: Fix a race condition in updating procArray->replication_slot_xmin. Using index info to reconstruct a base tree... M src/backend/replication/logical/logical.c M src/backend/replication/logical/slotsync.c M src/backend/replication/slot.c Falling back to patching base and 3-way merge... Auto-merging src/backend/replication/slot.c Auto-merging src/backend/replication/logical/slotsync.c Auto-merging src/backend/replication/logical/logical.c === using 'git am' to apply patch ./REL_18_0001-Fix-a-race-condition-in-updating-procArray-replicati.patch === Applying: Fix a race condition in updating procArray->replication_slot_xmin. Using index info to reconstruct a base tree... M src/backend/replication/logical/logical.c M src/backend/replication/logical/slotsync.c M src/backend/replication/slot.c Falling back to patching base and 3-way merge... Auto-merging src/backend/replication/slot.c Auto-merging src/backend/replication/logical/slotsync.c CONFLICT (content): Merge conflict in src/backend/replication/logical/slotsync.c Auto-merging src/backend/replication/logical/logical.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 a race condition in updating procArray->replication_slot_xmin. 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". Unstaged changes after reset: M src/backend/replication/logical/slotsync.c === using patch(1) to apply patch ./REL_18_0001-Fix-a-race-condition-in-updating-procArray-replicati.patch === patching file src/backend/replication/logical/logical.c Hunk #1 FAILED at 405. Hunk #2 FAILED at 422. Hunk #3 FAILED at 436. 3 out of 3 hunks FAILED -- saving rejects to file src/backend/replication/logical/logical.c.rej patching file src/backend/replication/logical/slotsync.c Hunk #1 FAILED at 776. Hunk #2 FAILED at 784. 2 out of 2 hunks FAILED -- saving rejects to file src/backend/replication/logical/slotsync.c.rej patching file src/backend/replication/slot.c Hunk #1 FAILED at 1129. Hunk #2 FAILED at 1140. Hunk #3 FAILED at 1176. 3 out of 3 hunks FAILED -- saving rejects to file src/backend/replication/slot.c.rej Removing src/backend/replication/logical/logical.c.rej Removing src/backend/replication/logical/slotsync.c.rej Removing src/backend/replication/slot.c.rej === using 'git apply' to apply patch ./REL_18_0001-Fix-a-race-condition-in-updating-procArray-replicati.patch === Applied patch to 'src/backend/replication/logical/logical.c' cleanly. Applied patch to 'src/backend/replication/logical/slotsync.c' with conflicts. Applied patch to 'src/backend/replication/slot.c' cleanly. U src/backend/replication/logical/slotsync.c diff --cc src/backend/replication/logical/slotsync.c index 0feebffd431,64db4fedbe8..00000000000 --- a/src/backend/replication/logical/slotsync.c +++ b/src/backend/replication/logical/slotsync.c @@@ -867,37 -786,8 +867,40 @@@ synchronize_one_slot(RemoteSlot *remote ReplicationSlotsComputeRequiredXmin(true); LWLockRelease(ProcArrayLock); LWLockRelease(ReplicationSlotControlLock); ++<<<<<<< ours + + /* + * Make sure that concerned WAL is received and flushed before syncing + * slot to target lsn received from the primary server. + * + * Report statistics only after the slot has been acquired, ensuring + * it cannot be dropped during the reporting process. + */ + if (remote_slot->confirmed_lsn > latestFlushPtr) + { + update_slotsync_skip_stats(SS_SKIP_WAL_NOT_FLUSHED); + + /* + * Can get here only if GUC 'synchronized_standby_slots' on the + * primary server was not configured correctly. + */ + ereport(AmLogicalSlotSyncWorkerProcess() ? LOG : ERROR, + errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), + errmsg("skipping slot synchronization because the received slot sync" + " LSN %X/%08X for slot \"%s\" is ahead of the standby position %X/%08X", + LSN_FORMAT_ARGS(remote_slot->confirmed_lsn), + remote_slot->name, + LSN_FORMAT_ARGS(latestFlushPtr))); + + ReplicationSlotRelease(); ++======= ++>>>>>>> theirs - update_and_persist_local_synced_slot(remote_slot, remote_dbid); + return false; + } + + update_and_persist_local_synced_slot(remote_slot, remote_dbid, + slot_persistence_pending); slot_updated = true; }