[pgpool-committers: 9270] pgpool: Fix occasional 005.jdbc test failure.

Tatsuo Ishii ishii at sraoss.co.jp
Thu Apr 13 16:41:03 JST 2023


Fix occasional 005.jdbc test failure.

The direct cause of the error is:
2023-02-22 08:51:47.705: PostgreSQL JDBC Driver pid 12420: LOG:  Parse: Error or notice message from backend: : DB node id: 0 backend pid: 12488 statement: "COMMIT" message: "prepared statement "S_1" already exists"

Actually the root of the error is this:
 2023-02-22 08:51:45.242: PostgreSQL JDBC Driver pid 12420: LOG:  pool_send_and_wait: Error or notice message from backend: : DB node id: 0 backend pid: 12488 statement: "DISCARD ALL" message: "DISCARD ALL cannot be executed within a pipeline"

"DISCARD ALL" was generated by pgpool (reset_query_list) to discard
some objects including prepared statements created in the
session. Since DISCARD ALL failed, the prepared statement S_1 was not
removed. Thus the next session failed because S_1 already existed.

To fix this, new global boolean flag reset_query_error is
introduced. The flag is set inside pool_send_and_wait() when a reset
query executed by SimpleQuery() results in ERROR. If the flag is true,
backend_cleanup() discards the backend connection so that any objects,
including named statement, corresponding to the session is discarded

Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2023-February/004293.html

Branch
------
V4_4_STABLE

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

Modified Files
--------------
src/context/pool_query_context.c          |  9 ++++++++-
src/include/pool.h                        |  1 +
src/include/protocol/pool_proto_modules.h |  4 ++--
src/main/pool_globals.c                   |  3 ++-
src/protocol/child.c                      | 11 +++++++----
src/protocol/pool_process_query.c         |  8 +++++++-
src/protocol/pool_proto_modules.c         |  5 +++--
7 files changed, 30 insertions(+), 11 deletions(-)



More information about the pgpool-committers mailing list