Debian Codegraph @

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

raw
1 #
2 # Test creating a persistent stats table on nonexistent or corrupted
3 # persistent storage
4 #
5
6 -- source include/have_innodb.inc
7 # Various sizes printed in this test depend on the page size and the
8 # functionality tested here is not related to the page size, so we only
9 # test with 16k page size.
10 -- source include/have_innodb_16k.inc
11 -- source include/not_embedded.inc
12
13 call mtr.add_suppression("InnoDB: Table .*innodb_index_stats.* not found");
14 call mtr.add_suppression("InnoDB: Fetch of persistent statistics requested for table .*");
15 call mtr.add_suppression("InnoDB: Unexpected length of mysql\\.innodb_index_stats\\.stat_description");
16 call mtr.add_suppression("InnoDB: Column stat_description in table mysql\\.innodb_index_stats is VARCHAR");
17
18 -- vertical_results
19
20 # corrupt the persistent storage
21 ALTER TABLE mysql.innodb_index_stats RENAME TO mysql.innodb_index_stats_;
22
23 CREATE TABLE test_ps_create_on_corrupted
24 (a INT, PRIMARY KEY (a))
25 ENGINE=INNODB STATS_PERSISTENT=1;
26
27 # check the stats (should have been generated using the old transient stats
28 # method)
29 SELECT seq_in_index, column_name, cardinality
30 FROM information_schema.statistics WHERE table_name = 'test_ps_create_on_corrupted'
31 ORDER BY index_name, seq_in_index;
32
33 SELECT table_rows, avg_row_length, max_data_length, index_length
34 FROM information_schema.tables WHERE table_name = 'test_ps_create_on_corrupted';
35
36 # restore the persistent storage
37 ALTER TABLE mysql.innodb_index_stats_ RENAME TO mysql.innodb_index_stats;
38
39 SET old_mode='';
40 ALTER TABLE mysql.innodb_index_stats
41 MODIFY stat_description VARCHAR(1024) COLLATE utf8_bin;
42 CREATE TABLE t (a INT) ENGINE=InnoDB STATS_PERSISTENT=1;
43 ALTER TABLE mysql.innodb_index_stats
44 MODIFY stat_description VARCHAR(1024) COLLATE utf8mb3_bin NOT NULL;
45
46 DROP TABLE t;
47
48 --source include/restart_mysqld.inc
49
50 -- vertical_results
51
52 # check again
53 SELECT seq_in_index, column_name, cardinality
54 FROM information_schema.statistics WHERE table_name = 'test_ps_create_on_corrupted'
55 ORDER BY index_name, seq_in_index;
56
57 SELECT table_rows, avg_row_length, max_data_length, index_length
58 FROM information_schema.tables WHERE table_name = 'test_ps_create_on_corrupted';
59
60 DROP TABLE test_ps_create_on_corrupted;