[pgpool-committers: 4100] pgpool: Fixing: [pgpool-hackers: 2390] Problems with the relative paths
m.usama at gmail.com
Sat Jun 24 07:49:08 JST 2017
Fixing: [pgpool-hackers: 2390] Problems with the relative paths in daemon mode
Pgpool-II does all the path related calculations based on CWD
(current working directory) which only works as expected and intended
until the CWD does not change.
But in daemon mode the first thing Pgpool-II do after becoming the daemon
process is, it changes it's CWD to system root ("/") and after that all the
relative paths becomes invalid.
This means in daemon mode if the pgpool.conf file is specified as an argument
using the relative path, Pgpool-II will not be able to find the pool_passwd
or other required file whose location depends on the location of pgpool.conf
file, and will eventually fail to start, or even worst may read/write
some wrong file.
The solution to this is to convert the relative path of the pgpool.conf and
all file paths provided in the argument list to the Pgpool-II to the absolute
paths at the startup and later use those absolute paths for all path related
Apart from using the absolute paths for pgpool.conf, pcp.conf and pool_hba.conf
files, The commit also modifies the behaviour of pid_file_name configuration
parameter, when the relative path is used for this config in pgpool.conf,
that relative path is considered with relative to the pgpool.conf path,
instead of the current working directory.
main.c | 167 +++++++++++++++++++++++++++++++++++-----
pgpool.conf.sample | 3 +
pgpool.conf.sample-master-slave | 3 +
pgpool.conf.sample-replication | 3 +
pgpool.conf.sample-stream | 3 +
pool_path.c | 88 ++++++++++++++++++++-
pool_path.h | 4 +
7 files changed, 250 insertions(+), 21 deletions(-)
More information about the pgpool-committers