[pgpool-committers: 9349] pgpool: Fix prefer_lower_delay_standby bug.

Tatsuo Ishii ishii at sraoss.co.jp
Sun Apr 30 16:07:40 JST 2023


Fix prefer_lower_delay_standby bug.

When client connects to pgpool, one of standbys are chosen as the load
balancing node.  If standby delay exceeds delay_threshold while the
session continues, prefer_lower_delay_standby will choose the least
delay standby node as the new load balancing node and set the target
backend to the node. Unfortunately the decision was made *before* the
checking that SELECT query includes writing function etc., pgpool
happily sends SELECT which cannot be executed on standby.  To fix
this, prefer_lower_delay_standby treatment is moved after the writing
function etc. check.

033.prefer_lower_standby_delay regression test is modified to include
the case above. Also I have done some refactoring:

- Remove unnecessary while loop for each clustering mode because the
  test is only useful for streaming replication mode.

- Add checking wal_replay_pause is actually executed.

Bug reported by: https://www.pgpool.net/mantisbt/view.php?id=798
along with suggested fix.

Branch
------
V4_4_STABLE

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

Modified Files
--------------
src/context/pool_query_context.c                   |  69 +++++----
.../tests/033.prefer_lower_standby_delay/test.sh   | 170 ++++++++++++++-------
2 files changed, 150 insertions(+), 89 deletions(-)



More information about the pgpool-committers mailing list