2
# Bug#57252 disabling innobase_stats_on_metadata disables ANALYZE
3
# http://bugs.mysql.com/57252
6
-- source include/have_innodb_plugin.inc
11
SET @innodb_stats_on_metadata_orig = @@innodb_stats_on_metadata;
13
CREATE TABLE bug57252 (a INT, KEY akey (a)) ENGINE=INNODB;
18
eval INSERT INTO bug57252 VALUES ($i);
25
SET GLOBAL innodb_stats_on_metadata=0;
27
# this calls ::info() without HA_STATUS_CONST and so
28
# index->stat_n_diff_key_vals[] is not copied to the mysql-visible
30
SELECT cardinality FROM information_schema.statistics
31
WHERE table_name='bug57252' AND index_name='akey';
33
# this calls ::info() with HA_STATUS_CONST and so
34
# index->stat_n_diff_key_vals[] is copied to the mysql-visible
35
# rec_per_key at the end; when the bug is present dict_update_statistics()
36
# is not called beforehand and so index->stat_n_diff_key_vals[] contains
37
# an outdated data and thus we get an outdated data in the result when the
39
ANALYZE TABLE bug57252;
41
SELECT cardinality FROM information_schema.statistics
42
WHERE table_name='bug57252' AND index_name='akey';
46
SET GLOBAL innodb_stats_on_metadata = @innodb_stats_on_metadata_orig;