Hi, I made this patch in our internal fork, but I'm not really proficient in perl, to be honest.
Regards, Alex Badics
From 758cbbe6f9ad458090f3b7c6bb5d2ca47786f4c8 Mon Sep 17 00:00:00 2001 From: Alex Badics <[email protected]> Date: Mon, 12 Jun 2017 14:44:43 +0200 Subject: [PATCH] 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) --- pg_ctlcluster | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/pg_ctlcluster b/pg_ctlcluster index be12b01..9fd9ef9 100755 --- a/pg_ctlcluster +++ b/pg_ctlcluster @@ -254,10 +254,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; @@ -266,7 +274,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 @@ -279,7 +287,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; -- 2.13.0
_______________________________________________ Pkg-postgresql-public mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-postgresql-public
