summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <SergeyV@selena.>2005-11-23 18:18:41 +0300
committerunknown <SergeyV@selena.>2005-11-23 18:18:41 +0300
commit147be17067dc699aec2f12e7a52992ffc329d8b1 (patch)
treef9ea928b82ec56b1452eec4323f6459b725d3bd3
parent14637f97cdd7ff4a7d60c09052e2e280ee57c957 (diff)
downloadmariadb-git-147be17067dc699aec2f12e7a52992ffc329d8b1.tar.gz
Fixes bug #14902. When analysing a table with FT index that contains stopwords
table statistics is not updated, so the next execution of analyze table will try to update statistics again. mysql-test/r/analyze.result: Updated result file for bug #14902 test. mysql-test/t/analyze.test: Test for bug #14902.
-rw-r--r--myisam/mi_check.c3
-rw-r--r--mysql-test/r/analyze.result9
-rw-r--r--mysql-test/t/analyze.test14
3 files changed, 25 insertions, 1 deletions
diff --git a/myisam/mi_check.c b/myisam/mi_check.c
index 6296193d6b0..9ce1dff51af 100644
--- a/myisam/mi_check.c
+++ b/myisam/mi_check.c
@@ -402,7 +402,7 @@ int chk_key(MI_CHECK *param, register MI_INFO *info)
full_text_keys++;
if (share->state.key_root[key] == HA_OFFSET_ERROR &&
(info->state->records == 0 || keyinfo->flag & HA_FULLTEXT))
- continue;
+ goto do_stat;
if (!_mi_fetch_keypage(info,keyinfo,share->state.key_root[key],
DFLT_INIT_HITS,info->buff,0))
{
@@ -498,6 +498,7 @@ int chk_key(MI_CHECK *param, register MI_INFO *info)
param->max_level);
all_keydata+=param->keydata; all_totaldata+=param->totaldata; key_totlength+=length;
+do_stat:
if (param->testflag & T_STATISTICS)
update_key_parts(keyinfo, rec_per_key_part, param->unique_count,
param->stats_method == MI_STATS_METHOD_IGNORE_NULLS?
diff --git a/mysql-test/r/analyze.result b/mysql-test/r/analyze.result
index 0b44a502b13..3ccc3566432 100644
--- a/mysql-test/r/analyze.result
+++ b/mysql-test/r/analyze.result
@@ -30,3 +30,12 @@ check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
+create table t1 (a mediumtext, fulltext key key1(a)) charset utf8 collate utf8_general_ci engine myisam;
+insert into t1 values ('hello');
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status Table is already up to date
+drop table t1;
diff --git a/mysql-test/t/analyze.test b/mysql-test/t/analyze.test
index 3c3b3933bc3..9d94f5da9d9 100644
--- a/mysql-test/t/analyze.test
+++ b/mysql-test/t/analyze.test
@@ -39,4 +39,18 @@ check table t1;
drop table t1;
+# Bug #14902 ANALYZE TABLE fails to recognize up-to-date tables
+# minimal test case to get an error.
+# The problem is happening when analysing table with FT index that
+# contains stopwords only. The first execution of analyze table should
+# mark index statistics as up to date so that next execution of this
+# statement will end up with Table is up to date status.
+create table t1 (a mediumtext, fulltext key key1(a)) charset utf8 collate utf8_general_ci engine myisam;
+insert into t1 values ('hello');
+
+analyze table t1;
+analyze table t1;
+
+drop table t1;
+
# End of 4.1 tests