=== Applying patches on top of PostgreSQL commit ID 79c65b9d97fe92ea2792be09479cf4bbea7cefe1 === /etc/rc.d/jail: WARNING: Per-jail configuration via jail_* variables is obsolete. Please consider migrating to /etc/jail.conf. Thu Jun 11 16:42:26 UTC 2026 On branch cf/6862 nothing to commit, working tree clean === using 'git am' to apply patch ./v2-0001-Fix-race-condition-in-logical-decoding-timeline-s.patch === Applying: Fix race condition in logical decoding timeline selection during promotion Using index info to reconstruct a base tree... M src/backend/replication/walsender.c Falling back to patching base and 3-way merge... Auto-merging src/backend/replication/walsender.c CONFLICT (content): Merge conflict in src/backend/replication/walsender.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 race condition in logical decoding timeline selection during promotion 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 ./v2-0001-Fix-race-condition-in-logical-decoding-timeline-s.patch === patching file src/backend/replication/walsender.c Hunk #1 FAILED at 1104. 1 out of 1 hunk FAILED -- saving rejects to file src/backend/replication/walsender.c.rej Removing src/backend/replication/walsender.c.rej === using 'git apply' to apply patch ./v2-0001-Fix-race-condition-in-logical-decoding-timeline-s.patch === Applied patch to 'src/backend/replication/walsender.c' with conflicts. U src/backend/replication/walsender.c diff --cc src/backend/replication/walsender.c index c931d9b4fa8,e80ed052077..00000000000 --- a/src/backend/replication/walsender.c +++ b/src/backend/replication/walsender.c @@@ -1109,17 -1109,12 +1109,26 @@@ logical_read_xlog_page(XLogReaderState /* * If the insertion timeline has already been set, use it. ++<<<<<<< ours + * InsertTimeLineID is set before the WAL segments of the old timeline + * are removed, before SharedRecoveryState switches to + * RECOVERY_STATE_DONE. + * + * There is a window where RecoveryInProgress() still returns true but + * the old timeline's WAL segments have already been removed or + * recycled. Using the WAL insertion timeline avoids attempting to + * read from those removed segments, improving availability, and is a + * safe thing to do as promotion copies the contents in the last + * segment of the old timeline to the first segment of the new + * timeline, up to the switchpoint. ++======= + * InsertTimeLineID is set before old timeline WAL segments are + * removed and before SharedRecoveryState flips to + * RECOVERY_STATE_DONE. So there is a window where + * RecoveryInProgress() still returns true but the old timeline's WAL + * segments have already been removed or recycled. Using the insertion + * timeline avoids attempting to read from those removed segments. ++>>>>>>> theirs */ insertTLI = GetWALInsertionTimeLineIfSet(); if (insertTLI != 0)