| From: | Tatsuo Ishii <ishii(at)postgresql(dot)org> |
|---|---|
| To: | pgpool-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgpool: Fix disable_load_balance_on_write to not break query cache. |
| Date: | 2026-06-05 02:54:49 |
| Message-ID: | E1wVKht-0077UO-1v@gothos.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgpool-committers |
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 <ishii(at)postgresql(dot)org>
Discussion:
Backpatch-through: v4.3
Branch
------
V4_6_STABLE
Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=af256cadbebc228e6309e4a76f517ebbb0a6a410
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(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tatsuo Ishii | 2026-06-05 02:54:55 | pgpool: Fix disable_load_balance_on_write to not break query cache. |
| Previous Message | Tatsuo Ishii | 2026-06-05 02:54:43 | pgpool: Fix disable_load_balance_on_write to not break query cache. |