[pgpool-committers: 4742] pgpool: Fix pgpool hung when query cache enabled in extended query mode

Tatsuo Ishii ishii at postgresql.org
Thu May 31 11:59:38 JST 2018


Fix pgpool hung when query cache enabled in extended query mode.

If replication delay is too much, load balancing is
disabled. Unfortunately query cache module tried to access the backend
even if the target node was already changed to primary even if load
balancing was disabled. To fix this, the target backend is identified
by using pending message data which reflects the fact that load
balancing is disabled.

Bug reported in [pgpool-general-jp: 1534].

To reproduce the bug, following steps are required.

1) create a 2 node streaming replication setting (just running
   pgpool_setup will do this),

2) set backend weight 0 to 0 to force the load balance node to node 1.

3) break recovery.conf on node 1 (for example modify conninfo)

4) start the whole cluster.

5) run massive DDL. pgbench -i is convenient for this.

6) make sure that replication delay is too much by using "show
   pool_nodes".

7) run following data using pgproto. (you need to adjust lines
including "#" so that # starts beginning of the line)

 # Test for disable_load_balance_on_write feature.
 #

 # Force load balance node to 1.
 ##backend_weight0 = 0
 ##backend_weight1 = 1

 # Start a transaction
'P'     ""      "BEGIN" 0
'B'     ""      ""      0       0       0
'E'     ""      0

 # Issue SELECT.
'P'     ""      "SELECT 1"
'B'     ""      ""      0       0       0
'E'     ""      0

 # Issue COMMIT
'P'     ""      "COMMIT"        0
'B'     ""      ""      0       0       0
'E'     ""      0
'S'
'Y'

 # Issue same SELECT.
'P'     ""      "SELECT 1"
'B'     ""      ""      0       0       0
'E'     ""      0
'S'
'Y'

'X'

8) next "SELECT 1" will be hung.

Branch
------
V3_5_STABLE

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

Modified Files
--------------
src/context/pool_session_context.c         | 19 +++++++++++++++++++
src/include/context/pool_session_context.h |  5 +++--
src/query_cache/pool_memqcache.c           | 11 ++++++++++-
3 files changed, 32 insertions(+), 3 deletions(-)



More information about the pgpool-committers mailing list