Skip to content

Commit 436a2c2

Browse files
committed
Set the 'pg_ctl' timeout
This commit sets the 'pg_ctl' timeout to a very large value (1 year in seconds) to ensure there are no timeouts when starting or stopping Postgres. Issue [sc-15140]
1 parent c72c6a0 commit 436a2c2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

internal/pgbackrest/config.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,9 @@ func RestoreCommand(pgdata string, args ...string) []string {
197197
// - https://www.postgresql.org/docs/current/hot-standby.html
198198
// - https://www.postgresql.org/docs/current/app-pgcontroldata.html
199199

200+
// The 'pg_ctl' timeout is set to a very large value (1 year) to ensure there
201+
// are no timeouts when starting or stopping Postgres.
202+
200203
const restoreScript = `declare -r pgdata="$1" opts="$2"
201204
install --directory --mode=0700 "${pgdata}"
202205
eval "pgbackrest restore ${opts}"
@@ -226,7 +229,7 @@ read -r max_wals <<< "${control##*max_wal_senders setting:}"
226229
echo >> /tmp/postgres.restore.conf "max_wal_senders = '${max_wals}'"
227230
fi
228231
229-
pg_ctl start --silent --wait --options='--config-file=/tmp/postgres.restore.conf'
232+
pg_ctl start --silent --timeout=31536000 --wait --options='--config-file=/tmp/postgres.restore.conf'
230233
fi
231234
232235
recovery=$(psql -Atc "SELECT CASE
@@ -236,7 +239,7 @@ recovery=$(psql -Atc "SELECT CASE
236239
END recovery" && sleep 1) || true
237240
done
238241
239-
pg_ctl stop --silent --wait
242+
pg_ctl stop --silent --wait --timeout=31536000
240243
mv "${pgdata}" "${pgdata}_bootstrap"`
241244

242245
return append([]string{"bash", "-ceu", "--", restoreScript, "-", pgdata}, args...)

0 commit comments

Comments
 (0)