[pgpool-committers: 2941] pgpool: Fix bug#156: problem with reloading.
ishii at postgresql.org
Sun Jan 17 22:21:06 JST 2016
Fix bug#156: problem with reloading.
While reloading pgpool.conf, the number of DB nodes is tentatively set
to 0, then counted up until reaching to the actual number of backends
by the pgpool main process. Unfortunately the variable is on the
shared memory and it confuses pgpool child process if they are using
the variable. To solve the problem, a local variable is used to count
up the number of backend. After finishing the counting, the value of
the local variable is assigned to the variable on the shared memory.
I will explain why we don't need interlocking:
1) If the number of backend has not changed before/after the loop,
it's obviously fine.
2) If the number of backend has increased after the loop, the new
backend is recognized as "CON_UNUSED" because all the status for
each backend is set to "CON_UNUSED" beforehand.
3) If the number of backend has decreased after the loop, failover
should have happened and child process should have restarted.
However, we should be careful so that the assignment of the variable
should happen in an atomic manner. For this purpose I change the data
type of the variable from int to sig_atomic_t.
pcp/libpcp_ext.h | 12 +-
pool_config.c | 1446 +++++++++++++++++++++++++++++++-----------------------
pool_config.l | 9 +-
3 files changed, 836 insertions(+), 631 deletions(-)
More information about the pgpool-committers