mirror of
				https://github.com/MariaDB/server.git
				synced 2025-10-31 10:56:12 +01:00 
			
		
		
		
	 430d60d1fc
			
		
	
	
	430d60d1fc
	
	
	
		
			
			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).
		
			
				
	
	
		
			59 lines
		
	
	
	
		
			3.8 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			59 lines
		
	
	
	
		
			3.8 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
| set @save_query_cache_size=@@global.query_cache_size;
 | |
| set global query_cache_type=ON;
 | |
| set local query_cache_type=ON;
 | |
| set global query_cache_size=1355776;
 | |
| create table t1 (a int not null);
 | |
| insert into t1 values (1),(2),(3);
 | |
| select * from t1;
 | |
| a
 | |
| 1
 | |
| 2
 | |
| 3
 | |
| select statement_schema, statement_text, result_blocks_count, result_blocks_size from information_schema.query_cache_info;
 | |
| statement_schema	statement_text	result_blocks_count	result_blocks_size
 | |
| test	select * from t1	1	512
 | |
| select @@time_zone into @time_zone;
 | |
| select @@default_week_format into @default_week_format;
 | |
| select @@character_set_client into @character_set_client;
 | |
| select @@character_set_results into @character_set_results;
 | |
| select @@sql_mode into @sql_mode;
 | |
| select @@div_precision_increment into @div_precision_increment;
 | |
| select @@lc_time_names into @lc_time_names;
 | |
| select @@max_sort_length into @max_sort_length;
 | |
| select @@autocommit into @autocommit;
 | |
| select @@group_concat_max_len into @group_concat_max_len;
 | |
| select Name into @new_time_zone from mysql.time_zone_name limit 1;
 | |
| set time_zone=@new_time_zone,default_week_format=4,character_set_client='binary',character_set_results='utf32',collation_connection='utf32_bin',sql_mode='STRICT_ALL_TABLES',div_precision_increment=7,lc_time_names='ar_SD',autocommit=0, group_concat_max_len=513, max_sort_length=1011;
 | |
| select * from t1;
 | |
| set time_zone= @time_zone, default_week_format= @default_week_format, character_set_client= @character_set_client,character_set_results= @character_set_results, sql_mode= @sql_mode, div_precision_increment= @div_precision_increment, lc_time_names= @lc_time_names, autocommit= @autocommit, group_concat_max_len= @group_concat_max_len, max_sort_length= @max_sort_length;
 | |
| select * from information_schema.query_cache_info;
 | |
| STATEMENT_SCHEMA	STATEMENT_TEXT	RESULT_BLOCKS_COUNT	RESULT_BLOCKS_SIZE	RESULT_BLOCKS_SIZE_USED	LIMIT	MAX_SORT_LENGTH	GROUP_CONCAT_MAX_LENGTH	CHARACTER_SET_CLIENT	CHARACTER_SET_RESULT	COLLATION	TIMEZONE	DEFAULT_WEEK_FORMAT	DIV_PRECISION_INCREMENT	SQL_MODE	LC_TIME_NAMES	CLIENT_LONG_FLAG	CLIENT_PROTOCOL_41	CLIENT_EXTENDED_METADATA	PROTOCOL_TYPE	MORE_RESULTS_EXISTS	IN_TRANS	AUTOCOMMIT	PACKET_NUMBER	HITS
 | |
| test	select * from t1	1	512	#	-1	1011	513	binary	utf32	utf32_bin	Europe/Moscow	4	7	STRICT_ALL_TABLES	ar_SD	1	1	1	#	0	0	0	#	0
 | |
| test	select * from t1	1	512	#	-1	1024	1048576	latin1	latin1	latin1_swedish_ci	SYSTEM	0	4	STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION	en_US	1	1	1	#	0	0	1	#	0
 | |
| reset query cache;
 | |
| select * from t1;
 | |
| a
 | |
| 1
 | |
| 2
 | |
| 3
 | |
| select * from t1;
 | |
| a
 | |
| 1
 | |
| 2
 | |
| 3
 | |
| select hits, statement_text from information_schema.query_cache_info;
 | |
| hits	statement_text
 | |
| 1	select * from t1
 | |
| drop table t1;
 | |
| select statement_schema, statement_text, result_blocks_count, result_blocks_size from information_schema.query_cache_info;
 | |
| statement_schema	statement_text	result_blocks_count	result_blocks_size
 | |
| set global query_cache_size = 0;
 | |
| select * from information_schema.query_cache_info;
 | |
| STATEMENT_SCHEMA	STATEMENT_TEXT	RESULT_BLOCKS_COUNT	RESULT_BLOCKS_SIZE	RESULT_BLOCKS_SIZE_USED	LIMIT	MAX_SORT_LENGTH	GROUP_CONCAT_MAX_LENGTH	CHARACTER_SET_CLIENT	CHARACTER_SET_RESULT	COLLATION	TIMEZONE	DEFAULT_WEEK_FORMAT	DIV_PRECISION_INCREMENT	SQL_MODE	LC_TIME_NAMES	CLIENT_LONG_FLAG	CLIENT_PROTOCOL_41	CLIENT_EXTENDED_METADATA	PROTOCOL_TYPE	MORE_RESULTS_EXISTS	IN_TRANS	AUTOCOMMIT	PACKET_NUMBER	HITS
 | |
| set global query_cache_size= default;
 | |
| set global query_cache_type=default;
 | |
| show query_cache_info;
 | |
| ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'query_cache_info' at line 1
 | |
| flush query_cache_info;
 | |
| ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'query_cache_info' at line 1
 | |
| set @@global.query_cache_size=@save_query_cache_size;
 |