mirror of https://github.com/zulip/zulip.git
upgrade-postgresql: Only try to start new cluster if it is stopped.
pg_upgradecluster will start the cluster if the old cluster was started before it ran, or if there are post-upgrade scripts to run. Because neither of those are fully under our control, only attempt to start the new cluster if it isn't already.
This commit is contained in:
parent
40e5a12e3c
commit
7e637786b3
|
@ -59,7 +59,14 @@ SCRIPTS_PATH=$(grep -o "/var/log/postgresql/pg_upgradecluster-$UPGRADE_FROM-$UPG
|
||||||
crudini --set /etc/zulip/zulip.conf postgresql version "$UPGRADE_TO"
|
crudini --set /etc/zulip/zulip.conf postgresql version "$UPGRADE_TO"
|
||||||
|
|
||||||
# Make sure the new PostgreSQL is running
|
# Make sure the new PostgreSQL is running
|
||||||
pg_ctlcluster "$UPGRADE_TO" main start
|
start_main_cluster="$(
|
||||||
|
pg_lsclusters --json \
|
||||||
|
| jq --arg pg_version "$UPGRADE_TO" -r \
|
||||||
|
'.[] | select((.version|tostring == $ARGS.named.pg_version) and (.cluster == "main") and (.running != 1)) | .cluster'
|
||||||
|
)"
|
||||||
|
if [ -n "$start_main_cluster" ]; then
|
||||||
|
pg_ctlcluster "$UPGRADE_TO" main start
|
||||||
|
fi
|
||||||
|
|
||||||
# Update the statistics
|
# Update the statistics
|
||||||
su postgres -c "/usr/lib/postgresql/$UPGRADE_TO/bin/vacuumdb --all --analyze-only --jobs 10"
|
su postgres -c "/usr/lib/postgresql/$UPGRADE_TO/bin/vacuumdb --all --analyze-only --jobs 10"
|
||||||
|
|
Loading…
Reference in New Issue