[pgpool-committers: 4096] pgpool: Fixing: [pgpool-hackers: 2390] Problems with the relative paths

Muhammad Usama m.usama at gmail.com
Wed Jun 21 22:37:26 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.



Modified Files
src/include/utils/pool_path.h              |   2 +
src/main/main.c                            | 107 +++++++++++++++++++++++++----
src/main/pgpool_main.c                     |   6 +-
src/pcp_con/pcp_worker.c                   |   2 +-
src/redhat/pgpool.conf.sample.patch        |   6 ++
src/sample/pgpool.conf.sample              |   3 +
src/sample/pgpool.conf.sample-master-slave |   3 +
src/sample/pgpool.conf.sample-replication  |   3 +
src/sample/pgpool.conf.sample-stream       |   3 +
src/utils/pool_path.c                      |  87 ++++++++++++++++++++++-
10 files changed, 204 insertions(+), 18 deletions(-)

More information about the pgpool-committers mailing list