Debian Codegraph @

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

raw
1 #
2 # Test the persistent stats feature
3 #
4
5 -- source include/have_innodb.inc
6 -- source include/not_embedded.inc
7
8 -- disable_warnings
9 -- disable_query_log
10
11 DROP TABLE IF EXISTS test_innodb_stats;
12
13 set @save_use_stat_tables= @@use_stat_tables;
14 set @@use_stat_tables= NEVER;
15
16 CREATE TABLE test_innodb_stats (
17 a INT,
18 KEY a_key (a)
19 ) ENGINE=INNODB STATS_PERSISTENT=1;
20
21 -- enable_warnings
22 -- enable_query_log
23
24 # test empty table
25 -- let $insert = SELECT 'dummy INSERT, the table should be empty'
26 -- source suite/innodb/include/innodb_stats.inc
27
28 # test table with 1 row
29 -- let $insert = INSERT INTO test_innodb_stats (a) VALUES (1)
30 -- source suite/innodb/include/innodb_stats.inc
31
32 # test table with 2 eq rows
33 -- let $insert = INSERT INTO test_innodb_stats (a) VALUES (1), (1)
34 -- source suite/innodb/include/innodb_stats.inc
35
36 # test table with 3 eq rows
37 -- let $insert = INSERT INTO test_innodb_stats (a) VALUES (1), (1), (1)
38 -- source suite/innodb/include/innodb_stats.inc
39
40 # test table with 10 eq rows
41 -- let $insert = INSERT INTO test_innodb_stats (a) VALUES (1), (1), (1), (1), (1), (1), (1), (1), (1), (1)
42 -- source suite/innodb/include/innodb_stats.inc
43
44 # test table with 2 diff rows
45 -- let $insert = INSERT INTO test_innodb_stats (a) VALUES (1), (2)
46 -- source suite/innodb/include/innodb_stats.inc
47
48 # test table with 2 diff rows, 3 rows in total
49 -- let $insert = INSERT INTO test_innodb_stats (a) VALUES (1), (1), (2)
50 -- source suite/innodb/include/innodb_stats.inc
51
52 # test table with 3 diff rows
53 -- let $insert = INSERT INTO test_innodb_stats (a) VALUES (1), (2), (3)
54 -- source suite/innodb/include/innodb_stats.inc
55
56 # test table with 3 diff rows, 5 rows in total
57 -- let $insert = INSERT INTO test_innodb_stats (a) VALUES (1), (1), (2), (3), (3)
58 -- source suite/innodb/include/innodb_stats.inc
59
60 # test table with 5 diff rows, 10 rows in total
61 -- let $insert = INSERT INTO test_innodb_stats (a) VALUES (1), (2), (3), (4), (5), (1), (2), (3), (4), (5)
62 -- source suite/innodb/include/innodb_stats.inc
63
64 -- disable_query_log
65 DROP TABLE test_innodb_stats;
66 set @@use_stat_tables= @save_use_stat_tables;
67 --enable_query_log
68 --echo #
69 --echo # MDEV-31740 InnoDB statistics column length validation failed
70 --echo #
71 call mtr.add_suppression("InnoDB: Unexpected length of mysql\\.innodb_table_stats\\.last_update");
72 ALTER TABLE mysql.innodb_table_stats MODIFY LAST_UPDATE DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP() ON UPDATE CURRENT_TIMESTAMP();
73 CREATE TABLE t (a INT KEY)Engine=InnoDB STATS_PERSISTENT=1;
74 let SEARCH_FILE=$MYSQLTEST_VARDIR/log/mysqld.1.err;
75 let SEARCH_PATTERN=InnoDB: Unexpected length of mysql\\.innodb_table_stats\\.last_update;
76 --source include/search_pattern_in_file.inc
77 ALTER TABLE mysql.innodb_table_stats MODIFY last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP() ON UPDATE CURRENT_TIMESTAMP();
78 CREATE TABLE t2(a INT KEY)ENGINE=InnoDB STATS_PERSISTENT= 1;
79 SELECT table_name FROM mysql.innodb_table_stats;
80 DROP TABLE t, t2;