Debian Codegraph @

mysql-test/suite/innodb/t/innodb_bug57252.test

raw
1 --source include/have_innodb.inc
2 #
3 # Bug#57252 disabling innobase_stats_on_metadata disables ANALYZE
4 # http://bugs.mysql.com/57252
5 #
6
7 -- disable_query_log
8 -- disable_result_log
9
10 SET @innodb_stats_on_metadata_orig = @@innodb_stats_on_metadata;
11
12 CREATE TABLE bug57252 (a INT, KEY akey (a)) ENGINE=INNODB STATS_PERSISTENT=0;
13
14 BEGIN;
15 let $i = 10;
16 while ($i) {
17 eval INSERT INTO bug57252 VALUES ($i);
18 dec $i;
19 }
20 COMMIT;
21
22 -- enable_result_log
23
24 SET GLOBAL innodb_stats_on_metadata=0;
25
26 # this calls ::info() without HA_STATUS_CONST and so
27 # index->stat_n_diff_key_vals[] is not copied to the mysql-visible
28 # rec_per_key
29 SELECT cardinality FROM information_schema.statistics
30 WHERE table_name='bug57252' AND index_name='akey';
31
32 # this calls ::info() with HA_STATUS_CONST and so
33 # index->stat_n_diff_key_vals[] is copied to the mysql-visible
34 # rec_per_key at the end; when the bug is present dict_update_statistics()
35 # is not called beforehand and so index->stat_n_diff_key_vals[] contains
36 # an outdated data and thus we get an outdated data in the result when the
37 # bug is present
38 ANALYZE TABLE bug57252;
39
40 SELECT cardinality FROM information_schema.statistics
41 WHERE table_name='bug57252' AND index_name='akey';
42
43 DROP TABLE bug57252;
44
45 SET GLOBAL innodb_stats_on_metadata = @innodb_stats_on_metadata_orig;