Debian Codegraph @

mysql-test/suite/clone/r/remote_ddl_truncate_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 CREATE TABLE t0 (col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB);
64 CREATE TABLE t01 (col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB);
65 CREATE TABLE t3 (col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB);
66 CREATE TABLE t11 (col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB);
67 CREATE TABLE t21 (col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB);
68 INSERT INTO t11 SELECT * FROM t;
69 INSERT INTO t21 SELECT * FROM t;
70 SHOW VARIABLES LIKE 'clone_ddl_timeout';
71 Variable_name Value
72 clone_ddl_timeout 300
73 SHOW VARIABLES LIKE 'clone_block_ddl';
74 Variable_name Value
75 clone_block_ddl OFF
76 # 1. TRUNCATE TABLE while clone in progress
77 SET global debug="+d,clone_send_deleted_block";
78 RESET MASTER;
79 SET GLOBAL DEBUG = '+d,remote_release_clone_file_pin';
80 TRUNCATE TABLE t0 ;
81 SET DEBUG_SYNC = 'clone_before_init_meta SIGNAL start_ddl_file_init WAIT_FOR resume_file_init';
82 SET DEBUG_SYNC = 'clone_file_copy SIGNAL start_ddl_file WAIT_FOR resume_file';
83 SET DEBUG_SYNC = 'clone_file_copy_end_before_ack SIGNAL start_ddl_file_ack WAIT_FOR resume_file_ack';
84 SET DEBUG_SYNC = 'clone_before_file_ddl_meta SIGNAL start_ddl_file_meta WAIT_FOR resume_file_meta';
85 SET DEBUG_SYNC = 'clone_page_copy SIGNAL start_ddl_page WAIT_FOR resume_page';
86 SET DEBUG_SYNC = 'clone_before_page_ddl_meta SIGNAL start_ddl_page_meta WAIT_FOR resume_page_meta';
87 SET DEBUG_SYNC = 'clone_redo_copy SIGNAL start_ddl_redo WAIT_FOR resume_redo';
88 SET GLOBAL clone_autotune_concurrency = OFF;
89 SET GLOBAL clone_max_concurrency = 8;
90 SET GLOBAL clone_valid_donor_list = 'HOST:PORT';
91 CLONE INSTANCE FROM USER@HOST:PORT IDENTIFIED BY '' DATA DIRECTORY = 'CLONE_DATADIR';
92 # In connection CON1
93 TRUNCATE TABLE t01 ;
94 SET DEBUG_SYNC = 'now SIGNAL resume_file_init';
95 # Waiting for clone to reach 'file copy'
96 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_file';
97 # Wait finished
98 # For remote clone, let the donor progress concurrently
99 # otherwise file pins may not be released causing deadlock
100 SET DEBUG_SYNC = 'clone_notify_ddl SIGNAL resume_file';
101 TRUNCATE TABLE t1 ;
102 CALL execute_dml(0, 0, 100, 100, 10, 0);
103 # Flush all dirty pages to track
104 SET GLOBAL innodb_buf_flush_list_now = 1;
105 SET DEBUG_SYNC = 'now SIGNAL resume_file';
106 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_file_ack';
107 SET DEBUG_SYNC = 'now SIGNAL resume_file_ack';
108 TRUNCATE TABLE t11 ;
109 INSERT INTO t11 SELECT * FROM t;
110 SET DEBUG_SYNC = 'now SIGNAL resume_file_meta';
111 # Waiting for clone to reach 'page copy'
112 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_page';
113 # Wait finished
114 TRUNCATE TABLE t2 ;
115 CALL execute_dml(0, 0, 100, 100, 10, 0);
116 SET DEBUG_SYNC = 'now SIGNAL resume_page';
117 # Waiting for clone to reach 'redo copy'
118 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_redo';
119 # Wait finished
120 TRUNCATE TABLE t21 ;
121 INSERT INTO t21 SELECT * FROM t;
122 TRUNCATE TABLE t3 ;
123 SET DEBUG_SYNC = 'now SIGNAL resume_redo';
124 # In connection DEFAULT
125 # Waiting for clone to complete
126 # Wait finished
127 SET GLOBAL DEBUG = '-d,remote_release_clone_file_pin';
128 # Restart server on cloned data directory
129 # restart: --datadir=CLONE_DATADIR
130 # Check cloned data
131 SHOW TABLES;
132 Tables_in_test
133 t
134 t0
135 t01
136 t1
137 t11
138 t2
139 t21
140 t3
141 SHOW CREATE TABLE t1;
142 Table Create Table
143 t1 CREATE TABLE `t1` (
144 `col1` int NOT NULL,
145 `col2` int DEFAULT NULL,
146 `col3` varchar(64) DEFAULT NULL,
147 `col4` blob,
148 PRIMARY KEY (`col1`)
149 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
150 CHECK TABLE t1 EXTENDED;
151 Table Op Msg_type Msg_text
152 test.t1 check status OK
153 SELECT count(*) from t1;
154 count(*)
155 100
156 SELECT col1, col2, col3 FROM t1 ORDER BY col1 LIMIT 10;;
157 col1 col2 col3
158 0 1 Clone Test Row - 0
159 1 11 Clone Test Row - 1
160 2 21 Clone Test Row - 2
161 3 31 Clone Test Row - 3
162 4 41 Clone Test Row - 4
163 5 51 Clone Test Row - 5
164 6 61 Clone Test Row - 6
165 7 71 Clone Test Row - 7
166 8 81 Clone Test Row - 8
167 9 91 Clone Test Row - 9
168 SELECT col1, col2, col3 FROM t1 ORDER BY col1 DESC LIMIT 10;;
169 col1 col2 col3
170 99 991 Clone Test Row - 99
171 98 981 Clone Test Row - 98
172 97 971 Clone Test Row - 97
173 96 961 Clone Test Row - 96
174 95 951 Clone Test Row - 95
175 94 941 Clone Test Row - 94
176 93 931 Clone Test Row - 93
177 92 921 Clone Test Row - 92
178 91 911 Clone Test Row - 91
179 90 901 Clone Test Row - 90
180 SHOW CREATE TABLE t11;
181 Table Create Table
182 t11 CREATE TABLE `t11` (
183 `col1` int NOT NULL,
184 `col2` int DEFAULT NULL,
185 `col3` varchar(64) DEFAULT NULL,
186 `col4` blob,
187 PRIMARY KEY (`col1`)
188 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
189 CHECK TABLE t11 EXTENDED;
190 Table Op Msg_type Msg_text
191 test.t11 check status OK
192 SELECT count(*) from t11;
193 count(*)
194 100
195 SELECT col1, col2, col3 FROM t11 ORDER BY col1 LIMIT 10;;
196 col1 col2 col3
197 0 0 Clone Test Row - 0
198 1 10 Clone Test Row - 1
199 2 20 Clone Test Row - 2
200 3 30 Clone Test Row - 3
201 4 40 Clone Test Row - 4
202 5 50 Clone Test Row - 5
203 6 60 Clone Test Row - 6
204 7 70 Clone Test Row - 7
205 8 80 Clone Test Row - 8
206 9 90 Clone Test Row - 9
207 SELECT col1, col2, col3 FROM t11 ORDER BY col1 DESC LIMIT 10;;
208 col1 col2 col3
209 99 990 Clone Test Row - 99
210 98 980 Clone Test Row - 98
211 97 970 Clone Test Row - 97
212 96 960 Clone Test Row - 96
213 95 950 Clone Test Row - 95
214 94 940 Clone Test Row - 94
215 93 930 Clone Test Row - 93
216 92 920 Clone Test Row - 92
217 91 910 Clone Test Row - 91
218 90 900 Clone Test Row - 90
219 SHOW CREATE TABLE t2;
220 Table Create Table
221 t2 CREATE TABLE `t2` (
222 `col1` int NOT NULL,
223 `col2` int DEFAULT NULL,
224 `col3` varchar(64) DEFAULT NULL,
225 `col4` blob,
226 PRIMARY KEY (`col1`)
227 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
228 /*!50100 PARTITION BY KEY (col1)
229 PARTITIONS 5 */
230 CHECK TABLE t2 EXTENDED;
231 Table Op Msg_type Msg_text
232 test.t2 check status OK
233 SELECT count(*) from t2;
234 count(*)
235 100
236 SELECT col1, col2, col3 FROM t2 ORDER BY col1 LIMIT 10;;
237 col1 col2 col3
238 0 0 Clone Test Row - 0
239 1 10 Clone Test Row - 1
240 2 20 Clone Test Row - 2
241 3 30 Clone Test Row - 3
242 4 40 Clone Test Row - 4
243 5 50 Clone Test Row - 5
244 6 60 Clone Test Row - 6
245 7 70 Clone Test Row - 7
246 8 80 Clone Test Row - 8
247 9 90 Clone Test Row - 9
248 SELECT col1, col2, col3 FROM t2 ORDER BY col1 DESC LIMIT 10;;
249 col1 col2 col3
250 99 990 Clone Test Row - 99
251 98 980 Clone Test Row - 98
252 97 970 Clone Test Row - 97
253 96 960 Clone Test Row - 96
254 95 950 Clone Test Row - 95
255 94 940 Clone Test Row - 94
256 93 930 Clone Test Row - 93
257 92 920 Clone Test Row - 92
258 91 910 Clone Test Row - 91
259 90 900 Clone Test Row - 90
260 call execute_dml(1, 0, 100, 100, 10, 0);
261 # Restart server back on base data directory
262 # restart:
263 SET DEBUG_SYNC = 'RESET';
264 # Cleanup
265 DROP TABLE t;
266 DROP TABLE t1;
267 DROP TABLE t2;
268 DROP PROCEDURE execute_dml;
269 DROP TABLE t0;
270 DROP TABLE t01;
271 DROP TABLE t3;
272 DROP TABLE t11;
273 DROP TABLE t21;
274 # Uninstall clone
275 UNINSTALL PLUGIN clone;