launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #25297
[Merge] ~cjwatson/launchpad:simplify-db-setup into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:simplify-db-setup into launchpad:master.
Commit message:
Remove redundant stop from launchpad-database-setup
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/390830
"pg_dropcluster $pgversion main --stop-server" already stops the cluster if it's running, so there's no need to stop it separately via the init script.
I've occasionally seen output like this:
Creating Launchpad database for buildbot
Using postgres 10
Stopping postgresql (via systemctl): postgresql.service.
Purging postgresql data...
Cluster is not running.
Error: could not stop server, aborting
I suspect this is due to some kind of subtle race related to the double stop, which led me to work on this.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:simplify-db-setup into launchpad:master.
diff --git a/utilities/launchpad-database-setup b/utilities/launchpad-database-setup
index 46a36ce..83b79b4 100755
--- a/utilities/launchpad-database-setup
+++ b/utilities/launchpad-database-setup
@@ -43,13 +43,6 @@ if ! sudo grep -q "port.*5432" /etc/postgresql/$pgversion/main/postgresql.conf;
echo "ensure postgres is running on port 5432."
fi;
-if [ -e /etc/init.d/postgresql-$pgversion ]; then
- sudo /etc/init.d/postgresql-$pgversion stop
-else
- # This is Maverick.
- sudo /etc/init.d/postgresql stop $pgversion
-fi
-
echo Purging postgresql data...
sudo pg_dropcluster $pgversion main --stop-server
echo Re-creating postgresql database...