=== Applying patches on top of PostgreSQL commit ID 3cf5264557bee2ba848e5276beecc10571d468a6 === /etc/rc.d/jail: WARNING: Per-jail configuration via jail_* variables is obsolete. Please consider migrating to /etc/jail.conf. Thu Jul 16 08:18:32 UTC 2026 On branch cf/6988 nothing to commit, working tree clean === using 'git am' to apply patch ./v1-0001-ecpg-Fix-auto_mem-cleanup-on-thread-exit.patch === Applying: ecpg: Fix auto_mem cleanup on thread exit. === using 'git am' to apply patch ./v1-0002-port-Provide-minimal-pg_threads.h-API.patch === Applying: port: Provide minimal pg_threads.h API. === using 'git am' to apply patch ./v1-0003-port-Use-pg_threads.h-API-for-pg_localconv_r.patch === Applying: port: Use pg_threads.h API for pg_localconv_r(). === using 'git am' to apply patch ./v1-0004-ecpg-Improve-variable-name.patch === Applying: ecpg: Improve variable name. === using 'git am' to apply patch ./v1-0005-ecpg-Use-pg_threads.h.patch === Applying: ecpg: Use pg_threads.h. === using 'git am' to apply patch ./v1-0006-pgbench-Use-pg_threads.h.patch === Applying: pgbench: Use pg_threads.h. === using 'git am' to apply patch ./v1-0007-libpq-Use-pg_threads.h.patch === Applying: libpq: Use pg_threads.h. === using 'git am' to apply patch ./v1-0008-pg_basebackup-Use-pg_threads.h.patch === Applying: pg_basebackup: Use pg_threads.h. Using index info to reconstruct a base tree... M src/bin/pg_basebackup/pg_basebackup.c Falling back to patching base and 3-way merge... Auto-merging src/bin/pg_basebackup/pg_basebackup.c CONFLICT (content): Merge conflict in src/bin/pg_basebackup/pg_basebackup.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 pg_basebackup: Use pg_threads.h. 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 ./v1-0008-pg_basebackup-Use-pg_threads.h.patch === patching file src/bin/pg_basebackup/pg_basebackup.c Hunk #5 FAILED at 416. Hunk #6 succeeded at 508 (offset 1 line). Hunk #7 succeeded at 542 (offset 1 line). Hunk #8 succeeded at 589 (offset 1 line). Hunk #9 succeeded at 661 (offset 1 line). Hunk #10 succeeded at 969 (offset 1 line). Hunk #11 succeeded at 2131 (offset 1 line). Hunk #12 succeeded at 2699 (offset 1 line). 1 out of 12 hunks FAILED -- saving rejects to file src/bin/pg_basebackup/pg_basebackup.c.rej patching file src/bin/pg_basebackup/t/010_pg_basebackup.pl Unstaged changes after reset: M src/bin/pg_basebackup/pg_basebackup.c M src/bin/pg_basebackup/t/010_pg_basebackup.pl Removing src/bin/pg_basebackup/pg_basebackup.c.rej === using 'git apply' to apply patch ./v1-0008-pg_basebackup-Use-pg_threads.h.patch === Applied patch to 'src/bin/pg_basebackup/pg_basebackup.c' with conflicts. Applied patch to 'src/bin/pg_basebackup/t/010_pg_basebackup.pl' cleanly. U src/bin/pg_basebackup/pg_basebackup.c diff --cc src/bin/pg_basebackup/pg_basebackup.c index 8a599fc9869,c5074226931..00000000000 --- a/src/bin/pg_basebackup/pg_basebackup.c +++ b/src/bin/pg_basebackup/pg_basebackup.c @@@ -463,59 -422,21 +422,48 @@@ static boo reached_end_position(XLogRecPtr segendpos, uint32 timeline, bool segment_finished) { - if (!has_xlogendptr) - { - #ifndef WIN32 - fd_set fds; - struct timeval tv = {0}; - int r; + static bool have_xlogendptr = false; ++<<<<<<< ours + /* + * Don't have the end pointer yet - check our pipe to see if it has + * been sent yet. + */ + FD_ZERO(&fds); + FD_SET(bgpipe[0], &fds); + + r = select(bgpipe[0] + 1, &fds, NULL, NULL, &tv); + if (r == 1) + { + ssize_t nread; + char xlogend[64] = {0}; + uint32 hi, + lo; + + nread = read(bgpipe[0], xlogend, sizeof(xlogend) - 1); + if (nread < 0) + pg_fatal("could not read from ready pipe: %m"); + + if (sscanf(xlogend, "%X/%08X", &hi, &lo) != 2) + pg_fatal("could not parse write-ahead log location \"%s\"", + xlogend); + xlogendptr = ((uint64) hi) << 32 | lo; + has_xlogendptr = 1; ++======= + /* + * Wait until xlogendptr has been set by the main thread. After it has + * been set, it is safe to read it without a lock. + */ + if (!have_xlogendptr) + { + pg_mtx_lock(&xlogendptr_lock); + have_xlogendptr = xlogendptr != 0; + pg_mtx_unlock(&xlogendptr_lock); ++>>>>>>> theirs - /* - * Fall through to check if we've reached the point further - * already. - */ - } - else - { - /* - * No data received on the pipe means we don't know the end - * position yet - so just say it's not time to stop yet. - */ + /* If it's not set yet, we just go back and wait until it shows up. */ + if (!have_xlogendptr) return false; - } - #else - - /* - * On win32, has_xlogendptr is set by the main thread, so if it's not - * set here, we just go back and wait until it shows up. - */ - return false; - #endif } /*