Commit 0f8b1941 authored by Sergei Petrunia's avatar Sergei Petrunia

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.
parent f37bdd9c
......@@ -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;
......@@ -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;
......@@ -4958,7 +4958,18 @@ add_key_part(DYNAMIC_ARRAY *keyuse_array, KEY_FIELD *key_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,
......
......@@ -220,7 +220,7 @@ TEST_join(JOIN *join)
}
#define FT_KEYPART (MAX_REF_PARTS+10)
#define FT_KEYPART (MAX_FIELDS+10)
void print_keyuse(KEYUSE *keyuse)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment