Debian Codegraph @

mysql-test/suite/innodb/include/instant_add_column_recovery.inc

raw
1
2 --echo #
3 --echo # Scenario 1:
4 --echo # Create normal table and partitioned table, DML on them, restart
5 --echo #
6
7 --eval CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b INT) ROW_FORMAT=$row_format
8
9 INSERT INTO t1 VALUES(0, 1), (0, 2), (0, 3), (0, 4), (0, 5);
10
11
12 let $new_cols = 1;
13 let $instant_add_column = ALTER TABLE t1 ADD COLUMN c1 INT DEFAULT 10;
14
15 --source ../mysql-test/suite/innodb/include/instant_add_column_exec_and_verify.inc
16
17 INSERT INTO t1 VALUES(0, 6, 20), (0, 7, 20);
18
19 --source include/restart_mysqld.inc
20
21 CHECK TABLE t1;
22
23 SELECT * FROM t1;
24
25 UPDATE t1 SET b = 10;
26
27 --source include/restart_mysqld.inc
28
29 CHECK TABLE t1;
30
31 SELECT * FROM t1;
32
33 UPDATE t1 SET c1 = 15;
34
35 --source include/restart_mysqld.inc
36
37 CHECK TABLE t1;
38
39 DELETE FROM t1 WHERE a > 0;
40
41 --source include/restart_mysqld.inc
42
43 CHECK TABLE t1;
44
45 SELECT * FROM t1;
46
47 INSERT INTO t1(a, b) VALUES(0, 1), (0, 2), (0, 3), (0, 4), (0, 5);
48
49 let $new_cols = 2;
50 let $instant_add_column = ALTER TABLE t1 ADD COLUMN c2 VARCHAR(100) DEFAULT 'Hello World!';
51
52 --source ../mysql-test/suite/innodb/include/instant_add_column_exec_and_verify.inc
53
54 UPDATE t1 SET c2 = 'Hello MySQL!';
55
56 --source include/restart_mysqld.inc
57
58 CHECK TABLE t1;
59
60 SELECT * FROM t1;
61
62 DROP TABLE t1;
63
64
65
66 --echo #
67 --echo # Scenario 2:
68 --echo # Create normal table and partitioned table, DML on them, crash
69 --echo #
70
71 --eval CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b INT) ROW_FORMAT=$row_format
72
73 INSERT INTO t1 VALUES(0, 1), (0, 2), (0, 3), (0, 4), (0, 5);
74
75
76 let $new_cols = 1;
77 let $instant_add_column = ALTER TABLE t1 ADD COLUMN c1 INT DEFAULT 10;
78
79 --source ../mysql-test/suite/innodb/include/instant_add_column_exec_and_verify.inc
80
81 START TRANSACTION;
82
83 INSERT INTO t1 VALUES(0, 6, 20), (0, 7, 20);
84
85 # Server will crash on next commit
86 --source include/expect_crash.inc
87 SET SESSION DEBUG="+d,crash_commit_after";
88 --echo CR_SERVER_LOST
89 --error 2013
90
91 COMMIT;
92
93 --source include/start_mysqld.inc
94
95 CHECK TABLE t1;
96
97 SELECT * FROM t1;
98
99
100 INSERT INTO t1 VALUES(0, 6, 20), (0, 7, 20);
101
102 START TRANSACTION;
103
104 UPDATE t1 SET b = 10;
105
106 # Server will crash on next commit
107 --source include/expect_crash.inc
108 SET SESSION DEBUG="+d,crash_commit_after";
109 --echo CR_SERVER_LOST
110 --error 2013
111
112 COMMIT;
113
114 --source include/start_mysqld.inc
115
116 CHECK TABLE t1;
117
118 SELECT * FROM t1;
119
120
121 UPDATE t1 SET b = 10;
122
123 START TRANSACTION;
124
125 UPDATE t1 SET c1 = 11;
126
127 # Server will crash on next commit
128 --source include/expect_crash.inc
129 SET SESSION DEBUG="+d,crash_commit_after";
130 --echo CR_SERVER_LOST
131 --error 2013
132
133 COMMIT;
134
135 --source include/start_mysqld.inc
136
137 CHECK TABLE t1;
138
139 SELECT * FROM t1;
140
141
142 UPDATE t1 SET c1 = 11;
143
144 START TRANSACTION;
145
146 DELETE FROM t1 WHERE a > 0;
147
148 # Server will crash on next commit
149 --source include/expect_crash.inc
150 SET SESSION DEBUG="+d,crash_commit_after";
151 --echo CR_SERVER_LOST
152 --error 2013
153
154 COMMIT;
155
156 --source include/start_mysqld.inc
157
158 CHECK TABLE t1;
159
160 SELECT * FROM t1;
161
162
163 DELETE FROM t1 WHERE a > 0;
164
165 SELECT * FROM t1;
166
167
168 CHECK TABLE t1;
169
170 DROP TABLE t1;
171
172
173
174 --eval CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b INT) ROW_FORMAT=$row_format
175
176 INSERT INTO t1 VALUES(0, 1), (0, 2), (0, 3), (0, 4), (0, 5);
177
178
179 let $new_cols = 1;
180 let $instant_add_column = ALTER TABLE t1 ADD COLUMN c1 INT DEFAULT 10;
181
182 --source ../mysql-test/suite/innodb/include/instant_add_column_exec_and_verify.inc
183
184 START TRANSACTION;
185
186 INSERT INTO t1 VALUES(6, 6, 20), (7, 7, 20);
187
188 # Server will crash on next commit
189 --source include/expect_crash.inc
190 SET SESSION DEBUG="+d,crash_commit_before";
191 --echo CR_SERVER_LOST
192 --error 2013
193
194 COMMIT;
195
196 --source include/start_mysqld.inc
197
198 CHECK TABLE t1;
199
200 SELECT * FROM t1;
201
202 INSERT INTO t1 VALUES(6, 6, 20), (7, 7, 20);
203
204 START TRANSACTION;
205
206 UPDATE t1 SET b = 10;
207
208 # Server will crash on next commit
209 --source include/expect_crash.inc
210 SET SESSION DEBUG="+d,crash_commit_before";
211 --echo CR_SERVER_LOST
212 --error 2013
213
214 COMMIT;
215
216 --source include/start_mysqld.inc
217
218 CHECK TABLE t1;
219
220 SELECT * FROM t1;
221
222
223 UPDATE t1 SET b = 10;
224
225 START TRANSACTION;
226
227 UPDATE t1 SET c1 = 11;
228
229 # Server will crash on next commit
230 --source include/expect_crash.inc
231 SET SESSION DEBUG="+d,crash_commit_before";
232 --echo CR_SERVER_LOST
233 --error 2013
234
235 COMMIT;
236
237
238 --source include/start_mysqld.inc
239
240 CHECK TABLE t1;
241
242 SELECT * FROM t1;
243
244
245 UPDATE t1 SET c1 = 11;
246
247 START TRANSACTION;
248
249 DELETE FROM t1 WHERE a > 0;
250
251 # Server will crash on next commit
252 --source include/expect_crash.inc
253 SET SESSION DEBUG="+d,crash_commit_before";
254 --echo CR_SERVER_LOST
255 --error 2013
256
257 COMMIT;
258
259 --source include/start_mysqld.inc
260
261 CHECK TABLE t1;
262
263 SELECT * FROM t1;
264
265
266 DELETE FROM t1 WHERE a > 0;
267
268 SELECT * FROM t1;
269
270
271 CHECK TABLE t1;
272
273 DROP TABLE t1;