[pgpool-committers: 3950] pgpool: Fix for 0000289: Inconsistent backend state

Muhammad Usama m.usama at gmail.com
Wed Apr 12 05:43:44 JST 2017

Fix for 0000289: Inconsistent backend state

Pgpool-II syncs the backend node states at the time of startup which works fine
for almost all cases except when the watchdog cluster becomes partitioned
(because of some network problem) and after recovering from it the Pgpool-II
nodes (that are already up and serving) joins back the cluster. At that time the
backend node status among different nodes can become In-sync among the Pgpool-II
nodes, if the backend node status on the newly joined Pgpool-II is different
from the status on existing watchdog cluster nodes.

Now with this commit, every time the Pgpool-II node joins the watchdog cluster
as a standby either at startup or after some problem recovery, it realigns its
backend node statuses with the cluster leader, by fetching the statuses from
the master/coordinator and updating the local statuses of each backend.

The patch also borrows the logic of smart restarting of Pgpool-II children
from the failover() function to minimise the chances of session disconnection
when the backend node statuses are updated from the master/coordinator Pgpool-II.

This patch is back ported from master branch and smart restart of Pgpool-II
children is not available in Pgpool-II 3.5



Modified Files
src/include/pool.h                     |   1 +
src/include/watchdog/watchdog.h        |   1 +
src/include/watchdog/wd_ipc_commands.h |  15 ++
src/include/watchdog/wd_ipc_defines.h  |  19 +-
src/include/watchdog/wd_json_data.h    |   2 +
src/main/pgpool_main.c                 | 364 +++++++++++++++++++++++++--------
src/watchdog/watchdog.c                |  90 ++++++--
src/watchdog/wd_commands.c             | 176 +++++++++++++++-
src/watchdog/wd_json_data.c            |  13 +-
9 files changed, 578 insertions(+), 103 deletions(-)

More information about the pgpool-committers mailing list