Debian Codegraph @

mysql-test/suite/clone/r/remote_ddl_truncate.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. TRUNCATE TABLE while clone in progress
76 SET global debug="+d,clone_send_deleted_block";
77 RESET MASTER;
78 SET GLOBAL DEBUG = '+d,remote_release_clone_file_pin';
79 TRUNCATE TABLE t0 ;
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 TRUNCATE TABLE t01 ;
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 TRUNCATE TABLE t1 ;
101 CALL execute_dml(0, 0, 100, 100, 10, 0);
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 TRUNCATE TABLE t11 ;
108 INSERT INTO t11 SELECT * FROM t;
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 TRUNCATE TABLE t2 ;
114 CALL execute_dml(0, 0, 100, 100, 10, 0);
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 TRUNCATE TABLE t21 ;
120 INSERT INTO t21 SELECT * FROM t;
121 TRUNCATE TABLE t3 ;
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 t0
134 t01
135 t1
136 t11
137 t2
138 t21
139 t3
140 SHOW CREATE TABLE t1;
141 Table Create Table
142 t1 CREATE TABLE `t1` (
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 EXTENDED;
150 Table Op Msg_type Msg_text
151 test.t1 check status OK
152 SELECT count(*) from t1;
153 count(*)
154 100
155 SELECT col1, col2, col3 FROM t1 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 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;
180 Table Create Table
181 t11 CREATE TABLE `t11` (
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 EXTENDED;
189 Table Op Msg_type Msg_text
190 test.t11 check status OK
191 SELECT count(*) from t11;
192 count(*)
193 100
194 SELECT col1, col2, col3 FROM t11 ORDER BY col1 LIMIT 10;;
195 col1 col2 col3
196 0 0 Clone Test Row - 0
197 1 10 Clone Test Row - 1
198 2 20 Clone Test Row - 2
199 3 30 Clone Test Row - 3
200 4 40 Clone Test Row - 4
201 5 50 Clone Test Row - 5
202 6 60 Clone Test Row - 6
203 7 70 Clone Test Row - 7
204 8 80 Clone Test Row - 8
205 9 90 Clone Test Row - 9
206 SELECT col1, col2, col3 FROM t11 ORDER BY col1 DESC LIMIT 10;;
207 col1 col2 col3
208 99 990 Clone Test Row - 99
209 98 980 Clone Test Row - 98
210 97 970 Clone Test Row - 97
211 96 960 Clone Test Row - 96
212 95 950 Clone Test Row - 95
213 94 940 Clone Test Row - 94
214 93 930 Clone Test Row - 93
215 92 920 Clone Test Row - 92
216 91 910 Clone Test Row - 91
217 90 900 Clone Test Row - 90
218 SHOW CREATE TABLE t2;
219 Table Create Table
220 t2 CREATE TABLE `t2` (
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 EXTENDED;
230 Table Op Msg_type Msg_text
231 test.t2 check status OK
232 SELECT count(*) from t2;
233 count(*)
234 100
235 SELECT col1, col2, col3 FROM t2 ORDER BY col1 LIMIT 10;;
236 col1 col2 col3
237 0 0 Clone Test Row - 0
238 1 10 Clone Test Row - 1
239 2 20 Clone Test Row - 2
240 3 30 Clone Test Row - 3
241 4 40 Clone Test Row - 4
242 5 50 Clone Test Row - 5
243 6 60 Clone Test Row - 6
244 7 70 Clone Test Row - 7
245 8 80 Clone Test Row - 8
246 9 90 Clone Test Row - 9
247 SELECT col1, col2, col3 FROM t2 ORDER BY col1 DESC LIMIT 10;;
248 col1 col2 col3
249 99 990 Clone Test Row - 99
250 98 980 Clone Test Row - 98
251 97 970 Clone Test Row - 97
252 96 960 Clone Test Row - 96
253 95 950 Clone Test Row - 95
254 94 940 Clone Test Row - 94
255 93 930 Clone Test Row - 93
256 92 920 Clone Test Row - 92
257 91 910 Clone Test Row - 91
258 90 900 Clone Test Row - 90
259 call execute_dml(1, 0, 100, 100, 10, 0);
260 # Restart server back on base data directory
261 # restart:
262 SET DEBUG_SYNC = 'RESET';
263 # Cleanup
264 DROP TABLE t;
265 DROP TABLE t1;
266 DROP TABLE t2;
267 DROP PROCEDURE execute_dml;
268 DROP TABLE t0;
269 DROP TABLE t01;
270 DROP TABLE t3;
271 DROP TABLE t11;
272 DROP TABLE t21;
273 # Uninstall clone
274 UNINSTALL PLUGIN clone;