[pgpool-committers: 4291] pgpool: Fix bug mistakenly overriding global backend status right after

Tatsuo Ishii ishii at postgresql.org
Fri Sep 22 12:14:53 JST 2017

Fix bug mistakenly overriding global backend status right after failover.

In [pgpool-general: 5728] it is reported that even if failover
disconnects a backend, the status is changed from "down" to "up" in
certain timing. After debugging I found that the backend status in
pgpool_status was changed to down, then changed again by the first
connection from a client after the failover. This happened in
new_connection(), which in charge of creating a new connection to
backend. It checks the local cached status of the backend and if it's
up, then it tries to connect to the backend. In the particular case,
the failover is triggered by failover_if_affected_tuples_mismatch, so
actually the backend is alive and new_connection() succeeds in
establishing connection to the disconnected backend. Then it override
the global status and pgpool_status file.

Fix is, check if the local backend status is obsoleted. If the global
status does not agree the local status, skip the effort to establish
the connection.

In this report the user uses native replication mode, but I think
similar situation can happen in other mode.



Modified Files
src/protocol/pool_connection_pool.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)

More information about the pgpool-committers mailing list