Skip to content

Ensure postgresql is started after pg-upgrade

Balasankar 'Balu' C requested to merge start-postgresql-after-pg-upgrade into master

analyze_new_cluster.sh script doesn't have set -e directive, and hence it won't fail even if postgresql is down

root@9b910bf3e554:/pkg# gitlab-ctl status postgresql
down: postgresql: 352s, normally up; run: log: (pid 11793) 2904s

root@9b910bf3e554:/pkg# sh /var/opt/gitlab/postgresql/analyze_new_cluster.sh
This script will generate minimal optimizer statistics rapidly
so your system is usable, and then gather statistics twice more
with increasing accuracy.  When it is done, your system will
have the default level of optimizer statistics.

If you have used ALTER TABLE to modify the statistics target for
any tables, you might want to remove them and restore them after
running this script because they will delay fast statistics generation.

If you would like default statistics as quickly as possible, cancel
this script and run:
    "/opt/gitlab/embedded/bin/vacuumdb" --all --analyze-only

vacuumdb: could not connect to database template1: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

Done

root@9b910bf3e554:/pkg# echo $?
0

This MR makes sure the postgresql service is started before running analyze_new_cluster.sh

Merge request reports