[pgpool-committers: 2381] pgpool: Fix for [pgpool-general: 3358] [PATCH] pgpool2 parent process d

Muhammad Usama m.usama at gmail.com
Mon Dec 29 21:38:10 JST 2014

Fix for [pgpool-general: 3358] [PATCH] pgpool2 parent process doesn't finish if
init_system_db_connection fails

pgpool is little confused on the behavior in the situations of child process
start-up failures. So after discussion with Tatsuo Ishii it was decided that in
such cases of start-up failures, the best bid would be to shutdown pgpool main
process and user must fix the problem before restarting the pgpool-II.

The patch achieved the above mentioned behaviour by looking at the exit code of
terminating child process which is automatically set to POOL_EXIT_FATAL by
ereport() API when the ERROR occurred during the process start-up. and the
reaper() does the rest whose function logic is as follow

For the case of child process terminating due to a signal, The reaper() function
always forks a new respective type of child process. But for the case when child
got terminated by exit() system call than the it checks the exit code and if the
child was exited with POOL_EXIT_FATAL than we do not restarts the terminating
child and shutdowns the pgpool-II. This allow the child process to inform parent
process of fatal failures which needs to be rectified by user for smooth running
of system. Also the child exits with success status POOL_EXIT_SUCCESS does not
gets restarted.

This commit also tries a little code cleanup around reaper() function in pgpool_main.c.



Modified Files
src/include/utils/elog.h      |    3 +
src/include/watchdog/wd_ext.h |    3 +-
src/main/pgpool_main.c        |  183 +++++++++++++++++++++++++++--------------
src/pcp_con/pcp_child.c       |    4 +-
src/utils/error/elog.c        |    5 +-
src/watchdog/watchdog.c       |   95 ++++++++++-----------
6 files changed, 175 insertions(+), 118 deletions(-)

More information about the pgpool-committers mailing list