mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
upgrade-postgresql: Explicitly ask to not start the new cluster.
Recent versions of postgresql-common's `pg_upgradecluster`, starting
with version 254, (i.e. on Ubuntu 24.04, but not 22.04) will not just
_suggest_ running the analyze, but will do so automatically. While
somewhat helpful, it always does so with `--analyze-in-stages`, which
as noted in f77bbd3323
, is actually the incorrect choice for us.
Passing `--no-start` ensures that `pg_upgradecluster` consistently
does not do any analyzing, allowing us to start the cluster manually
and then perform the analyze correctly ourselves.
This commit is contained in:
committed by
Tim Abbott
parent
e13f82f048
commit
3ab6be650b
@@ -88,7 +88,7 @@ fi
|
||||
|
||||
# Capture the output so we know where the path to the post-upgrade scripts is
|
||||
UPGRADE_LOG=$(mktemp "/var/log/zulip/upgrade-postgresql-$UPGRADE_FROM-$UPGRADE_TO.XXXXXXXXX.log")
|
||||
pg_upgradecluster -v "$UPGRADE_TO" "$UPGRADE_FROM" main --method=upgrade --link | tee "$UPGRADE_LOG"
|
||||
pg_upgradecluster -v "$UPGRADE_TO" "$UPGRADE_FROM" main --method=upgrade --link --no-start | tee "$UPGRADE_LOG"
|
||||
SCRIPTS_PATH=$(grep -o "/var/log/postgresql/pg_upgradecluster-$UPGRADE_FROM-$UPGRADE_TO-main.*" "$UPGRADE_LOG" || true)
|
||||
|
||||
# If the upgrade completed successfully, lock in the new version in
|
||||
@@ -96,14 +96,7 @@ SCRIPTS_PATH=$(grep -o "/var/log/postgresql/pg_upgradecluster-$UPGRADE_FROM-$UPG
|
||||
crudini --set /etc/zulip/zulip.conf postgresql version "$UPGRADE_TO"
|
||||
|
||||
# Make sure the new PostgreSQL is running
|
||||
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
|
||||
pg_ctlcluster "$UPGRADE_TO" main start
|
||||
|
||||
# Update the statistics
|
||||
su postgres -c "/usr/lib/postgresql/$UPGRADE_TO/bin/vacuumdb --all --analyze-only --jobs 10"
|
||||
|
Reference in New Issue
Block a user