public inbox for [email protected]  
help / color / mirror / Atom feed
pgpool: Fix disable_load_balance_on_write to not break query cache.
7+ messages / 1 participants
[nested] [flat]

* pgpool: Fix disable_load_balance_on_write to not break query cache.
@ 2026-06-05 02:54  Tatsuo Ishii <[email protected]>
  0 siblings, 0 replies; 7+ messages in thread

From: Tatsuo Ishii @ 2026-06-05 02:54 UTC (permalink / raw)
  To: [email protected]

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
------
V4_3_STABLE

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

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(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgpool: Fix disable_load_balance_on_write to not break query cache.
@ 2026-06-05 02:54  Tatsuo Ishii <[email protected]>
  0 siblings, 0 replies; 7+ messages in thread

From: Tatsuo Ishii @ 2026-06-05 02:54 UTC (permalink / raw)
  To: [email protected]

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
------
V4_4_STABLE

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

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(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgpool: Fix disable_load_balance_on_write to not break query cache.
@ 2026-06-05 02:54  Tatsuo Ishii <[email protected]>
  0 siblings, 0 replies; 7+ messages in thread

From: Tatsuo Ishii @ 2026-06-05 02:54 UTC (permalink / raw)
  To: [email protected]

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
------
V4_5_STABLE

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

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(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgpool: Fix disable_load_balance_on_write to not break query cache.
@ 2026-06-05 02:54  Tatsuo Ishii <[email protected]>
  0 siblings, 0 replies; 7+ messages in thread

From: Tatsuo Ishii @ 2026-06-05 02:54 UTC (permalink / raw)
  To: [email protected]

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
------
V4_6_STABLE

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

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(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgpool: Fix disable_load_balance_on_write to not break query cache.
@ 2026-06-05 02:54  Tatsuo Ishii <[email protected]>
  0 siblings, 0 replies; 7+ messages in thread

From: Tatsuo Ishii @ 2026-06-05 02:54 UTC (permalink / raw)
  To: [email protected]

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
------
V4_7_STABLE

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

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(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgpool: Fix disable_load_balance_on_write to not break query cache.
@ 2026-06-05 02:55  Tatsuo Ishii <[email protected]>
  0 siblings, 1 reply; 7+ messages in thread

From: Tatsuo Ishii @ 2026-06-05 02:55 UTC (permalink / raw)
  To: [email protected]

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(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: pgpool: Fix disable_load_balance_on_write to not break query cache.
@ 2026-06-05 03:00  Tatsuo Ishii <[email protected]>
  parent: Tatsuo Ishii <[email protected]>
  0 siblings, 0 replies; 7+ messages in thread

From: Tatsuo Ishii @ 2026-06-05 03:00 UTC (permalink / raw)
  To: [email protected]

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 <[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]>

> 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(-)
> 






^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2026-06-05 03:00 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-06-05 02:54 pgpool: Fix disable_load_balance_on_write to not break query cache. Tatsuo Ishii <[email protected]>
2026-06-05 02:54 pgpool: Fix disable_load_balance_on_write to not break query cache. Tatsuo Ishii <[email protected]>
2026-06-05 02:54 pgpool: Fix disable_load_balance_on_write to not break query cache. Tatsuo Ishii <[email protected]>
2026-06-05 02:54 pgpool: Fix disable_load_balance_on_write to not break query cache. Tatsuo Ishii <[email protected]>
2026-06-05 02:54 pgpool: Fix disable_load_balance_on_write to not break query cache. Tatsuo Ishii <[email protected]>
2026-06-05 02:55 pgpool: Fix disable_load_balance_on_write to not break query cache. Tatsuo Ishii <[email protected]>
2026-06-05 03:00 ` Tatsuo Ishii <[email protected]>

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