Re: pgpool: Fix disable_load_balance_on_write to not break query cache.

From: Tatsuo Ishii <ishii(at)postgresql(dot)org>
To: pgpool-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgpool: Fix disable_load_balance_on_write to not break query cache.
Date: 2026-06-05 03:00:35
Message-ID: 20260605.120035.125402116886555368.ishii@postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgpool-committers

Oops. I accidentaly left "Discussion:" tag empty.
It should have been:

https://www.postgresql.org/message-id/20260604.161440.589411300726741691.ishii%40postgresql.org

Regards,
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp

From: Tatsuo Ishii <ishii(at)postgresql(dot)org>
Subject: pgpool: Fix disable_load_balance_on_write to not break query cache.
Date: Fri, 05 Jun 2026 02:55:00 +0000
Message-ID: <E1wVKi4-0077Y4-2Q(at)gothos(dot)postgresql(dot)org>

> 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
> ------
> master
>
> Details
> -------
> https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=1333d2ae88ac180db6ed423866086b31424a455e
>
> 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(-)
>

In response to

Browse pgpool-committers by date

  From Date Subject
Next Message Tatsuo Ishii 2026-06-05 04:43:36 pgpool: Fix typo in in read_kind_from_backend() comment.
Previous Message Tatsuo Ishii 2026-06-05 02:55:00 pgpool: Fix disable_load_balance_on_write to not break query cache.