[pgpool-committers: 3690] pgpool: Fix packet kind does not match error in extended protocol per b

Tatsuo Ishii ishii at postgresql.org
Tue Dec 20 11:15:14 JST 2016


Fix packet kind does not match error in extended protocol per bug 231.

According to the bug231, the bug seem to bite you if all of following
conditions are met:

  - Streaming replication mode
  - Load balance node is not node 0
  - Extended protocol is used
  - SELECT is executed, the statement is closed, then a transaction
    command is executed

The sequence of how the problem bites is:

  1) SELECT executes on statement S1 on the load balance node 1
  2) Frontend send Close statement
  3) Pgool-II forward it to backend 1
  4) Frontend sends Parse, Bind, Execute of COMMIT
  5) Pgool-II forward it to backend 0 & 1
  6) Frontend sends sync message
  7) Pgool-II forward it to backend 0 & 1
  8) Backend 0 replies back Parse complete ("1"), while backend 1
     replies back close complete ("3") because of #3.
  9) Kind mismatch occurs

The solution is, in #3, let Pgpool-II wait for response from backend
1, but do not read the response message. Later on Pgpool-II's state
machine will read the response from it before the sync message is sent
in #6. With this, backend 1 will reply back "1" in #8, and the kind
mismatch error does not occur.

Also, fix not calling pool_set_doing_extended_query_message() when
receives Close message.  (I don't know why it was missed).

New regression test "067.bug231" was added.

Branch
------
V3_5_STABLE

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

Modified Files
--------------
src/context/pool_query_context.c                   |  5 ++-
src/protocol/pool_proto_modules.c                  |  5 +--
.../regression/tests/067.bug231/TestReplGap.java   | 29 +++++++++++++++
src/test/regression/tests/067.bug231/test.sh       | 41 ++++++++++++++++++++++
4 files changed, 77 insertions(+), 3 deletions(-)



More information about the pgpool-committers mailing list