aboutsummaryrefslogtreecommitdiff
path: root/src/bin/pg_upgrade/parallel.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2018-01-08 22:43:51 -0500
committerBruce Momjian <bruce@momjian.us>2018-01-08 22:43:51 -0500
commit1776c817c7ef452fb47d915d1b550cd73a318944 (patch)
tree4e53b59260e65d63f3b935f63299912e7a576994 /src/bin/pg_upgrade/parallel.c
parent83fe2708d66889ed9ef6bdb922d27bba4b0d4f81 (diff)
downloadpostgresql-1776c817c7ef452fb47d915d1b550cd73a318944.tar.gz
postgresql-1776c817c7ef452fb47d915d1b550cd73a318944.zip
pg_upgrade: prevent check on live cluster from generating error
Previously an inaccurate but harmless error was generated when running --check on a live server before reporting the servers as compatible. The fix is to split error reporting and exit control in the exec_prog() API. Reported-by: Daniel Westermann Backpatch-through: 10
Diffstat (limited to 'src/bin/pg_upgrade/parallel.c')
-rw-r--r--src/bin/pg_upgrade/parallel.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/bin/pg_upgrade/parallel.c b/src/bin/pg_upgrade/parallel.c
index 7c85a13a992..45540d5ce06 100644
--- a/src/bin/pg_upgrade/parallel.c
+++ b/src/bin/pg_upgrade/parallel.c
@@ -78,8 +78,8 @@ parallel_exec_prog(const char *log_file, const char *opt_log_file,
va_end(args);
if (user_opts.jobs <= 1)
- /* throw_error must be true to allow jobs */
- exec_prog(log_file, opt_log_file, true, "%s", cmd);
+ /* exit_on_error must be true to allow jobs */
+ exec_prog(log_file, opt_log_file, true, true, "%s", cmd);
else
{
/* parallel */
@@ -122,7 +122,7 @@ parallel_exec_prog(const char *log_file, const char *opt_log_file,
child = fork();
if (child == 0)
/* use _exit to skip atexit() functions */
- _exit(!exec_prog(log_file, opt_log_file, true, "%s", cmd));
+ _exit(!exec_prog(log_file, opt_log_file, true, true, "%s", cmd));
else if (child < 0)
/* fork failed */
pg_fatal("could not create worker process: %s\n", strerror(errno));
@@ -160,7 +160,7 @@ win32_exec_prog(exec_thread_arg *args)
{
int ret;
- ret = !exec_prog(args->log_file, args->opt_log_file, true, "%s", args->cmd);
+ ret = !exec_prog(args->log_file, args->opt_log_file, true, true, "%s", args->cmd);
/* terminates thread */
return ret;
@@ -187,7 +187,6 @@ parallel_transfer_all_new_dbs(DbInfoArr *old_db_arr, DbInfoArr *new_db_arr,
#endif
if (user_opts.jobs <= 1)
- /* throw_error must be true to allow jobs */
transfer_all_new_dbs(old_db_arr, new_db_arr, old_pgdata, new_pgdata, NULL);
else
{