Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wVKnh-001t5b-2H for pgpool-committers@arkaria.postgresql.org; Fri, 05 Jun 2026 03:00:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wVKng-009hk0-2A for pgpool-committers@arkaria.postgresql.org; Fri, 05 Jun 2026 03:00:48 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wVKng-009hjt-1b for pgpool-committers@lists.postgresql.org; Fri, 05 Jun 2026 03:00:48 +0000 Received: from meldrar.postgresql.org ([2a02:c0:301:0:ffff::31]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wVKnd-00000001Lbl-2MB7 for pgpool-committers@lists.postgresql.org; Fri, 05 Jun 2026 03:00:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=postgresql.org; s=20171124; h=Content-Transfer-Encoding:Content-Type: Mime-Version:References:In-Reply-To:From:Subject:To:Message-Id:Date:Sender: Reply-To:Cc:Content-ID:Content-Description; bh=my6p3AwETh5pKC+5z8wChBOY2HyGWRm85dqDIwsLTiE=; b=xi+SiQTOibiWUtPau2DgLF2m4s ZIec0vQ0XbeMRlFgO/5xdBnv/YfeS029pfHM21tcUSs+Tm3x+ZjRjgqKv8kDjHaXIG0drNrwZoD6s UKuIo3ADGTdSQQQVVxLvmO0/WA4JKg98zQDI0xDPlmtKDhgTvI/WqbWeF2361l6zLR0IjGVN8fyBf cqyJ1tKo95YcPzxDWPTr+NnlgGNLLHNuTcwx5r9qmZu1/67KQKHrQ73nCUXWWMovdbLzbabj3wvcA 9OKJsA4d4/GPs8lZHna1N2rWXfAwA7s6f8+mAVn/BrhT2tXZsTtRO6TfhPwN1FZ53zd0ZS70IbgBG vcNzlj3Q==; Received: from [2409:11:4120:300:f024:95ae:14e4:964] (helo=localhost) by meldrar.postgresql.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wVKnb-003Hfv-0q for pgpool-committers@lists.postgresql.org; Fri, 05 Jun 2026 03:00:45 +0000 Date: Fri, 05 Jun 2026 12:00:35 +0900 (JST) Message-Id: <20260605.120035.125402116886555368.ishii@postgresql.org> To: pgpool-committers@lists.postgresql.org Subject: Re: pgpool: Fix disable_load_balance_on_write to not break query cache. From: Tatsuo Ishii In-Reply-To: References: X-Mailer: Mew version 6.8 on Emacs 29.3 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 2409:11:4120:300:f024:95ae:14e4:964 (failed) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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 Subject: pgpool: Fix disable_load_balance_on_write to not break query cache. Date: Fri, 05 Jun 2026 02:55:00 +0000 Message-ID: > 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 > 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(-) >