upgrade-postgresql: Ensure the new PostgreSQL is running.

If a previous attempt at an upgrade failed for some reason, the new
PostgreSQL may be installed, and the conversion will succeed, but the
new PostgreSQL daemon will not be running (Puppet does not force it to
start).  This causes the upgrade to fail when analyzing statistics,
since the daemon isn't running.

Explicitly start the new PostgreSQL; this does nothing in most cases,
but will provider better resiliency when recovering from previous
partial upgrades.
This commit is contained in:
Alex Vandiver 2023-01-03 10:55:50 -05:00 committed by Tim Abbott
parent f1acc6433c
commit 62562eedf7
1 changed files with 3 additions and 0 deletions

View File

@ -53,6 +53,9 @@ SCRIPTS_PATH=$(grep -o "/var/log/postgresql/pg_upgradecluster-$UPGRADE_FROM-$UPG
# our configuration immediately
crudini --set /etc/zulip/zulip.conf postgresql version "$UPGRADE_TO"
# Make sure the new PostgreSQL is running
pg_ctlcluster "$UPGRADE_TO" main start
# Update the statistics
su postgres -c "/usr/lib/postgresql/$UPGRADE_TO/bin/vacuumdb --all --analyze-only --jobs 10"