Debian Codegraph @

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

raw
1 #
2 # Test the persistent stats feature when DROPping a table or an
3 # index when the corresponding rows in the stats tables are locked
4 #
5
6 -- disable_warnings
7 -- disable_query_log
8
9 DROP TABLE IF EXISTS innodb_stats_drop_locked;
10
11 CREATE TABLE innodb_stats_drop_locked (c INT, KEY c_key (c))
12 ENGINE=INNODB STATS_PERSISTENT=1;
13
14 ANALYZE TABLE innodb_stats_drop_locked;
15
16 -- enable_warnings
17 -- enable_query_log
18
19 SET autocommit=0;
20
21 SELECT table_name FROM mysql.innodb_table_stats
22 WHERE table_name='innodb_stats_drop_locked'
23 FOR UPDATE;
24
25 SELECT table_name FROM mysql.innodb_index_stats
26 WHERE table_name='innodb_stats_drop_locked'
27 FOR UPDATE;
28
29 -- connect (con1,localhost,root,,)
30
31 -- connection con1
32
33 ALTER TABLE innodb_stats_drop_locked DROP INDEX c_key;
34
35 # the index should be gone
36 SHOW CREATE TABLE innodb_stats_drop_locked;
37
38 DROP TABLE innodb_stats_drop_locked;
39
40 # the table should be gone
41 SHOW TABLES;
42
43 -- connection default
44
45 -- disconnect con1
46
47 COMMIT;
48
49 # the stats should be there
50
51 SELECT table_name FROM mysql.innodb_table_stats
52 WHERE table_name='innodb_stats_drop_locked';
53
54 SELECT table_name FROM mysql.innodb_index_stats
55 WHERE table_name='innodb_stats_drop_locked';
56
57 SET autocommit=1;
58
59 --disable_query_log
60 call mtr.add_suppression("Unable to delete statistics for table test.innodb_stats_drop_locked: Lock wait timeout. They can be deleted later using DELETE FROM mysql.innodb_index_stats WHERE database_name");
61 --enable_query_log