=== Applying patches on top of PostgreSQL commit ID 25303961d09c7e2354a48cbce511a06cce691907 === /etc/rc.d/jail: WARNING: Per-jail configuration via jail_* variables is obsolete. Please consider migrating to /etc/jail.conf. Sat Dec 6 19:03:21 UTC 2025 On branch cf/5199 nothing to commit, working tree clean === using 'git am' to apply patch ./v2-0001-Fix-walreceiver-set-incorrect-flushedUpto-when-sw.patch === Applying: Fix walreceiver set incorrect flushedUpto when switching primary Using index info to reconstruct a base tree... M src/backend/replication/walreceiverfuncs.c Falling back to patching base and 3-way merge... Auto-merging src/backend/replication/walreceiverfuncs.c CONFLICT (content): Merge conflict in src/backend/replication/walreceiverfuncs.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 walreceiver set incorrect flushedUpto when switching primary 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/walreceiverfuncs.c === using patch(1) to apply patch ./v2-0001-Fix-walreceiver-set-incorrect-flushedUpto-when-sw.patch === patching file src/backend/replication/walreceiverfuncs.c Hunk #1 FAILED at 298. 1 out of 1 hunk FAILED -- saving rejects to file src/backend/replication/walreceiverfuncs.c.rej Removing src/backend/replication/walreceiverfuncs.c.rej === using 'git apply' to apply patch ./v2-0001-Fix-walreceiver-set-incorrect-flushedUpto-when-sw.patch === Applied patch to 'src/backend/replication/walreceiverfuncs.c' with conflicts. U src/backend/replication/walreceiverfuncs.c diff --cc src/backend/replication/walreceiverfuncs.c index 822645748a7,a8d3e14f552..00000000000 --- a/src/backend/replication/walreceiverfuncs.c +++ b/src/backend/replication/walreceiverfuncs.c @@@ -312,10 -298,10 +312,14 @@@ RequestXLogStreaming(TimeLineID tli, XL walrcv->startTime = now; /* - * If this is the first startup of walreceiver (on this timeline), + * If this is the first startup of walreceiver (on this timeline) or recptr lt last flushedLsn, * initialize flushedUpto and latestChunkStart to the starting point. */ ++<<<<<<< ours + if (!XLogRecPtrIsValid(walrcv->receiveStart) || walrcv->receivedTLI != tli) ++======= + if (walrcv->receiveStart == 0 || walrcv->receivedTLI != tli || recptr < walrcv->receiveStart) ++>>>>>>> theirs { walrcv->flushedUpto = recptr; walrcv->receivedTLI = tli;