summaryrefslogtreecommitdiff
path: root/sql/sql_cache.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2022-01-27 15:54:20 +0400
committerAlexander Barkov <bar@mariadb.com>2022-01-27 15:54:20 +0400
commit430d60d1fc01958f2a503d01b24154672a4189bf (patch)
tree6b27e8a0b73ce9a9b9632b64cfa33a4ba3ef642f /sql/sql_cache.cc
parent4d74bac8bc8c14c2b217391b3b8860f3dc701202 (diff)
downloadmariadb-git-430d60d1fc01958f2a503d01b24154672a4189bf.tar.gz
MDEV-24487 Error after update to 10.5.8 on CentOS-8: DBD::mysql::st execute failed: Unknown MySQL error
The problem happened because the the new client capability flag CLIENT_EXTENDED_METADATA was not put into the cache entry key. So results cached by a new client were sent to the old client (and vica versa) with a mis-matching metadata, which made the client abort the connection on an unexpected result set metadata packet format. The problem was caused by the patch for: MDEV-17832 Protocol: extensions for Pluggable types and JSON, GEOMETRY which forgot to adjust the query cache code. Fix: - Adding a new member Query_cache_query_flags::client_extended_metadata, so only clients with equal CLIENT_EXTENDED_METADATA flag values can reuse results. - Adding a new column CLIENT_EXTENDED_METADATA into INFORMATION_SCHEMA.QUERY_CACHE_INFO (privided by the qc_info plugin).
Diffstat (limited to 'sql/sql_cache.cc')
-rw-r--r--sql/sql_cache.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index b81dea78bcf..164b8b0cbb0 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -1415,6 +1415,8 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
flags.client_long_flag= MY_TEST(thd->client_capabilities & CLIENT_LONG_FLAG);
flags.client_protocol_41= MY_TEST(thd->client_capabilities &
CLIENT_PROTOCOL_41);
+ flags.client_extended_metadata= MY_TEST(thd->client_capabilities &
+ MARIADB_CLIENT_EXTENDED_METADATA);
flags.client_depr_eof= MY_TEST(thd->client_capabilities &
CLIENT_DEPRECATE_EOF);
/*
@@ -1447,12 +1449,13 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
flags.div_precision_increment= thd->variables.div_precincrement;
flags.default_week_format= thd->variables.default_week_format;
DBUG_PRINT("qcache", ("\
-long %d, 4.1: %d, eof: %d, bin_proto: %d, more results %d, pkt_nr: %d, \
+long %d, 4.1: %d, ex metadata: %d, eof: %d, bin_proto: %d, more results %d, pkt_nr: %d, \
CS client: %u, CS result: %u, CS conn: %u, limit: %llu, TZ: %p, \
sql mode: 0x%llx, sort len: %llu, concat len: %u, div_precision: %zu, \
def_week_frmt: %zu, in_trans: %d, autocommit: %d",
(int)flags.client_long_flag,
(int)flags.client_protocol_41,
+ (int)flags.client_extended_metadata,
(int)flags.client_depr_eof,
(int)flags.protocol_type,
(int)flags.more_results_exists,
@@ -1924,6 +1927,8 @@ Query_cache::send_result_to_client(THD *thd, char *org_sql, uint query_length)
flags.client_long_flag= MY_TEST(thd->client_capabilities & CLIENT_LONG_FLAG);
flags.client_protocol_41= MY_TEST(thd->client_capabilities &
CLIENT_PROTOCOL_41);
+ flags.client_extended_metadata= MY_TEST(thd->client_capabilities &
+ MARIADB_CLIENT_EXTENDED_METADATA);
flags.client_depr_eof= MY_TEST(thd->client_capabilities &
CLIENT_DEPRECATE_EOF);
flags.protocol_type= (unsigned int) thd->protocol->type();
@@ -1947,12 +1952,13 @@ Query_cache::send_result_to_client(THD *thd, char *org_sql, uint query_length)
flags.default_week_format= thd->variables.default_week_format;
flags.lc_time_names= thd->variables.lc_time_names;
DBUG_PRINT("qcache", ("\
-long %d, 4.1: %d, eof: %d, bin_proto: %d, more results %d, pkt_nr: %d, \
+long %d, 4.1: %d, ex metadata: %d, eof: %d, bin_proto: %d, more results %d, pkt_nr: %d, \
CS client: %u, CS result: %u, CS conn: %u, limit: %llu, TZ: %p, \
sql mode: 0x%llx, sort len: %llu, concat len: %u, div_precision: %zu, \
def_week_frmt: %zu, in_trans: %d, autocommit: %d",
(int)flags.client_long_flag,
(int)flags.client_protocol_41,
+ (int)flags.client_extended_metadata,
(int)flags.client_depr_eof,
(int)flags.protocol_type,
(int)flags.more_results_exists,