Debian Codegraph @

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

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