diff options
author | Igor Babaev <igor@askmonty.org> | 2012-09-11 22:36:04 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2012-09-11 22:36:04 -0700 |
commit | 2bbcec41488ff4506cb848357086e8fb07a9648c (patch) | |
tree | 32adff3114bf43b9c1cb029bfdf9d35e309cd0e0 /sql/sql_statistics.cc | |
parent | ff36e9fc518a4f8b463a09aeb9499c4552a27534 (diff) | |
download | mariadb-git-2bbcec41488ff4506cb848357086e8fb07a9648c.tar.gz |
Fixed bug mdev-518.
If some statistical tables are corrupted the server should use
the conventional statistical data.
Diffstat (limited to 'sql/sql_statistics.cc')
-rw-r--r-- | sql/sql_statistics.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc index 7c5086da439..412d5722d74 100644 --- a/sql/sql_statistics.cc +++ b/sql/sql_statistics.cc @@ -2908,15 +2908,17 @@ void set_statistics_for_table(THD *thd, TABLE *table) { uint use_stat_table_mode= thd->variables.use_stat_tables; table->used_stat_records= - (use_stat_table_mode <= 1 || !table->s->read_stats || - table->s->read_stats->cardinality_is_null) ? + (use_stat_table_mode <= 1 || + !table->s->stats_is_read || !table->s->read_stats || + table->s->read_stats->cardinality_is_null) ? table->file->stats.records : table->s->read_stats->cardinality; KEY *key_info, *key_info_end; for (key_info= table->key_info, key_info_end= key_info+table->s->keys; key_info < key_info_end; key_info++) { key_info->is_statistics_from_stat_tables= - (use_stat_table_mode > 1 && key_info->read_stats && + (use_stat_table_mode > 1 && table->s->stats_is_read && + key_info->read_stats && key_info->read_stats->avg_frequency_is_inited() && key_info->read_stats->get_avg_frequency(0) > 0.5); } |