Debian Codegraph @

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

raw
1 --source include/have_debug.inc
2 --source include/not_valgrind.inc
3 --source include/not_crashrep.inc
4 --source include/big_test.inc
5
6 --disable_query_log
7 --disable_result_log
8 # Basically, these are sporadic warnings/errors and harmless to the table
9 CALL mtr.add_suppression("Operating system error number 32 in a file operation.");
10 CALL mtr.add_suppression("The error means that another program is using InnoDB's files.");
11 --enable_result_log
12 --enable_query_log
13
14 LET $innodb_ddl_log_crash_reset_debug_orig = `SELECT @@innodb_ddl_log_crash_reset_debug`;
15
16 let $table_name= t1;
17
18 # ADD PARTITION for RANGE
19 let $create_statement= CREATE TABLE $table_name
20 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b VARCHAR(100), c INT NOT NULL, KEY(c)) ENGINE=InnoDB
21 PARTITION BY RANGE(a) PARTITIONS 2
22 ( PARTITION p0 VALUES LESS THAN (10) TABLESPACE innodb_file_per_table,
23 PARTITION p1 VALUES LESS THAN (20) TABLESPACE innodb_file_per_table);
24
25 let $insert_statement= INSERT INTO t1 VALUES (1, "Filler1", 1),
26 (2, "filler2", 2), (3, "FILLER3", 3), (14, "Filler4", 14), (15, "15", 15),
27 (16, "filler6", 16);
28
29
30 let $test_free= 1;
31 let $test_delete= 0;
32 let $test_rename= 0;
33 let $test_drop= 0;
34 let $crash_statement= ALTER TABLE $table_name ADD PARTITION (PARTITION p2 VALUES LESS THAN(30) TABLESPACE = innodb_file_per_table, PARTITION p3 VALUES LESS THAN(40) TABLESPACE = innodb_file_per_table);
35 --source ../mysql-test/suite/innodb/include/ddl_crash_statement.inc
36
37
38 # DROP PARTITION
39 let $create_statement= CREATE TABLE $table_name
40 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b VARCHAR(100), c INT NOT NULL, KEY(c)) ENGINE=InnoDB
41 PARTITION BY RANGE(a) PARTITIONS 4
42 ( PARTITION p0 VALUES LESS THAN (10) TABLESPACE innodb_file_per_table,
43 PARTITION p1 VALUES LESS THAN (20) TABLESPACE innodb_file_per_table,
44 PARTITION p2 VALUES LESS THAN (30) TABLESPACE innodb_file_per_table,
45 PARTITION p3 VALUES LESS THAN (40) TABLESPACE innodb_file_per_table);
46
47 let $insert_statement= INSERT INTO t1 VALUES (1, "Filler1", 1),
48 (2, "filler2", 2), (3, "FILLER3", 3), (14, "Filler4", 14), (25, "15", 25),
49 (36, "filler6", 36);
50
51 let $test_free= 1;
52 let $test_delete= 1;
53 let $test_rename= 0;
54 let $test_drop= 0;
55 let $crash_statement= ALTER TABLE $table_name DROP PARTITION p1, p3;
56 --source ../mysql-test/suite/innodb/include/ddl_crash_statement.inc
57
58
59 # REORGANIZE PARTITION
60 let $create_statement= CREATE TABLE $table_name
61 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b VARCHAR(100), c INT NOT NULL, KEY(c)) ENGINE=InnoDB
62 PARTITION BY RANGE(a) PARTITIONS 4
63 ( PARTITION p0 VALUES LESS THAN (10) TABLESPACE innodb_file_per_table,
64 PARTITION p1 VALUES LESS THAN (20) TABLESPACE innodb_file_per_table,
65 PARTITION p2 VALUES LESS THAN (30) TABLESPACE innodb_file_per_table,
66 PARTITION p3 VALUES LESS THAN (40) TABLESPACE innodb_file_per_table);
67
68 let $test_free= 1;
69 let $test_delete= 1;
70 let $test_rename= 1;
71 let $test_drop= 0;
72 let $crash_statement= ALTER TABLE $table_name REORGANIZE PARTITION p2, p3 INTO(PARTITION p2 VALUES LESS THAN(40));
73 --source ../mysql-test/suite/innodb/include/ddl_crash_statement.inc
74
75
76 # ADD PARTITION for HASH
77 let $create_statement= CREATE TABLE $table_name
78 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b VARCHAR(100), c INT NOT NULL, KEY(c)) PARTITION BY HASH(a) PARTITIONS 2;
79
80 let $test_free= 1;
81 let $test_delete= 1;
82 let $test_rename= 1;
83 let $test_drop= 0;
84 let $crash_statement= ALTER TABLE $table_name ADD PARTITION PARTITIONS 2;
85 --source ../mysql-test/suite/innodb/include/ddl_crash_statement.inc
86
87
88 # COALESCE PARTITION
89 let $create_statement= CREATE TABLE $table_name
90 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b VARCHAR(100), c INT NOT NULL, KEY(c)) PARTITION BY HASH(a) PARTITIONS 4;
91
92 let $test_free= 1;
93 let $test_delete= 1;
94 let $test_rename= 1;
95 let $test_drop= 0;
96 let $crash_statement= ALTER TABLE $table_name COALESCE PARTITION 2;
97 --source ../mysql-test/suite/innodb/include/ddl_crash_statement.inc
98
99
100 # EXCHANGE PARTITION
101
102 # These errors are allowable, because it is proved to be reported during
103 # recovery. And after recovery, the problematic data file/tablespace
104 # can be opened properly. CHECK TABLE on these tables are OK.
105 # One we improve the opening tablespaces flow, this kind of error
106 # can be prevented.
107 -- disable_query_log
108 call mtr.add_suppression("Could not find a valid tablespace file for");
109 call mtr.add_suppression("Operating system error number 2 in a file operation.");
110 call mtr.add_suppression("The error means the system cannot find the path specified.");
111 call mtr.add_suppression("Cannot open datafile for read-only:");
112 call mtr.add_suppression("\\[ERROR\\].* Tablespace.*, name 'test.t[12].*', unable to open file '.*test.t[12].*\\.ibd' - Data structure corruption");
113 --enable_query_log
114
115 let $create_statement= CREATE TABLE $table_name
116 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b VARCHAR(100), c INT NOT NULL, KEY(c)) ENGINE=InnoDB
117 PARTITION BY RANGE(a) PARTITIONS 2
118 ( PARTITION p0 VALUES LESS THAN (10),
119 PARTITION p1 VALUES LESS THAN (20));
120
121 let $insert_statement= INSERT INTO t1 VALUES (1, "Filler1", 1),
122 (2, "filler2", 2), (3, "FILLER3", 3), (14, "Filler4", 14), (15, "15", 15),
123 (16, "filler6", 16);
124
125 CREATE TABLE t2 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b VARCHAR(100), c INT NOT NULL, KEY(c));
126
127 let $test_free= 0;
128 let $test_delete= 0;
129 let $test_rename= 1;
130 let $test_drop= 0;
131 let $crash_statement= ALTER TABLE $table_name EXCHANGE PARTITION p1 WITH TABLE t2;
132 --source ../mysql-test/suite/innodb/include/ddl_crash_statement.inc
133
134 CHECK TABLE t2;
135 DROP TABLE t2;
136
137 eval SET GLOBAL innodb_ddl_log_crash_reset_debug = $innodb_ddl_log_crash_reset_debug_orig;