So far to odd, but we have to remember that:

root@f:~# systemctl cat postgresql
# /lib/systemd/system/postgresql.service
# systemd service for managing all PostgreSQL clusters on the system. This
# service is actually a systemd target, but we are using a service since
# targets cannot be reloaded.
...

Hence the "actual" Database(s) will have other services.
Usually created by the generator in 
/lib/systemd/system-generators/postgresql-generator
So on a default installation there will also be the actual service which "owns" 
the processes.

root@f:~# systemctl status postgresql@12-main.service
● postgresql@12-main.service - PostgreSQL Cluster 12-main
     Loaded: loaded (/lib/systemd/system/postgresql@.service; enabled-runtime; 
vendor preset: enabled)
     Active: active (running) since Fri 2020-02-07 09:37:47 UTC; 1min 24s ago
    Process: 31971 ExecStart=/usr/bin/pg_ctlcluster --skip-systemctl-redirect 
12-main start (code=exited, status=0/SUCCESS)
   Main PID: 31976 (postgres)
      Tasks: 7 (limit: 4915)
     Memory: 18.7M
     CGroup: /system.slice/system-postgresql.slice/postgresql@12-main.service
             ├─31976 /usr/lib/postgresql/12/bin/postgres -D 
/var/lib/postgresql/12/main -c 
config_file=/etc/postgresql/12/main/postgresql.conf
             ├─31978 postgres: 12/main: checkpointer
             ├─31979 postgres: 12/main: background writer
             ├─31980 postgres: 12/main: walwriter
             ├─31981 postgres: 12/main: autovacuum launcher
             ├─31982 postgres: 12/main: stats collector
             └─31983 postgres: 12/main: logical replication launcher

Feb 07 09:37:44 f systemd[1]: Starting PostgreSQL Cluster 12-main...
Feb 07 09:37:47 f systemd[1]: Started PostgreSQL Cluster 12-main.

Shutting down that should be synchronous IMHO.
And indeed:
root@f:~# systemctl start postgresql; echo STARTED; ps auxw | grep ^postgre; 
systemctl stop postgresql@12-main.service; echo STOPPED; ps auxw | grep 
^postgre;STARTED
postgres 31976  0.0  0.0 216444 24980 ?        Ss   09:37   0:00 
/usr/lib/postgresql/12/bin/postgres -D /var/lib/postgresql/12/main -c 
config_file=/etc/postgresql/12/main/postgresql.conf
postgres 31978  0.0  0.0 216444  4096 ?        Ss   09:37   0:00 postgres: 
12/main: checkpointer   
postgres 31979  0.0  0.0 216444  5556 ?        Ss   09:37   0:00 postgres: 
12/main: background writer   
postgres 31980  0.0  0.0 216444  9780 ?        Ss   09:37   0:00 postgres: 
12/main: walwriter   
postgres 31981  0.0  0.0 216848  7572 ?        Ss   09:37   0:00 postgres: 
12/main: autovacuum launcher   
postgres 31982  0.0  0.0  70824  4616 ?        Ss   09:37   0:00 postgres: 
12/main: stats collector   
postgres 31983  0.0  0.0 216832  6088 ?        Ss   09:37   0:00 postgres: 
12/main: logical replication launcher   
STOPPED

So individual real postgresql service instances actually do stop synchronously 
as expected.
The problem comes down to the Fake-Target in 
/lib/systemd/system/postgresql.service to trigger, but not wait for these to 
fully shut down.

-- 
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