public inbox for [email protected]  
help / color / mirror / Atom feed
From: Tatsuo Ishii <[email protected]>
To: [email protected]
Subject: pgpool: Fix disable_load_balance_on_write to not break query cache.
Date: Fri, 05 Jun 2026 02:55:00 +0000
Message-ID: <[email protected]> (raw)

Fix disable_load_balance_on_write to not break query cache.

The disable_load_balance_on_write accepts four options:

transaction (the default)
trans_transaction
dml_adaptive
always

It appeared that except "transaction", all other options break query
cache feature. Sometimes a query result is cached even there's a write
query in a transaction, sometimes query is not cached even when it
should be.

The query cache relies on is_writing_transaction of session context to
judge whether cache can be safely used. However,
disable_load_balance_on_write overrides it to true when it should not,
and vice versa for its own purpose. To fix this new session context
variable "really_writing_transaction" is introduced. It is almost same
as existing writing_transaction, but it faithfully tracks whether a
writing query appears in an explicit transaction. The query cache uses
it instead of writing_transaction variable.

Add test cases for disable_load_balance_on_write =
"trans_transaction", "dml_adaptive" and "always" to 006.memqcahce
regression test. Note that "transaction" is the default and already
tested in "s" mode. So it's not necessary to add a test for the case.

Author: Tatsuo Ishii <[email protected]>
Discussion:
Backpatch-through: v4.3

Branch
------
master

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

Modified Files
--------------
src/context/pool_session_context.c              | 22 ++++++++++++++++++++++
src/include/context/pool_session_context.h      | 19 ++++++++++++++++++-
src/protocol/CommandComplete.c                  |  1 +
src/protocol/pool_process_query.c               |  1 +
src/protocol/pool_proto_modules.c               | 17 +++++++++++++----
src/test/regression/tests/006.memqcache/test.sh | 19 ++++++++++++++++++-
6 files changed, 73 insertions(+), 6 deletions(-)



view thread (7+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: pgpool: Fix disable_load_balance_on_write to not break query cache.
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox