diff options
-rw-r--r-- | contrib/start-scripts/freebsd | 5 | ||||
-rw-r--r-- | contrib/start-scripts/linux | 5 | ||||
-rwxr-xr-x | contrib/start-scripts/osx/PostgreSQL | 3 | ||||
-rw-r--r-- | doc/src/sgml/ref/pg_ctl-ref.sgml | 36 | ||||
-rw-r--r-- | src/bin/pg_ctl/pg_ctl.c | 15 | ||||
-rw-r--r-- | src/bin/pg_ctl/t/001_start_stop.pl | 18 | ||||
-rw-r--r-- | src/bin/pg_ctl/t/003_promote.pl | 10 | ||||
-rw-r--r-- | src/test/modules/commit_ts/t/003_standby_2.pl | 2 | ||||
-rw-r--r-- | src/test/perl/PostgresNode.pm | 12 | ||||
-rw-r--r-- | src/tools/msvc/vcregress.pl | 4 |
10 files changed, 49 insertions, 61 deletions
diff --git a/contrib/start-scripts/freebsd b/contrib/start-scripts/freebsd index 87d9b9b357a..c6ac8cd47a7 100644 --- a/contrib/start-scripts/freebsd +++ b/contrib/start-scripts/freebsd @@ -28,8 +28,7 @@ PGLOG="$PGDATA/serverlog" PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin # What to use to start up the postmaster. (If you want the script to wait -# until the server has started, you could use "pg_ctl start -w" here. -# But without -w, pg_ctl adds no value.) +# until the server has started, you could use "pg_ctl start" here.) DAEMON="$prefix/bin/postmaster" # What to use to shut down the postmaster @@ -51,7 +50,7 @@ case $1 in su -l $PGUSER -c "$PGCTL stop -D '$PGDATA' -s" ;; restart) - su -l $PGUSER -c "$PGCTL stop -D '$PGDATA' -s -w" + su -l $PGUSER -c "$PGCTL stop -D '$PGDATA' -s" su -l $PGUSER -c "$DAEMON -D '$PGDATA' &" >>$PGLOG 2>&1 ;; status) diff --git a/contrib/start-scripts/linux b/contrib/start-scripts/linux index d7499c9d1e3..44a775b0300 100644 --- a/contrib/start-scripts/linux +++ b/contrib/start-scripts/linux @@ -60,8 +60,7 @@ PGLOG="$PGDATA/serverlog" PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin # What to use to start up the postmaster. (If you want the script to wait -# until the server has started, you could use "pg_ctl start -w" here. -# But without -w, pg_ctl adds no value.) +# until the server has started, you could use "pg_ctl start" here.) DAEMON="$prefix/bin/postmaster" # What to use to shut down the postmaster @@ -102,7 +101,7 @@ case $1 in ;; restart) echo -n "Restarting PostgreSQL: " - su - $PGUSER -c "$PGCTL stop -D '$PGDATA' -s -w" + su - $PGUSER -c "$PGCTL stop -D '$PGDATA' -s" test -e "$PG_OOM_ADJUST_FILE" && echo "$PG_MASTER_OOM_SCORE_ADJ" > "$PG_OOM_ADJUST_FILE" su - $PGUSER -c "$DAEMON_ENV $DAEMON -D '$PGDATA' &" >>$PGLOG 2>&1 echo "ok" diff --git a/contrib/start-scripts/osx/PostgreSQL b/contrib/start-scripts/osx/PostgreSQL index 48c098c8f13..9735c8c57f3 100755 --- a/contrib/start-scripts/osx/PostgreSQL +++ b/contrib/start-scripts/osx/PostgreSQL @@ -65,8 +65,7 @@ ROTATESEC="604800" PATH="$prefix/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" # What to use to start up the postmaster. (If you want the script to wait -# until the server has started, you could use "pg_ctl start -w" here. -# But without -w, pg_ctl adds no value.) +# until the server has started, you could use "pg_ctl start" here.) DAEMON="$prefix/bin/postmaster" # What to use to shut down the postmaster diff --git a/doc/src/sgml/ref/pg_ctl-ref.sgml b/doc/src/sgml/ref/pg_ctl-ref.sgml index 3f168005ec3..176dfaf98a3 100644 --- a/doc/src/sgml/ref/pg_ctl-ref.sgml +++ b/doc/src/sgml/ref/pg_ctl-ref.sgml @@ -31,7 +31,7 @@ PostgreSQL documentation <cmdsynopsis> <command>pg_ctl</command> <arg choice="plain"><option>start</option></arg> - <arg choice="opt"><option>-w</option></arg> + <arg choice="opt"><option>-W</option></arg> <arg choice="opt"><option>-t</option> <replaceable>seconds</replaceable></arg> <arg choice="opt"><option>-s</option></arg> <arg choice="opt"><option>-D</option> <replaceable>datadir</replaceable></arg> @@ -60,7 +60,7 @@ PostgreSQL documentation <cmdsynopsis> <command>pg_ctl</command> <arg choice="plain"><option>restart</option></arg> - <arg choice="opt"><option>-w</option></arg> + <arg choice="opt"><option>-W</option></arg> <arg choice="opt"><option>-t</option> <replaceable>seconds</replaceable></arg> <arg choice="opt"><option>-s</option></arg> <arg choice="opt"><option>-D</option> <replaceable>datadir</replaceable></arg> @@ -91,7 +91,7 @@ PostgreSQL documentation <cmdsynopsis> <command>pg_ctl</command> <arg choice="plain"><option>promote</option></arg> - <arg choice="opt"><option>-w</option></arg> + <arg choice="opt"><option>-W</option></arg> <arg choice="opt"><option>-t</option> <replaceable>seconds</replaceable></arg> <arg choice="opt"><option>-s</option></arg> <arg choice="opt"><option>-D</option> <replaceable>datadir</replaceable></arg> @@ -117,7 +117,7 @@ PostgreSQL documentation <arg choice="plain"><option>d[emand]</option></arg> </group> </arg> - <arg choice="opt"><option>-w</option></arg> + <arg choice="opt"><option>-W</option></arg> <arg choice="opt"><option>-t</option> <replaceable>seconds</replaceable></arg> <arg choice="opt"><option>-s</option></arg> <arg choice="opt"><option>-o</option> <replaceable>options</replaceable></arg> @@ -391,17 +391,7 @@ PostgreSQL documentation Wait for an operation to complete. This is supported for the modes <literal>start</literal>, <literal>stop</literal>, <literal>restart</literal>, <literal>promote</literal>, - and <literal>register</literal>. - </para> - - <para> - Waiting is the default option for shutdowns, but not startups, - restarts, or promotions. This is mainly for historical reasons; the - waiting option is almost always preferable. If waiting is not - selected, the requested action is triggered, but there is no feedback - about its success. In that case, the server log file or an external - monitoring system would have to be used to check the progress and - success of the operation. + and <literal>register</literal>, and is the default for those modes. </para> <para> @@ -424,6 +414,18 @@ PostgreSQL documentation Do not wait for an operation to complete. This is the opposite of the option <option>-w</option>. </para> + + <para> + If waiting is disabled, the requested action is triggered, but there + is no feedback about its success. In that case, the server log file + or an external monitoring system would have to be used to check the + progress and success of the operation. + </para> + + <para> + In prior releases of PostgreSQL, this was the default except for + the <literal>stop</literal> mode. + </para> </listitem> </varlistentry> @@ -593,7 +595,7 @@ PostgreSQL documentation To start the server, waiting until the server is accepting connections: <screen> -<prompt>$</prompt> <userinput>pg_ctl -w start</userinput> +<prompt>$</prompt> <userinput>pg_ctl start</userinput> </screen> </para> @@ -637,7 +639,7 @@ PostgreSQL documentation To restart the server, waiting for it to shut down and restart: <screen> -<prompt>$</prompt> <userinput>pg_ctl -w restart</userinput> +<prompt>$</prompt> <userinput>pg_ctl restart</userinput> </screen> </para> diff --git a/src/bin/pg_ctl/pg_ctl.c b/src/bin/pg_ctl/pg_ctl.c index c161b199354..93e58919503 100644 --- a/src/bin/pg_ctl/pg_ctl.c +++ b/src/bin/pg_ctl/pg_ctl.c @@ -71,8 +71,7 @@ typedef enum #define DEFAULT_WAIT 60 -static bool do_wait = false; -static bool wait_set = false; +static bool do_wait = true; static int wait_seconds = DEFAULT_WAIT; static bool wait_seconds_arg = false; static bool silent_mode = false; @@ -1959,7 +1958,7 @@ do_help(void) printf(_(" -s, --silent only print errors, no informational messages\n")); printf(_(" -t, --timeout=SECS seconds to wait when using -w option\n")); printf(_(" -V, --version output version information, then exit\n")); - printf(_(" -w, --wait wait until operation completes\n")); + printf(_(" -w, --wait wait until operation completes (default)\n")); printf(_(" -W, --no-wait do not wait until operation completes\n")); printf(_(" -?, --help show this help, then exit\n")); printf(_("(The default is to wait for shutdown, but not for start or restart.)\n\n")); @@ -2323,11 +2322,9 @@ main(int argc, char **argv) break; case 'w': do_wait = true; - wait_set = true; break; case 'W': do_wait = false; - wait_set = true; break; case 'c': allow_core_files = true; @@ -2423,14 +2420,6 @@ main(int argc, char **argv) exit(1); } - if (!wait_set) - { - if (ctl_command == STOP_COMMAND) - do_wait = true; - else - do_wait = false; - } - if (ctl_command == RELOAD_COMMAND) { sig = SIGHUP; diff --git a/src/bin/pg_ctl/t/001_start_stop.pl b/src/bin/pg_ctl/t/001_start_stop.pl index b328f224877..8f16bf97954 100644 --- a/src/bin/pg_ctl/t/001_start_stop.pl +++ b/src/bin/pg_ctl/t/001_start_stop.pl @@ -32,24 +32,24 @@ else print CONF "listen_addresses = '127.0.0.1'\n"; } close CONF; -command_ok([ 'pg_ctl', 'start', '-D', "$tempdir/data", '-w' ], - 'pg_ctl start -w'); +command_ok([ 'pg_ctl', 'start', '-D', "$tempdir/data" ], + 'pg_ctl start'); # sleep here is because Windows builds can't check postmaster.pid exactly, # so they may mistake a pre-existing postmaster.pid for one created by the # postmaster they start. Waiting more than the 2 seconds slop time allowed # by test_postmaster_connection prevents that mistake. sleep 3 if ($windows_os); -command_fails([ 'pg_ctl', 'start', '-D', "$tempdir/data", '-w' ], - 'second pg_ctl start -w fails'); -command_ok([ 'pg_ctl', 'stop', '-D', "$tempdir/data", '-w' ], - 'pg_ctl stop -w'); -command_fails([ 'pg_ctl', 'stop', '-D', "$tempdir/data", '-w' ], +command_fails([ 'pg_ctl', 'start', '-D', "$tempdir/data" ], + 'second pg_ctl start fails'); +command_ok([ 'pg_ctl', 'stop', '-D', "$tempdir/data" ], + 'pg_ctl stop'); +command_fails([ 'pg_ctl', 'stop', '-D', "$tempdir/data" ], 'second pg_ctl stop fails'); -command_ok([ 'pg_ctl', 'restart', '-D', "$tempdir/data", '-w' ], +command_ok([ 'pg_ctl', 'restart', '-D', "$tempdir/data" ], 'pg_ctl restart with server not running'); -command_ok([ 'pg_ctl', 'restart', '-D', "$tempdir/data", '-w' ], +command_ok([ 'pg_ctl', 'restart', '-D', "$tempdir/data" ], 'pg_ctl restart with server running'); system_or_bail 'pg_ctl', 'stop', '-D', "$tempdir/data"; diff --git a/src/bin/pg_ctl/t/003_promote.pl b/src/bin/pg_ctl/t/003_promote.pl index 0b6090b6eb5..7b1df29fa3a 100644 --- a/src/bin/pg_ctl/t/003_promote.pl +++ b/src/bin/pg_ctl/t/003_promote.pl @@ -32,13 +32,13 @@ $node_standby->start; is($node_standby->safe_psql('postgres', 'SELECT pg_is_in_recovery()'), 't', 'standby is in recovery'); -command_ok([ 'pg_ctl', '-D', $node_standby->data_dir, 'promote' ], - 'pg_ctl promote of standby runs'); +command_ok([ 'pg_ctl', '-D', $node_standby->data_dir, '-W', 'promote' ], + 'pg_ctl -W promote of standby runs'); ok($node_standby->poll_query_until('postgres', 'SELECT NOT pg_is_in_recovery()'), 'promoted standby is not in recovery'); -# same again with wait option +# same again with default wait option $node_standby = get_new_node('standby2'); $node_standby->init_from_backup($node_primary, 'my_backup', has_streaming => 1); $node_standby->start; @@ -46,8 +46,8 @@ $node_standby->start; is($node_standby->safe_psql('postgres', 'SELECT pg_is_in_recovery()'), 't', 'standby is in recovery'); -command_ok([ 'pg_ctl', '-D', $node_standby->data_dir, '-w', 'promote' ], - 'pg_ctl -w promote of standby runs'); +command_ok([ 'pg_ctl', '-D', $node_standby->data_dir, 'promote' ], + 'pg_ctl promote of standby runs'); # no wait here diff --git a/src/test/modules/commit_ts/t/003_standby_2.pl b/src/test/modules/commit_ts/t/003_standby_2.pl index d37ff182c4c..043ccb14a5d 100644 --- a/src/test/modules/commit_ts/t/003_standby_2.pl +++ b/src/test/modules/commit_ts/t/003_standby_2.pl @@ -55,7 +55,7 @@ $master->restart; $master->append_conf('postgresql.conf', 'track_commit_timestamp = off'); $master->restart; -system_or_bail('pg_ctl', '-w', '-D', $standby->data_dir, 'promote'); +system_or_bail('pg_ctl', '-D', $standby->data_dir, 'promote'); $standby->poll_query_until('postgres', "SELECT pg_is_in_recovery() <> true"); $standby->safe_psql('postgres', "create table t11()"); diff --git a/src/test/perl/PostgresNode.pm b/src/test/perl/PostgresNode.pm index 868492b6152..d8be1bd3e12 100644 --- a/src/test/perl/PostgresNode.pm +++ b/src/test/perl/PostgresNode.pm @@ -632,7 +632,7 @@ port = $port =item $node->start() -Wrapper for pg_ctl -w start +Wrapper for pg_ctl start Start the node and wait until it is ready to accept connections. @@ -645,7 +645,7 @@ sub start my $pgdata = $self->data_dir; my $name = $self->name; print("### Starting node \"$name\"\n"); - my $ret = TestLib::system_log('pg_ctl', '-w', '-D', $self->data_dir, '-l', + my $ret = TestLib::system_log('pg_ctl', '-D', $self->data_dir, '-l', $self->logfile, 'start'); if ($ret != 0) @@ -702,7 +702,7 @@ sub reload =item $node->restart() -Wrapper for pg_ctl -w restart +Wrapper for pg_ctl restart =cut @@ -714,7 +714,7 @@ sub restart my $logfile = $self->logfile; my $name = $self->name; print "### Restarting node \"$name\"\n"; - TestLib::system_log('pg_ctl', '-D', $pgdata, '-w', '-l', $logfile, + TestLib::system_log('pg_ctl', '-D', $pgdata, '-l', $logfile, 'restart'); $self->_update_pid; } @@ -723,7 +723,7 @@ sub restart =item $node->promote() -Wrapper for pg_ctl promote -w +Wrapper for pg_ctl promote =cut @@ -735,7 +735,7 @@ sub promote my $logfile = $self->logfile; my $name = $self->name; print "### Promoting node \"$name\"\n"; - TestLib::system_log('pg_ctl', '-D', $pgdata, '-w', '-l', $logfile, + TestLib::system_log('pg_ctl', '-D', $pgdata, '-l', $logfile, 'promote'); } diff --git a/src/tools/msvc/vcregress.pl b/src/tools/msvc/vcregress.pl index f575e400529..f1b9819cd2e 100644 --- a/src/tools/msvc/vcregress.pl +++ b/src/tools/msvc/vcregress.pl @@ -448,7 +448,7 @@ sub upgradecheck print "\nRunning initdb on old cluster\n\n"; standard_initdb() or exit 1; print "\nStarting old cluster\n\n"; - my @args = ('pg_ctl', 'start', '-l', "$logdir/postmaster1.log", '-w'); + my @args = ('pg_ctl', 'start', '-l', "$logdir/postmaster1.log"); system(@args) == 0 or exit 1; print "\nCreating databases with names covering most ASCII bytes\n\n"; @@ -475,7 +475,7 @@ sub upgradecheck $bindir, '-B', $bindir); system(@args) == 0 or exit 1; print "\nStarting new cluster\n\n"; - @args = ('pg_ctl', '-l', "$logdir/postmaster2.log", '-w', 'start'); + @args = ('pg_ctl', '-l', "$logdir/postmaster2.log", 'start'); system(@args) == 0 or exit 1; print "\nSetting up stats on new cluster\n\n"; system(".\\analyze_new_cluster.bat") == 0 or exit 1; |