Commit 48385315 authored by Alex Badics's avatar Alex Badics Committed by Christoph Berg

pg_ctlcluster: use pg_ctl.conf during stop too

We set a timeout of 3600 in pg_ctl.conf, but it still timed out on
stop after an upgrade (possibly because writing everything down to the
disk took more than 30 seconds)
parent 2ceab701
......@@ -261,10 +261,18 @@ sub stop {
stop_check_pid_file;
my $result = 1;
my @options = ('stop', '-s', '-w', '-D', $info{'pgdata'});
push @options, @pg_ctl_opts_from_cli if @pg_ctl_opts_from_cli;
my %pg_ctl_opts_from_file = read_cluster_conf_file $version, $cluster, 'pg_ctl.conf';
push @options, split(' ', $pg_ctl_opts_from_file{'pg_ctl_options'})
if defined $pg_ctl_opts_from_file{'pg_ctl_options'} and $pg_ctl_opts_from_file{'pg_ctl_options'} ne '';
if ($force) {
if (!fork()) {
close STDOUT;
exec $pg_ctl, '-D', $info{'pgdata'}, '-s', '-w', '-m', 'fast', @pg_ctl_opts_from_cli, 'stop';
exec $pg_ctl, @options, '-m', 'fast';
} else {
wait;
$result = $? >> 8;
......@@ -273,7 +281,7 @@ sub stop {
# try harder if "fast" mode does not work
if (-f $info{'pgdata'}.'/postmaster.pid') {
print "(does not shutdown gracefully, now stopping immediately)\n";
$result = system $pg_ctl, '-D', $info{'pgdata'}, '-s', '-w', '-m', 'immediate', @pg_ctl_opts_from_cli, 'stop';
$result = system $pg_ctl, @options, '-m', 'immediate';
}
# if that still not helps, use the big hammer
......@@ -286,7 +294,7 @@ sub stop {
} else {
if (!fork()) {
close STDOUT;
exec $pg_ctl, '-D', $info{'pgdata'}, '-s', '-w', '-m', $mode, @pg_ctl_opts_from_cli, 'stop';
exec $pg_ctl, @options, '-m', $mode;
} else {
wait;
$result = $? >> 8;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment