[Commits] 0f8b194: MDEV-6687: Assertion `0' failed in Protocol::end_statement on query

Sergei Petrunia psergey at askmonty.org
Thu Feb 19 19:54:20 EET 2015


revision-id: 0f8b194146b50afe442682c5a14a8a179e28f3b8
parent(s): f37bdd9c1a29865574b10fe7d21164ee7cae4d19
committer: Sergei Petrunia
branch nick: 10.0
timestamp: 2015-02-19 20:54:20 +0300
message:

MDEV-6687: Assertion `0' failed in Protocol::end_statement on query

Redefine FT_KEYPART in a way that it does not conflict with Hash Join.
Hash join stores field->field_index in KEYUSE::keypart, so we must
use a value of FT_KEYPART that's greater than MAX_FIELDS.

---
 mysql-test/r/join_cache.result |   13 +++++++++++++
 mysql-test/t/join_cache.test   |   12 ++++++++++++
 sql/sql_select.cc              |   13 ++++++++++++-
 sql/sql_test.cc                |    2 +-
 4 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/mysql-test/r/join_cache.result b/mysql-test/r/join_cache.result
index 456e17a..c1dbef0 100644
--- a/mysql-test/r/join_cache.result
+++ b/mysql-test/r/join_cache.result
@@ -5874,4 +5874,17 @@ id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	11	Using where
 set join_buffer_space_limit=default;
 drop table t1;
+#
+# MDEV-6687: Assertion `0' failed in Protocol::end_statement on query
+#
+SET join_cache_level = 3;
+# The following should have 
+#  - table order PROFILING,user,  
+#  - table user accessed with hash_ALL:
+explain
+SELECT * FROM INFORMATION_SCHEMA.PROFILING, mysql.user WHERE password_expired = PAGE_FAULTS_MINOR;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	PROFILING	ALL	NULL	NULL	NULL	NULL	NULL	Using where
+1	SIMPLE	user	hash_ALL	NULL	#hash#$hj	1	information_schema.PROFILING.PAGE_FAULTS_MINOR	4	Using where; Using join buffer (flat, BNLH join)
+set join_cache_level=default;
 set @@optimizer_switch=@save_optimizer_switch;
diff --git a/mysql-test/t/join_cache.test b/mysql-test/t/join_cache.test
index 0e4610b..7d873c5 100644
--- a/mysql-test/t/join_cache.test
+++ b/mysql-test/t/join_cache.test
@@ -3848,6 +3848,18 @@ set join_buffer_space_limit=default;
 
 drop table t1;
 
+--echo #
+--echo # MDEV-6687: Assertion `0' failed in Protocol::end_statement on query
+--echo #
+SET join_cache_level = 3;
+--echo # The following should have 
+--echo #  - table order PROFILING,user,  
+--echo #  - table user accessed with hash_ALL:
+explain
+SELECT * FROM INFORMATION_SCHEMA.PROFILING, mysql.user WHERE password_expired = PAGE_FAULTS_MINOR;
+
+set join_cache_level=default;
+
 # The following command must be the last one the file 
 # this must be the last command in the file
 set @@optimizer_switch=@save_optimizer_switch;
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 55dc049..4393f02 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -4958,7 +4958,18 @@ static uint get_semi_join_select_list_index(Field *field)
 }
 
 
-#define FT_KEYPART   (MAX_REF_PARTS+10)
+/*
+  A key part number that means we're using a fulltext scan.
+  
+  In order not to confuse it with regular equalities, we need to pick
+  a number that's greater than MAX_REF_PARTS.
+
+  Hash Join code stores field->field_index in KEYUSE::keypart, so the 
+  number needs to be bigger than MAX_FIELDS, also.
+
+  CAUTION: sql_test.cc has its own definition of FT_KEYPART.
+*/
+#define FT_KEYPART   (MAX_FIELDS+10)
 
 static bool
 add_ft_keys(DYNAMIC_ARRAY *keyuse_array,
diff --git a/sql/sql_test.cc b/sql/sql_test.cc
index 8992ff2..82abc86 100644
--- a/sql/sql_test.cc
+++ b/sql/sql_test.cc
@@ -220,7 +220,7 @@ void TEST_filesort(SORT_FIELD *sortorder,uint s_length)
 }
 
 
-#define FT_KEYPART   (MAX_REF_PARTS+10)
+#define FT_KEYPART   (MAX_FIELDS+10)
 
 void print_keyuse(KEYUSE *keyuse)
 {


More information about the commits mailing list