=== Applying patches on top of PostgreSQL commit ID 9018c7d37bb464cd53567c0b553a6f49b50bec78 === /etc/rc.d/jail: WARNING: Per-jail configuration via jail_* variables is obsolete. Please consider migrating to /etc/jail.conf. Sun Apr 19 16:56:27 UTC 2026 On branch cf/6314 nothing to commit, working tree clean === using 'git am' to apply patch ./v7-0001-Move-Windows-pthread-compatibility-functions-to-s.patch === Applying: Move Windows pthread compatibility functions to src/port === using 'git am' to apply patch ./v7-0002-Don-t-use-deprecated-and-insecure-PQcancel-psql-a.patch === Applying: Don't use deprecated and insecure PQcancel psql and other tools anymore === using 'git am' to apply patch ./v7-0003-pg_dump-Don-t-use-the-deprecated-and-insecure-PQc.patch === Applying: pg_dump: Don't use the deprecated and insecure PQcancel Using index info to reconstruct a base tree... M src/bin/pg_dump/parallel.c M src/bin/pg_dump/pg_backup_archiver.c M src/bin/pg_dump/pg_backup_archiver.h Falling back to patching base and 3-way merge... Auto-merging src/bin/pg_dump/pg_backup_archiver.h Auto-merging src/bin/pg_dump/pg_backup_archiver.c Auto-merging src/bin/pg_dump/parallel.c CONFLICT (content): Merge conflict in src/bin/pg_dump/parallel.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_dump: Don't use the deprecated and insecure PQcancel 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 ./v7-0003-pg_dump-Don-t-use-the-deprecated-and-insecure-PQc.patch === patching file src/bin/pg_dump/Makefile patching file src/bin/pg_dump/meson.build patching file src/bin/pg_dump/parallel.c Hunk #6 FAILED at 528. 1 out of 11 hunks FAILED -- saving rejects to file src/bin/pg_dump/parallel.c.rej patching file src/bin/pg_dump/pg_backup_archiver.c Hunk #1 succeeded at 5210 (offset 1 line). patching file src/bin/pg_dump/pg_backup_archiver.h patching file src/bin/pg_dump/pg_backup_db.c Unstaged changes after reset: M src/bin/pg_dump/Makefile M src/bin/pg_dump/meson.build M src/bin/pg_dump/parallel.c M src/bin/pg_dump/pg_backup_archiver.c M src/bin/pg_dump/pg_backup_archiver.h M src/bin/pg_dump/pg_backup_db.c Removing src/bin/pg_dump/parallel.c.rej === using 'git apply' to apply patch ./v7-0003-pg_dump-Don-t-use-the-deprecated-and-insecure-PQc.patch === Applied patch to 'src/bin/pg_dump/Makefile' cleanly. Applied patch to 'src/bin/pg_dump/meson.build' cleanly. Applied patch to 'src/bin/pg_dump/parallel.c' with conflicts. Applied patch to 'src/bin/pg_dump/pg_backup_archiver.c' cleanly. Applied patch to 'src/bin/pg_dump/pg_backup_archiver.h' cleanly. Applied patch to 'src/bin/pg_dump/pg_backup_db.c' cleanly. U src/bin/pg_dump/parallel.c diff --cc src/bin/pg_dump/parallel.c index a7bed5ecccf,edc800d9c90..00000000000 --- a/src/bin/pg_dump/parallel.c +++ b/src/bin/pg_dump/parallel.c @@@ -552,55 -546,36 +546,47 @@@ WaitForTerminatingWorkers(ParallelStat * thread runs. */ - #ifndef WIN32 - /* - * Signal handler (Unix only) + * Cancel all active queries and print termination message. */ static void - sigTermHandler(SIGNAL_ARGS) + CancelBackends(void) { - int i; - char errbuf[1]; + pthread_mutex_lock(&signal_info_lock); ++<<<<<<< ours + /* + * Some platforms allow delivery of new signals to interrupt an active + * signal handler. That could muck up our attempt to send PQcancel, so + * disable the signals that set_cancel_handler enabled. + */ + pqsignal(SIGINT, PG_SIG_IGN); + pqsignal(SIGTERM, PG_SIG_IGN); + pqsignal(SIGQUIT, PG_SIG_IGN); ++======= + signal_info.cancel_requested = true; ++>>>>>>> theirs /* - * If we're in the leader, forward signal to all workers. (It seems best - * to do this before PQcancel; killing the leader transaction will result - * in invalid-snapshot errors from active workers, which maybe we can - * quiet by killing workers first.) Ignore any errors. + * Stop workers first to avoid invalid-snapshot errors if the leader + * cancels before workers. */ - if (signal_info.pstate != NULL) - { - for (i = 0; i < signal_info.pstate->numWorkers; i++) - { - pid_t pid = signal_info.pstate->parallelSlot[i].pid; + StopWorkers(); - if (pid != 0) - kill(pid, SIGTERM); - } - } + if (signal_info.myAH != NULL && signal_info.myAH->cancelConn != NULL) + (void) PQcancelBlocking(signal_info.myAH->cancelConn); - /* - * Send QueryCancel if we have a connection to send to. Ignore errors, - * there's not much we can do about them anyway. - */ - if (signal_info.myAH != NULL && signal_info.myAH->connCancel != NULL) - (void) PQcancel(signal_info.myAH->connCancel, errbuf, sizeof(errbuf)); + pthread_mutex_unlock(&signal_info_lock); /* - * Report we're quitting, using nothing more complicated than write(2). - * When in parallel operation, only the leader process should do this. + * Print termination message. In parallel operation, only the leader + * should print this. On Windows, workers are threads in the same process + * and the console handler only runs in the leader context, so we can + * always print it. */ + #ifndef WIN32 if (!signal_info.am_worker) + #endif { if (progname) {