[pgpool-committers: 7572] pgpool: Fix that query cache is not created in other than streaming and
Tatsuo Ishii
ishii at sraoss.co.jp
Mon Apr 5 11:43:52 JST 2021
Fix that query cache is not created in other than streaming and logical replication mode.
We used to create query cache in ReadyForQuery() in extended query
mode in other than streaming and logical replication mode. However if
following message sequence is sent from frontend, the query cache was
never created because pool_is_cache_safe() returns false in
pool_handle_query_cache(). Why? Because pool_is_cache_safe() examines
the current query context, and the current query context is for "END"
message.
'P' "" "BEGIN" 0
'B' "" "" 0 0 0
'E' "" 0
'P' "S1" "SELECT 1" 0
'B' "S1" "S1" 0 0 0
'E' "S1" 0
'P' "" "END" 0
'B' "" "" 0 0 0
'E' "" 0
'S'
'Y'
'X'
So this commit changes CommandComplete() so that
pool_handle_query_cache() gets called in not only streaming and
logical replication mode. pool_handle_query_cache() will create a
temporary query cache and it will be processed when next time
ReadyForQuery() is called for an END message.
I found the bug while taking care of:
https://www.pgpool.net/mantisbt/view.php?id=700
Note that if the transaction is ended by a simple query message "END",
the bug does not appear because extended query SELECT messages will be
followed by a SYNC message, which will produce a Ready for query
message, and ReadyForQuery() will happily register query cache since
this time pool_is_cache_safe() returns true.
I think this is a long standing bug. The reason why this was not found
earlier is, despite the similar message sequence is created by the JDBC
driver, CommandComplete() already handles in the way described above.
Branch
------
V4_0_STABLE
Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=0f5e34ae03be173c53c343bb3c1b23a5bd19b0cd
Modified Files
--------------
src/protocol/CommandComplete.c | 10 +++++-----
src/protocol/pool_proto_modules.c | 4 ++--
2 files changed, 7 insertions(+), 7 deletions(-)
More information about the pgpool-committers
mailing list