Debian Codegraph @

mysql-test/suite/clone/r/remote_ddl_basic_restart.result

raw
1 SET global debug="+d,clone_restart_apply";
2 INSTALL PLUGIN clone SONAME 'CLONE_PLUGIN';
3 CREATE TABLE t1(col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB);
4 CREATE TABLE t2(col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB)
5 PARTITION BY KEY(col1) PARTITIONS 5;
6 CREATE PROCEDURE execute_dml(
7 p_dml_type INT,
8 p_key_min INT,
9 p_key_range INT,
10 p_loop_count INT,
11 p_frequency INT,
12 p_is_rand INT)
13 BEGIN
14 DECLARE v_idx INT DEFAULT 0;
15 DECLARE v_commit INT DEFAULT 0;
16 DECLARE v_key INT DEFAULT 0;
17 /* Loop and INSERT data at random position */
18 WHILE(v_idx < p_loop_count) DO
19 /* Generate key between 1 to p_loop_count */
20 IF p_is_rand = 1 THEN
21 SET v_key = p_key_min + FLOOR(RAND() * p_key_range);
22 ELSE
23 SET v_key = p_key_min + (v_idx % p_key_range);
24 END IF;
25 CASE p_dml_type
26 WHEN 0 THEN
27 SET @clol3_text = CONCAT('Clone Test Row - ', v_key);
28 INSERT INTO t1 (col1, col2, col3, col4) VALUES (
29 v_key, v_key * 10,
30 @clol3_text, REPEAT('Large Column Data ', 2048))
31 ON DUPLICATE KEY UPDATE col2 = col2 + 1;
32 INSERT INTO t2 (col1, col2, col3, col4) VALUES (
33 v_key, v_key * 10,
34 @clol3_text, REPEAT('Large Column Data ', 2048))
35 ON DUPLICATE KEY UPDATE col2 = col2 + 1;
36 WHEN 1 THEN
37 UPDATE t1 SET col2 = v_idx + 1 WHERE col1 = v_key;
38 UPDATE t2 SET col2 = v_idx + 1 WHERE col1 = v_key;
39 WHEN 2 THEN
40 DELETE FROM t1 WHERE col1 = v_key;
41 DELETE FROM t2 WHERE col1 = v_key;
42 ELSE
43 DELETE FROM t1;
44 DELETE FROM t2;
45 END CASE;
46 SET v_idx = v_idx + 1;
47 /* Commit or rollback work at specified frequency. */
48 IF v_idx % p_frequency = 0 THEN
49 SET v_commit = FLOOR(RAND() * 2);
50 IF v_commit = 0 AND p_is_rand = 1 THEN
51 ROLLBACK;
52 START TRANSACTION;
53 ELSE
54 COMMIT;
55 START TRANSACTION;
56 END IF;
57 END IF;
58 END WHILE;
59 COMMIT;
60 END|
61 call execute_dml(0, 0, 100, 100, 10, 0);
62 CREATE TABLE t SELECT * FROM t1;
63 DROP table t1;
64 DROP table t2;
65 SHOW VARIABLES LIKE 'clone_ddl_timeout';
66 Variable_name Value
67 clone_ddl_timeout 300
68 SHOW VARIABLES LIKE 'clone_block_ddl';
69 Variable_name Value
70 clone_block_ddl OFF
71 # 1. CREATE TABLE while clone in progress
72 RESET MASTER;
73 SET GLOBAL DEBUG = '+d,remote_release_clone_file_pin';
74 CREATE TABLE t0 (col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB) PARTITION BY KEY(col1) PARTITIONS 5;
75 SET DEBUG_SYNC = 'clone_before_init_meta SIGNAL start_ddl_file_init WAIT_FOR resume_file_init';
76 SET DEBUG_SYNC = 'clone_file_copy SIGNAL start_ddl_file WAIT_FOR resume_file';
77 SET DEBUG_SYNC = 'clone_file_copy_end_before_ack SIGNAL start_ddl_file_ack WAIT_FOR resume_file_ack';
78 SET DEBUG_SYNC = 'clone_before_file_ddl_meta SIGNAL start_ddl_file_meta WAIT_FOR resume_file_meta';
79 SET DEBUG_SYNC = 'clone_page_copy SIGNAL start_ddl_page WAIT_FOR resume_page';
80 SET DEBUG_SYNC = 'clone_before_page_ddl_meta SIGNAL start_ddl_page_meta WAIT_FOR resume_page_meta';
81 SET DEBUG_SYNC = 'clone_redo_copy SIGNAL start_ddl_redo WAIT_FOR resume_redo';
82 SET GLOBAL clone_autotune_concurrency = OFF;
83 SET GLOBAL clone_max_concurrency = 8;
84 SET GLOBAL clone_valid_donor_list = 'HOST:PORT';
85 CLONE INSTANCE FROM USER@HOST:PORT IDENTIFIED BY '' DATA DIRECTORY = 'CLONE_DATADIR';
86 # In connection CON1
87 CREATE TABLE t01 (col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB) PARTITION BY KEY(col1) PARTITIONS 5;
88 SET DEBUG_SYNC = 'now SIGNAL resume_file_init';
89 # Waiting for clone to reach 'file copy'
90 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_file';
91 # Wait finished
92 # For remote clone, let the donor progress concurrently
93 # otherwise file pins may not be released causing deadlock
94 SET DEBUG_SYNC = 'clone_notify_ddl SIGNAL resume_file';
95 CREATE TABLE t1 (col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB) PARTITION BY KEY(col1) PARTITIONS 5;
96 INSERT INTO t1 SELECT * FROM t;
97 # Flush all dirty pages to track
98 SET GLOBAL innodb_buf_flush_list_now = 1;
99 SET DEBUG_SYNC = 'now SIGNAL resume_file';
100 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_file_ack';
101 SET DEBUG_SYNC = 'now SIGNAL resume_file_ack';
102 CREATE TABLE t11 (col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB) PARTITION BY KEY(col1) PARTITIONS 5;
103 INSERT INTO t11 SELECT * FROM t;
104 SET DEBUG_SYNC = 'now SIGNAL resume_file_meta';
105 # Waiting for clone to reach 'page copy'
106 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_page';
107 # Wait finished
108 CREATE TABLE t2 (col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB) PARTITION BY KEY(col1) PARTITIONS 5;
109 CALL execute_dml(0, 0, 100, 100, 10, 0);
110 SET DEBUG_SYNC = 'now SIGNAL resume_page';
111 # Waiting for clone to reach 'redo copy'
112 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_redo';
113 # Wait finished
114 CREATE TABLE t21 (col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB) PARTITION BY KEY(col1) PARTITIONS 5;
115 INSERT INTO t21 SELECT * FROM t;
116 CREATE TABLE t3 (col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB) PARTITION BY KEY(col1) PARTITIONS 5;
117 SET DEBUG_SYNC = 'now SIGNAL resume_redo';
118 # In connection DEFAULT
119 # Waiting for clone to complete
120 # Wait finished
121 SET GLOBAL DEBUG = '-d,remote_release_clone_file_pin';
122 # Restart server on cloned data directory
123 # restart: --datadir=CLONE_DATADIR
124 # Check cloned data
125 SHOW TABLES;
126 Tables_in_test
127 t
128 t0
129 t01
130 t1
131 t11
132 t2
133 SHOW CREATE TABLE t1;
134 Table Create Table
135 t1 CREATE TABLE `t1` (
136 `col1` int NOT NULL,
137 `col2` int DEFAULT NULL,
138 `col3` varchar(64) DEFAULT NULL,
139 `col4` blob,
140 PRIMARY KEY (`col1`)
141 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
142 /*!50100 PARTITION BY KEY (col1)
143 PARTITIONS 5 */
144 CHECK TABLE t1 EXTENDED;
145 Table Op Msg_type Msg_text
146 test.t1 check status OK
147 SELECT count(*) from t1;
148 count(*)
149 100
150 SELECT col1, col2, col3 FROM t1 ORDER BY col1 LIMIT 10;;
151 col1 col2 col3
152 0 1 Clone Test Row - 0
153 1 11 Clone Test Row - 1
154 2 21 Clone Test Row - 2
155 3 31 Clone Test Row - 3
156 4 41 Clone Test Row - 4
157 5 51 Clone Test Row - 5
158 6 61 Clone Test Row - 6
159 7 71 Clone Test Row - 7
160 8 81 Clone Test Row - 8
161 9 91 Clone Test Row - 9
162 SELECT col1, col2, col3 FROM t1 ORDER BY col1 DESC LIMIT 10;;
163 col1 col2 col3
164 99 991 Clone Test Row - 99
165 98 981 Clone Test Row - 98
166 97 971 Clone Test Row - 97
167 96 961 Clone Test Row - 96
168 95 951 Clone Test Row - 95
169 94 941 Clone Test Row - 94
170 93 931 Clone Test Row - 93
171 92 921 Clone Test Row - 92
172 91 911 Clone Test Row - 91
173 90 901 Clone Test Row - 90
174 SHOW CREATE TABLE t11;
175 Table Create Table
176 t11 CREATE TABLE `t11` (
177 `col1` int NOT NULL,
178 `col2` int DEFAULT NULL,
179 `col3` varchar(64) DEFAULT NULL,
180 `col4` blob,
181 PRIMARY KEY (`col1`)
182 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
183 /*!50100 PARTITION BY KEY (col1)
184 PARTITIONS 5 */
185 CHECK TABLE t11 EXTENDED;
186 Table Op Msg_type Msg_text
187 test.t11 check status OK
188 SELECT count(*) from t11;
189 count(*)
190 100
191 SELECT col1, col2, col3 FROM t11 ORDER BY col1 LIMIT 10;;
192 col1 col2 col3
193 0 0 Clone Test Row - 0
194 1 10 Clone Test Row - 1
195 2 20 Clone Test Row - 2
196 3 30 Clone Test Row - 3
197 4 40 Clone Test Row - 4
198 5 50 Clone Test Row - 5
199 6 60 Clone Test Row - 6
200 7 70 Clone Test Row - 7
201 8 80 Clone Test Row - 8
202 9 90 Clone Test Row - 9
203 SELECT col1, col2, col3 FROM t11 ORDER BY col1 DESC LIMIT 10;;
204 col1 col2 col3
205 99 990 Clone Test Row - 99
206 98 980 Clone Test Row - 98
207 97 970 Clone Test Row - 97
208 96 960 Clone Test Row - 96
209 95 950 Clone Test Row - 95
210 94 940 Clone Test Row - 94
211 93 930 Clone Test Row - 93
212 92 920 Clone Test Row - 92
213 91 910 Clone Test Row - 91
214 90 900 Clone Test Row - 90
215 SHOW CREATE TABLE t2;
216 Table Create Table
217 t2 CREATE TABLE `t2` (
218 `col1` int NOT NULL,
219 `col2` int DEFAULT NULL,
220 `col3` varchar(64) DEFAULT NULL,
221 `col4` blob,
222 PRIMARY KEY (`col1`)
223 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
224 /*!50100 PARTITION BY KEY (col1)
225 PARTITIONS 5 */
226 CHECK TABLE t2 EXTENDED;
227 Table Op Msg_type Msg_text
228 test.t2 check status OK
229 SELECT count(*) from t2;
230 count(*)
231 100
232 SELECT col1, col2, col3 FROM t2 ORDER BY col1 LIMIT 10;;
233 col1 col2 col3
234 0 0 Clone Test Row - 0
235 1 10 Clone Test Row - 1
236 2 20 Clone Test Row - 2
237 3 30 Clone Test Row - 3
238 4 40 Clone Test Row - 4
239 5 50 Clone Test Row - 5
240 6 60 Clone Test Row - 6
241 7 70 Clone Test Row - 7
242 8 80 Clone Test Row - 8
243 9 90 Clone Test Row - 9
244 SELECT col1, col2, col3 FROM t2 ORDER BY col1 DESC LIMIT 10;;
245 col1 col2 col3
246 99 990 Clone Test Row - 99
247 98 980 Clone Test Row - 98
248 97 970 Clone Test Row - 97
249 96 960 Clone Test Row - 96
250 95 950 Clone Test Row - 95
251 94 940 Clone Test Row - 94
252 93 930 Clone Test Row - 93
253 92 920 Clone Test Row - 92
254 91 910 Clone Test Row - 91
255 90 900 Clone Test Row - 90
256 CALL execute_dml(1, 0, 100, 100, 10, 0);
257 # Restart server back on base data directory
258 # restart:
259 SET DEBUG_SYNC = 'RESET';
260 # 2. DROP TABLE while clone in progress
261 RESET MASTER;
262 SET GLOBAL DEBUG = '+d,remote_release_clone_file_pin';
263 DROP TABLE t0 ;
264 SET DEBUG_SYNC = 'clone_before_init_meta SIGNAL start_ddl_file_init WAIT_FOR resume_file_init';
265 SET DEBUG_SYNC = 'clone_file_copy SIGNAL start_ddl_file WAIT_FOR resume_file';
266 SET DEBUG_SYNC = 'clone_file_copy_end_before_ack SIGNAL start_ddl_file_ack WAIT_FOR resume_file_ack';
267 SET DEBUG_SYNC = 'clone_before_file_ddl_meta SIGNAL start_ddl_file_meta WAIT_FOR resume_file_meta';
268 SET DEBUG_SYNC = 'clone_page_copy SIGNAL start_ddl_page WAIT_FOR resume_page';
269 SET DEBUG_SYNC = 'clone_before_page_ddl_meta SIGNAL start_ddl_page_meta WAIT_FOR resume_page_meta';
270 SET DEBUG_SYNC = 'clone_redo_copy SIGNAL start_ddl_redo WAIT_FOR resume_redo';
271 SET GLOBAL clone_autotune_concurrency = OFF;
272 SET GLOBAL clone_max_concurrency = 8;
273 SET GLOBAL clone_valid_donor_list = 'HOST:PORT';
274 CLONE INSTANCE FROM USER@HOST:PORT IDENTIFIED BY '' DATA DIRECTORY = 'CLONE_DATADIR';
275 # In connection CON1
276 DROP TABLE t01 ;
277 SET DEBUG_SYNC = 'now SIGNAL resume_file_init';
278 # Waiting for clone to reach 'file copy'
279 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_file';
280 # Wait finished
281 # For remote clone, let the donor progress concurrently
282 # otherwise file pins may not be released causing deadlock
283 SET DEBUG_SYNC = 'clone_notify_ddl SIGNAL resume_file';
284 DROP TABLE t1 ;
285 SHOW TABLES;
286 Tables_in_test
287 t
288 t11
289 t2
290 t21
291 t3
292 # Flush all dirty pages to track
293 SET GLOBAL innodb_buf_flush_list_now = 1;
294 SET DEBUG_SYNC = 'now SIGNAL resume_file';
295 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_file_ack';
296 SET DEBUG_SYNC = 'now SIGNAL resume_file_ack';
297 DROP TABLE t11 ;
298 SHOW TABLES;
299 Tables_in_test
300 t
301 t2
302 t21
303 t3
304 SET DEBUG_SYNC = 'now SIGNAL resume_file_meta';
305 # Waiting for clone to reach 'page copy'
306 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_page';
307 # Wait finished
308 DROP TABLE t2 ;
309 SHOW TABLES;
310 Tables_in_test
311 t
312 t21
313 t3
314 SET DEBUG_SYNC = 'now SIGNAL resume_page';
315 # Waiting for clone to reach 'redo copy'
316 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_redo';
317 # Wait finished
318 DROP TABLE t21 ;
319 SHOW TABLES;
320 Tables_in_test
321 t
322 t3
323 DROP TABLE t3 ;
324 SET DEBUG_SYNC = 'now SIGNAL resume_redo';
325 # In connection DEFAULT
326 # Waiting for clone to complete
327 # Wait finished
328 SET GLOBAL DEBUG = '-d,remote_release_clone_file_pin';
329 # Restart server on cloned data directory
330 # restart: --datadir=CLONE_DATADIR
331 # Check cloned data
332 SHOW TABLES;
333 Tables_in_test
334 t
335 t21
336 t3
337 # Restart server back on base data directory
338 # restart:
339 SET DEBUG_SYNC = 'RESET';
340 # Cleanup
341 DROP TABLE t;
342 CREATE TABLE t1 (col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB);
343 CREATE TABLE t2 (col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB);
344 DROP TABLE t1;
345 DROP TABLE t2;
346 DROP PROCEDURE execute_dml;
347 # Uninstall clone
348 UNINSTALL PLUGIN clone;