[pgpool-committers: 2940] pgpool: Fix bug#156: problem with reloading.

Tatsuo Ishii 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.

Branch
------
V3_4_STABLE

Details
-------
http://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=f7c9265e7193ea4221ac6663b3331dac03a619b9

Modified Files
--------------
src/config/pool_config.c     |  9 ++++++---
src/config/pool_config.l     |  9 ++++++---
src/include/pcp/libpcp_ext.h | 12 +++++++++---
3 files changed, 21 insertions(+), 9 deletions(-)



More information about the pgpool-committers mailing list