Debian Codegraph @

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