Currently ordering is only done by the per Cluster services listing
  Before=postgresql.service
Further the generator adds symlinks in 
/run/systemd/generator/postgresql.service.wants/.
  
That makes it work on startup in terms of ordering.

There is: /usr/share/doc/postgresql-common/README.systemd
It explains that furthermore the parent service will only 
starts/stops/restarts/reload individual services that are configured as "auto" 
in
/etc/postgresql/*/*/start.conf.

That means one can't rely on postgresql.service to "shut down
everything" anyway.

I guess the answer is that:
- postgresql.service is meant as a overarching helper and not meant to 
sync-shutdown
- if you need synchronous behavior pleas issue a stop to the individual cluster 
like
  $ systemctl stop postgresql@12-main.service
- that is actually beneficial, most tasks do this for backup or similar.
  This way you can stop/process/start the Clusters individually (if you have 
many)
- if you need a "one command stops all" you can use
  $ systemctl stop postgresql "postgresql@*"

I'm linking Debian bug https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=759725 
where this is being discussed for quite some time.
Due to the existing workarounds and the low amount of affected uses (the first 
time after year) this is prio medium/low - a classic "yes it would be nice but 
I'm not sure one will get to work on it" case.

To be clear if anyone has a great suggestion how to achieve the shutdown
to be synchronous as well I guess we will rather quickly add it to
Debian and Ubuntu - but right now we are missing that idea.

** Bug watch added: Debian Bug tracker #759725
   https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=759725

** Changed in: postgresql-common (Ubuntu)
       Status: Confirmed => Triaged

** Changed in: postgresql-common (Ubuntu)
   Importance: Undecided => Low

** Also affects: postgresql-common (Debian) via
   https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=759725
   Importance: Unknown
       Status: Unknown

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1862138

Title:
  "systemctl stop postgresql" fails to stop postgresql

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/postgresql-common/+bug/1862138/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to