From ee8477f9dc586f0641f7e0f7fc4e72939cd1aec7 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 8 Jul 2019 17:03:16 +0200 Subject: [PATCH] MDEV-17627 Assertion `inited==RND' failed in handler::ha_rnd_end() upon actions on partitioned table with FTS use ha_ft_end() after ha_ft_init() --- mysql-test/suite/parts/r/fulltext.result | 6 ++++++ mysql-test/suite/parts/t/fulltext.test | 9 +++++++++ sql/sql_select.cc | 5 ++++- 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 mysql-test/suite/parts/r/fulltext.result create mode 100644 mysql-test/suite/parts/t/fulltext.test diff --git a/mysql-test/suite/parts/r/fulltext.result b/mysql-test/suite/parts/r/fulltext.result new file mode 100644 index 00000000000..6495c9aa5a1 --- /dev/null +++ b/mysql-test/suite/parts/r/fulltext.result @@ -0,0 +1,6 @@ +create table t1 (i int, f1 varchar(512), f2 varchar(512), fulltext (f1)) engine=myisam partition by hash (i); +select * from t1 where match (f1) against ('foo'); +i f1 f2 +select * from t1 where match (f2) against ('bar' in boolean mode) ; +i f1 f2 +drop table t1; diff --git a/mysql-test/suite/parts/t/fulltext.test b/mysql-test/suite/parts/t/fulltext.test new file mode 100644 index 00000000000..c591e660e5b --- /dev/null +++ b/mysql-test/suite/parts/t/fulltext.test @@ -0,0 +1,9 @@ +--source include/have_partition.inc + +# +# MDEV-17627 Assertion `inited==RND' failed in handler::ha_rnd_end() upon actions on partitioned table with FTS +# +create table t1 (i int, f1 varchar(512), f2 varchar(512), fulltext (f1)) engine=myisam partition by hash (i); +select * from t1 where match (f1) against ('foo'); +select * from t1 where match (f2) against ('bar' in boolean mode) ; +drop table t1; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 426fcd6dbb4..4cb99a04c02 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -12499,7 +12499,10 @@ void JOIN_TAB::cleanup() if (table) { table->file->ha_end_keyread(); - table->file->ha_index_or_rnd_end(); + if (type == JT_FT) + table->file->ha_ft_end(); + else + table->file->ha_index_or_rnd_end(); preread_init_done= FALSE; if (table->pos_in_table_list && table->pos_in_table_list->jtbm_subselect)