| 1 |
include/rpl_init.inc [topology=1->2] |
| 2 |
connection server_2; |
| 3 |
include/stop_slave.inc |
| 4 |
CHANGE MASTER TO MASTER_USE_GTID=NO; |
| 5 |
include/start_slave.inc |
| 6 |
connection server_1; |
| 7 |
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; |
| 8 |
CREATE FUNCTION extract_gtid(d VARCHAR(100), s VARCHAR(100)) |
| 9 |
RETURNS VARCHAR(100) DETERMINISTIC |
| 10 |
BEGIN |
| 11 |
SET s= CONCAT(",", s, ","); |
| 12 |
SET s= SUBSTR(s FROM LOCATE(CONCAT(",", d, "-"), s) + 1); |
| 13 |
SET s= SUBSTR(s FROM 1 FOR LOCATE(",", s) - 1); |
| 14 |
RETURN s; |
| 15 |
END| |
| 16 |
connection server_2; |
| 17 |
include/stop_slave.inc |
| 18 |
include/start_slave.inc |
| 19 |
START SLAVE UNTIL master_gtid_pos = ""; |
| 20 |
ERROR HY000: Slave is already running |
| 21 |
include/stop_slave_io.inc |
| 22 |
START SLAVE UNTIL master_gtid_pos = ""; |
| 23 |
ERROR HY000: Slave is already running |
| 24 |
START SLAVE IO_THREAD; |
| 25 |
include/wait_for_slave_io_to_start.inc |
| 26 |
include/stop_slave_sql.inc |
| 27 |
START SLAVE UNTIL master_gtid_pos = ""; |
| 28 |
ERROR HY000: Slave is already running |
| 29 |
include/stop_slave_io.inc |
| 30 |
START SLAVE UNTIL master_gtid_pos = ""; |
| 31 |
ERROR HY000: START SLAVE UNTIL master_gtid_pos requires that slave is using GTID |
| 32 |
CHANGE MASTER TO master_use_gtid=slave_pos; |
| 33 |
connection server_1; |
| 34 |
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; |
| 35 |
INSERT INTO t1 VALUES(1); |
| 36 |
INSERT INTO t1 VALUES(2); |
| 37 |
connection server_2; |
| 38 |
START SLAVE UNTIL master_gtid_pos = "0-1-100,1-1-100,2-2-200,1-3-100,4-4-400"; |
| 39 |
ERROR HY000: GTID 1-3-100 and 1-1-100 conflict (duplicate domain id 1) |
| 40 |
START SLAVE UNTIL master_log_file = "master-bin.000001", master_log_pos = 4, master_gtid_pos = ""; |
| 41 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'master_gtid_pos = ""' at line 1 |
| 42 |
START SLAVE IO_THREAD UNTIL master_gtid_pos = ""; |
| 43 |
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL |
| 44 |
START SLAVE SQL_THREAD UNTIL master_gtid_pos = ""; |
| 45 |
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL |
| 46 |
START SLAVE UNTIL master_gtid_pos = '0-1-4'; |
| 47 |
include/wait_for_slave_to_stop.inc |
| 48 |
SELECT * FROM t1; |
| 49 |
a |
| 50 |
1 |
| 51 |
include/start_slave.inc |
| 52 |
connection server_1; |
| 53 |
connection server_2; |
| 54 |
SELECT * FROM t1 ORDER BY a; |
| 55 |
a |
| 56 |
1 |
| 57 |
2 |
| 58 |
include/stop_slave.inc |
| 59 |
START SLAVE UNTIL master_gtid_pos = "1-10-100,2-20-200,0-1-300"; |
| 60 |
include/wait_for_slave_to_start.inc |
| 61 |
Using_Gtid = 'Slave_Pos' |
| 62 |
Until_Condition = 'Gtid' |
| 63 |
connection server_1; |
| 64 |
INSERT INTO t1 VALUES (3); |
| 65 |
DELETE FROM t1 WHERE a=3; |
| 66 |
connection server_2; |
| 67 |
include/stop_slave.inc |
| 68 |
*** Test UNTIL condition in an earlier binlog than the start GTID. *** |
| 69 |
connection server_2; |
| 70 |
connection server_1; |
| 71 |
SET gtid_domain_id = 1; |
| 72 |
INSERT INTO t1 VALUES (3); |
| 73 |
SET gtid_domain_id = 2; |
| 74 |
CREATE TABLE t2 (a INT); |
| 75 |
INSERT INTO t2 VALUES (3); |
| 76 |
FLUSH LOGS; |
| 77 |
SET gtid_domain_id = 1; |
| 78 |
INSERT INTO t1 VALUES (4); |
| 79 |
SET gtid_domain_id = 2; |
| 80 |
INSERT INTO t2 VALUES (4); |
| 81 |
FLUSH LOGS; |
| 82 |
SET gtid_domain_id = 1; |
| 83 |
INSERT INTO t1 VALUES (5); |
| 84 |
SET gtid_domain_id = 2; |
| 85 |
INSERT INTO t2 VALUES (5); |
| 86 |
FLUSH LOGS; |
| 87 |
SET gtid_domain_id = 1; |
| 88 |
INSERT INTO t1 VALUES (6); |
| 89 |
SET gtid_domain_id = 2; |
| 90 |
INSERT INTO t2 VALUES (6); |
| 91 |
SET gtid_domain_id = 0; |
| 92 |
show binary logs; |
| 93 |
Log_name File_size |
| 94 |
master-bin.000001 # |
| 95 |
master-bin.000002 # |
| 96 |
master-bin.000003 # |
| 97 |
master-bin.000004 # |
| 98 |
connection server_2; |
| 99 |
START SLAVE UNTIL master_gtid_pos='1-1-3,2-1-4'; |
| 100 |
include/wait_for_slave_to_stop.inc |
| 101 |
SELECT * FROM t1 ORDER BY a; |
| 102 |
a |
| 103 |
1 |
| 104 |
2 |
| 105 |
3 |
| 106 |
4 |
| 107 |
5 |
| 108 |
SELECT * FROM t2 ORDER BY a; |
| 109 |
a |
| 110 |
3 |
| 111 |
4 |
| 112 |
5 |
| 113 |
START SLAVE UNTIL master_gtid_pos='1-1-4,2-1-2'; |
| 114 |
include/wait_for_slave_to_stop.inc |
| 115 |
SELECT * FROM t1 ORDER BY a; |
| 116 |
a |
| 117 |
1 |
| 118 |
2 |
| 119 |
3 |
| 120 |
4 |
| 121 |
5 |
| 122 |
6 |
| 123 |
SELECT * FROM t2 ORDER BY a; |
| 124 |
a |
| 125 |
3 |
| 126 |
4 |
| 127 |
5 |
| 128 |
START SLAVE UNTIL master_gtid_pos='1-1-3'; |
| 129 |
include/wait_for_slave_to_stop.inc |
| 130 |
SELECT * FROM t1 ORDER BY a; |
| 131 |
a |
| 132 |
1 |
| 133 |
2 |
| 134 |
3 |
| 135 |
4 |
| 136 |
5 |
| 137 |
6 |
| 138 |
SELECT * FROM t2 ORDER BY a; |
| 139 |
a |
| 140 |
3 |
| 141 |
4 |
| 142 |
5 |
| 143 |
include/start_slave.inc |
| 144 |
SELECT * FROM t1 ORDER BY a; |
| 145 |
a |
| 146 |
1 |
| 147 |
2 |
| 148 |
3 |
| 149 |
4 |
| 150 |
5 |
| 151 |
6 |
| 152 |
SELECT * FROM t2 ORDER BY a; |
| 153 |
a |
| 154 |
3 |
| 155 |
4 |
| 156 |
5 |
| 157 |
6 |
| 158 |
*** Test when the UNTIL position is right at the end of the binlog file prior to the starting position *** |
| 159 |
connection server_2; |
| 160 |
include/stop_slave.inc |
| 161 |
connection server_1; |
| 162 |
FLUSH LOGS; |
| 163 |
SET gtid_domain_id = 1; |
| 164 |
INSERT INTO t1 VALUES (7); |
| 165 |
SET gtid_domain_id = 0; |
| 166 |
connection server_2; |
| 167 |
START SLAVE UNTIL master_gtid_pos='1-1-4'; |
| 168 |
include/wait_for_slave_to_stop.inc |
| 169 |
SELECT * FROM t1 ORDER BY a; |
| 170 |
a |
| 171 |
1 |
| 172 |
2 |
| 173 |
3 |
| 174 |
4 |
| 175 |
5 |
| 176 |
6 |
| 177 |
include/start_slave.inc |
| 178 |
SELECT * FROM t1 ORDER BY a; |
| 179 |
a |
| 180 |
1 |
| 181 |
2 |
| 182 |
3 |
| 183 |
4 |
| 184 |
5 |
| 185 |
6 |
| 186 |
7 |
| 187 |
*** Test when UNTIL condition is after a stand-alone event (not a transaction). *** |
| 188 |
connection server_2; |
| 189 |
include/stop_slave.inc |
| 190 |
connection server_1; |
| 191 |
CREATE TABLE t3 (a INT); |
| 192 |
DROP TABLE t3; |
| 193 |
connection server_2; |
| 194 |
START SLAVE UNTIL master_gtid_pos='UNTIL_CONDITION'; |
| 195 |
include/wait_for_slave_to_stop.inc |
| 196 |
SHOW CREATE TABLE t3; |
| 197 |
Table Create Table |
| 198 |
t3 CREATE TABLE `t3` ( |
| 199 |
`a` int(11) DEFAULT NULL |
| 200 |
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci |
| 201 |
include/start_slave.inc |
| 202 |
*** Test UNTIL condition that has not yet been logged. *** |
| 203 |
connection server_2; |
| 204 |
include/stop_slave.inc |
| 205 |
RESET SLAVE ALL; |
| 206 |
RESET MASTER; |
| 207 |
SET GLOBAL gtid_slave_pos=''; |
| 208 |
connection server_1; |
| 209 |
RESET MASTER; |
| 210 |
INSERT INTO t1 VALUES (10); |
| 211 |
INSERT INTO t1 VALUES (11); |
| 212 |
INSERT INTO t1 VALUES (12); |
| 213 |
DELETE FROM t1 WHERE a >= 10; |
| 214 |
RESET MASTER; |
| 215 |
INSERT INTO t1 VALUES (10); |
| 216 |
connection server_2; |
| 217 |
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_1, |
| 218 |
master_user = "root", master_use_gtid = slave_pos; |
| 219 |
START SLAVE UNTIL master_gtid_pos = '0-1-2'; |
| 220 |
include/wait_for_slave_to_start.inc |
| 221 |
connection server_1; |
| 222 |
INSERT INTO t1 VALUES (11); |
| 223 |
INSERT INTO t1 VALUES (12); |
| 224 |
connection server_2; |
| 225 |
include/wait_for_slave_to_stop.inc |
| 226 |
SELECT * FROM t1 ORDER BY a; |
| 227 |
a |
| 228 |
1 |
| 229 |
2 |
| 230 |
3 |
| 231 |
4 |
| 232 |
5 |
| 233 |
6 |
| 234 |
7 |
| 235 |
10 |
| 236 |
11 |
| 237 |
include/start_slave.inc |
| 238 |
SELECT * FROM t1 ORDER BY a; |
| 239 |
a |
| 240 |
1 |
| 241 |
2 |
| 242 |
3 |
| 243 |
4 |
| 244 |
5 |
| 245 |
6 |
| 246 |
7 |
| 247 |
10 |
| 248 |
11 |
| 249 |
12 |
| 250 |
connection server_1; |
| 251 |
DROP TABLE t1; |
| 252 |
DROP TABLE t2; |
| 253 |
DROP FUNCTION extract_gtid; |
| 254 |
include/rpl_end.inc |