Debian Codegraph @

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

raw
1 call mtr.add_suppression("\\[Warning\\] .*MY-\\d+.* \\[Server\\] Found 1 prepared XA transactions");
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, 10, 10, 1, 0);
62 commit;
63 ## Test: Clone with XA transactions
64 # In connection con1 - Start XA prepare
65 XA start 'xa_trx_1';
66 update t1 set col2 = 100;
67 XA end 'xa_trx_1';
68 SET DEBUG_SYNC = 'xa_block_clone SIGNAL start_clone WAIT_FOR resume_xa_1';
69 XA prepare 'xa_trx_1';
70 # In connection default - Start Cloning database
71 SET DEBUG_SYNC = 'now WAIT_FOR start_clone';
72 SET DEBUG_SYNC = 'clone_wait_xa SIGNAL resume_xa_1';
73 SET DEBUG_SYNC = 'clone_block_xa SIGNAL resume_xa_2 WAIT_FOR resume_clone';
74 SET GLOBAL clone_autotune_concurrency = OFF;
75 SET GLOBAL clone_max_concurrency = 8;
76 CLONE LOCAL DATA DIRECTORY = 'CLONE_DATADIR';
77 # In connection con1 - Finish XA prepare, Start XA commit
78 SET DEBUG_SYNC = 'now WAIT_FOR resume_xa_2';
79 SET DEBUG_SYNC = 'xa_wait_clone SIGNAL resume_clone';
80 XA commit 'xa_trx_1';
81 # In connection default - Finish Cloning database
82 # In connection con1 - Finish XA Commit
83 # In connection default
84 SELECT count(*) from t1;
85 count(*)
86 10
87 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1;
88 col1 col2 col3 SUBSTRING(col4, 1000, 32)
89 0 100 Clone Test Row - 0 umn Data Large Column Data Large
90 1 100 Clone Test Row - 1 umn Data Large Column Data Large
91 2 100 Clone Test Row - 2 umn Data Large Column Data Large
92 3 100 Clone Test Row - 3 umn Data Large Column Data Large
93 4 100 Clone Test Row - 4 umn Data Large Column Data Large
94 5 100 Clone Test Row - 5 umn Data Large Column Data Large
95 6 100 Clone Test Row - 6 umn Data Large Column Data Large
96 7 100 Clone Test Row - 7 umn Data Large Column Data Large
97 8 100 Clone Test Row - 8 umn Data Large Column Data Large
98 9 100 Clone Test Row - 9 umn Data Large Column Data Large
99 # Restart cloned database
100 # restart: --datadir=CLONE_DATADIR
101 SHOW CREATE TABLE t1;
102 Table Create Table
103 t1 CREATE TABLE `t1` (
104 `col1` int NOT NULL,
105 `col2` int DEFAULT NULL,
106 `col3` varchar(64) DEFAULT NULL,
107 `col4` blob,
108 PRIMARY KEY (`col1`)
109 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
110 SELECT count(*) from t1;
111 count(*)
112 10
113 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1;
114 col1 col2 col3 SUBSTRING(col4, 1000, 32)
115 0 0 Clone Test Row - 0 umn Data Large Column Data Large
116 1 10 Clone Test Row - 1 umn Data Large Column Data Large
117 2 20 Clone Test Row - 2 umn Data Large Column Data Large
118 3 30 Clone Test Row - 3 umn Data Large Column Data Large
119 4 40 Clone Test Row - 4 umn Data Large Column Data Large
120 5 50 Clone Test Row - 5 umn Data Large Column Data Large
121 6 60 Clone Test Row - 6 umn Data Large Column Data Large
122 7 70 Clone Test Row - 7 umn Data Large Column Data Large
123 8 80 Clone Test Row - 8 umn Data Large Column Data Large
124 9 90 Clone Test Row - 9 umn Data Large Column Data Large
125 XA recover;
126 formatID gtrid_length bqual_length data
127 1 8 0 xa_trx_1
128 XA commit 'xa_trx_1';
129 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1;
130 col1 col2 col3 SUBSTRING(col4, 1000, 32)
131 0 100 Clone Test Row - 0 umn Data Large Column Data Large
132 1 100 Clone Test Row - 1 umn Data Large Column Data Large
133 2 100 Clone Test Row - 2 umn Data Large Column Data Large
134 3 100 Clone Test Row - 3 umn Data Large Column Data Large
135 4 100 Clone Test Row - 4 umn Data Large Column Data Large
136 5 100 Clone Test Row - 5 umn Data Large Column Data Large
137 6 100 Clone Test Row - 6 umn Data Large Column Data Large
138 7 100 Clone Test Row - 7 umn Data Large Column Data Large
139 8 100 Clone Test Row - 8 umn Data Large Column Data Large
140 9 100 Clone Test Row - 9 umn Data Large Column Data Large
141 call execute_dml(3, 0, 1, 1, 1, 0);
142 call execute_dml(0, 0, 10, 10, 1, 0);
143 SELECT count(*) from t1;
144 count(*)
145 10
146 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1;
147 col1 col2 col3 SUBSTRING(col4, 1000, 32)
148 0 0 Clone Test Row - 0 umn Data Large Column Data Large
149 1 10 Clone Test Row - 1 umn Data Large Column Data Large
150 2 20 Clone Test Row - 2 umn Data Large Column Data Large
151 3 30 Clone Test Row - 3 umn Data Large Column Data Large
152 4 40 Clone Test Row - 4 umn Data Large Column Data Large
153 5 50 Clone Test Row - 5 umn Data Large Column Data Large
154 6 60 Clone Test Row - 6 umn Data Large Column Data Large
155 7 70 Clone Test Row - 7 umn Data Large Column Data Large
156 8 80 Clone Test Row - 8 umn Data Large Column Data Large
157 9 90 Clone Test Row - 9 umn Data Large Column Data Large
158 # restart:
159 DROP TABLE t1;
160 DROP TABLE t2;
161 DROP PROCEDURE execute_dml;
162 UNINSTALL PLUGIN clone;
163 SET DEBUG_SYNC = 'RESET';