Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 628168 - dev-db/postgresql init script is not compatible with pacemaker (with drbd) in HA cluster
Summary: dev-db/postgresql init script is not compatible with pacemaker (with drbd) in...
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-18 12:53 UTC by Marcin Mirosław
Modified: 2017-08-18 15:50 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcin Mirosław 2017-08-18 12:53:34 UTC
On two node HA cluster I'm using pacemaker to manage HA. Database files are placed on drbd block device.
On active node everything is ok, `/etc/init.d/postgresql-9.4 status` returns "started" with error code "0". It's ok.
On other node drbd resource is in slave state, so filesystem with postgres database is unmounted. On this node service status returns:

# /etc/init.d/postgresql-9.4 status
 * Checking PostgreSQL 9.4 status ...
pg_ctl: directory "/data/pgsql/9.4" does not exist               [ !! ]

with error code "4". And this error code makes problem for pacemaker, pacemaker assumes that something is wrong with service and cluster HA is in not HA state ;) This resource will not be managed by pacemaker.


Reproducible: Always



Expected Results:  
/etc/init.d/postgresql-9.4 should return code "3" if pg_ctl doesn't find database directory.
Comment 1 Aaron W. Swenson gentoo-dev 2017-08-18 15:50:49 UTC
The initscript just passes along the exit code it receives from pg_ctl.

~ # rc-service postgresql-9.6 status
 * Checking PostgreSQL 9.6 status ...
pg_ctl: directory "/var/lib/postgresql/9.6/data" does not exist   [ !! ]
~ # echo $?
4

This error code is documented upstream as the code to expect when the directory can't be found.

From https://www.postgresql.org/docs/9.4/static/app-pg-ctl.html:
> If an accessible data directory is not specified, the process returns an exit status of 4.

Basically, it's stating that not only is the server not running, there's no data for it to work with in the first place.

You'll need to fix your implementation because the initscript is doing the right thing.