| 1 |
--source include/have_innodb.inc |
| 2 |
--source include/have_debug.inc |
| 3 |
--source include/have_debug_sync.inc |
| 4 |
--source include/master-slave.inc |
| 5 |
# Format is restricted because the test expects a specific result of |
| 6 |
# relay-logging that splits a transaction into two different files. |
| 7 |
--source include/have_binlog_format_row.inc |
| 8 |
|
| 9 |
# |
| 10 |
# MDEV-15152 Optimistic parallel slave doesn't cope well with START SLAVE UNTIL |
| 11 |
# |
| 12 |
--connection slave |
| 13 |
--source include/stop_slave.inc |
| 14 |
RESET MASTER; |
| 15 |
RESET SLAVE; |
| 16 |
|
| 17 |
--connection master |
| 18 |
RESET MASTER; |
| 19 |
CREATE TABLE t1 (a int primary key, b text) ENGINE=InnoDB; |
| 20 |
--let $a0 = 25 |
| 21 |
--eval INSERT INTO t1 SET a=$a0, b='trx0' |
| 22 |
# Memorize the position for replication restart from it |
| 23 |
--let $pos_trx0 = query_get_value(SHOW MASTER STATUS, Position, 1) |
| 24 |
|
| 25 |
--connection slave |
| 26 |
--source include/start_slave.inc |
| 27 |
|
| 28 |
--connection master |
| 29 |
# --connection slave |
| 30 |
--sync_slave_with_master |
| 31 |
--source include/stop_slave.inc |
| 32 |
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; |
| 33 |
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; |
| 34 |
SET GLOBAL slave_parallel_threads=2; |
| 35 |
SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode; |
| 36 |
SET GLOBAL slave_parallel_mode='optimistic'; |
| 37 |
|
| 38 |
# Run the slave in the following modes one by one. |
| 39 |
# |
| 40 |
# 1. the until position is set in the middle of trx2 |
| 41 |
# below $pos_trx0 of the last exec position in the first file |
| 42 |
# 2. and above $pos_trx0 |
| 43 |
# In either case trx2 must commit before slave stops. |
| 44 |
# 3. the until postion is inside trx1 |
| 45 |
# 4. RELAY log until inside trx1 |
| 46 |
# 5. RELAY log until inside a "big" trx |
| 47 |
# 6. RELAY log until inside a trx within a sequence of relay logs |
| 48 |
# |
| 49 |
# Execution flaw for Until_Master_Pos cases follows as: |
| 50 |
# create the transaction trx1, trx2 |
| 51 |
# logged at the beginning of two subsequent binlog files. |
| 52 |
# Set the until position to at the middle of the 2rd transaction. |
| 53 |
# Engage the optimistic scheduler while having trx1 execution blocked. |
| 54 |
# Lift the block after trx2 has reached waiting its order to commit. |
| 55 |
# *Proof 1* |
| 56 |
# Observe that the slave applier stops at a correct position. |
| 57 |
# In the bug condition it would stop prematurely having the stop position |
| 58 |
# in the first file, therefore trx2 not committed. |
| 59 |
# Specifically, an internal transaction position until makes the applier to run |
| 60 |
# beyond it to commit commit the current transaction. |
| 61 |
# *Proof 2* |
| 62 |
# Observe the following START SLAVE resumes OK. |
| 63 |
# |
| 64 |
# Auxiliary third trx3 on master is just for triggering the actual stop |
| 65 |
# (whihc is a legacy UNTIL's property). |
| 66 |
# trx0 is to produce a specific value of the last executed binlog file:pos |
| 67 |
# to emulate the bug condition. |
| 68 |
# |
| 69 |
# Intermediate checks via SELECT are supposed to succeed |
| 70 |
# with putting out value 1. |
| 71 |
# |
| 72 |
# NOTE: Relay log until tests have to use explicit log names and position |
| 73 |
# which may require to adjust with future changes to event formats etc. |
| 74 |
# |
| 75 |
|
| 76 |
--connection slave |
| 77 |
SET @old_max_relay_log_size = @@global.max_relay_log_size; |
| 78 |
SET @@global.max_relay_log_size=4096; |
| 79 |
|
| 80 |
--connection master |
| 81 |
# trx1 |
| 82 |
--let $a=1 |
| 83 |
BEGIN; |
| 84 |
while (`SELECT $a < $a0`) |
| 85 |
{ |
| 86 |
--eval INSERT INTO t1 SET a=$a, b='trx1' |
| 87 |
--inc $a |
| 88 |
} |
| 89 |
COMMIT; |
| 90 |
--let $fil_1 = query_get_value(SHOW MASTER STATUS, File, 1) |
| 91 |
--let $pos_trx1 = query_get_value(SHOW MASTER STATUS, Position, 1) |
| 92 |
|
| 93 |
FLUSH LOGS; |
| 94 |
|
| 95 |
# $pos_0 the offset of the first event of trx2 in new file |
| 96 |
--let $pos_0=query_get_value(SHOW MASTER STATUS, Position, 1) |
| 97 |
# trx2 |
| 98 |
--let $a=$a0 |
| 99 |
BEGIN; |
| 100 |
--eval UPDATE t1 SET b='trx2_0' WHERE a = $a |
| 101 |
--eval UPDATE t1 SET b='trx2' WHERE a = $a |
| 102 |
COMMIT; |
| 103 |
--let $fil_2=query_get_value(SHOW MASTER STATUS, File, 1) |
| 104 |
--let $pos_trx2=query_get_value(SHOW MASTER STATUS, Position, 1) |
| 105 |
|
| 106 |
# trx3 |
| 107 |
--let $a=$a0 |
| 108 |
--inc $a |
| 109 |
--eval INSERT INTO t1 SET a=$a,b='trx3' |
| 110 |
--let $pos_trx3=query_get_value(SHOW MASTER STATUS, Position, 1) |
| 111 |
--let $a= |
| 112 |
|
| 113 |
|
| 114 |
--echo *** case 1 UNTIL inside trx2 |
| 115 |
|
| 116 |
--connection slave1 |
| 117 |
# Blocker to hold off EXEC_MASTER_LOG_POS advance |
| 118 |
BEGIN; |
| 119 |
--eval INSERT INTO t1 SET a= 1 |
| 120 |
--connection slave |
| 121 |
--let $pos_until=`SELECT $pos_trx0 - 1` |
| 122 |
--replace_result $pos_0 <pos_0> $pos_until <pos_until> $pos_trx2 <pos_trx2> |
| 123 |
--eval SELECT $pos_0 <= $pos_until AND $pos_until < $pos_trx2 as "pos_until < trx0 and is within trx2" |
| 124 |
CHANGE MASTER TO MASTER_USE_GTID=no; |
| 125 |
--replace_result $fil_2 file_2 $pos_until <pos_until> |
| 126 |
--eval START SLAVE UNTIL MASTER_LOG_FILE = '$fil_2', MASTER_LOG_POS = $pos_until |
| 127 |
|
| 128 |
--let $wait_condition= SELECT COUNT(*) > 0 FROM information_schema.processlist WHERE state = "Waiting for prior transaction to commit" |
| 129 |
--source include/wait_condition.inc |
| 130 |
|
| 131 |
--connection slave1 |
| 132 |
# unblock to see the slave applier stops at $until |
| 133 |
ROLLBACK; |
| 134 |
|
| 135 |
--echo Proof 1: Correct stop |
| 136 |
--connection slave |
| 137 |
--source include/wait_for_slave_sql_to_stop.inc |
| 138 |
--let $file_stop= query_get_value(SHOW SLAVE STATUS, Relay_Master_Log_File, 1) |
| 139 |
--let $pos_stop= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1) |
| 140 |
if (`SELECT "$file_stop" != "$fil_2" OR $pos_stop < $pos_until`) |
| 141 |
{ |
| 142 |
--echo *** ERROR: Slave stopped at $file_stop:$pos_stop which is not $fil_2:$pos_until. |
| 143 |
--die |
| 144 |
} |
| 145 |
--eval SELECT count(*) = 1 as 'trx2 is committed' FROM t1 WHERE b = 'trx2' |
| 146 |
--eval SELECT count(*) = 0 as 'trx3 is not committed' FROM t1 WHERE b = 'trx3' |
| 147 |
|
| 148 |
--echo Proof 2: Resume works out |
| 149 |
--source include/start_slave.inc |
| 150 |
--connection master |
| 151 |
--sync_slave_with_master |
| 152 |
|
| 153 |
|
| 154 |
--echo *** case 2 UNTIL inside trx2 |
| 155 |
|
| 156 |
--connection slave |
| 157 |
--eval DELETE FROM t1 WHERE a <> $a0 |
| 158 |
--eval UPDATE t1 SET b='trx0' WHERE a = $a0 |
| 159 |
|
| 160 |
--connection slave1 |
| 161 |
# Blocker to hold off EXEC_MASTER_LOG_POS advance |
| 162 |
BEGIN; |
| 163 |
--eval INSERT INTO t1 SET a= 1 |
| 164 |
|
| 165 |
--connection slave |
| 166 |
--source include/stop_slave.inc |
| 167 |
|
| 168 |
--let $pos_until=`SELECT $pos_trx2 - 1` |
| 169 |
--replace_result $pos_trx0 <pos_0> $pos_until <pos_until> $pos_trx2 <pos_trx2> |
| 170 |
--eval SELECT $pos_trx0 <= $pos_until AND $pos_until < $pos_trx2 as "pos_until >= trx0 and is within trx2" |
| 171 |
--replace_result $fil_1 file_1 $pos_trx0 <pos_trx0> |
| 172 |
--eval CHANGE MASTER TO MASTER_LOG_FILE = '$fil_1', MASTER_LOG_POS = $pos_trx0, MASTER_USE_GTID=no |
| 173 |
--replace_result $fil_2 file_2 $pos_until <pos_until> |
| 174 |
--eval START SLAVE UNTIL MASTER_LOG_FILE = '$fil_2', MASTER_LOG_POS = $pos_until |
| 175 |
|
| 176 |
--let $wait_condition= SELECT COUNT(*) > 0 FROM information_schema.processlist WHERE state = "Waiting for prior transaction to commit" |
| 177 |
--source include/wait_condition.inc |
| 178 |
|
| 179 |
--connection slave1 |
| 180 |
# unblock to see the slave applier stops at $until |
| 181 |
ROLLBACK; |
| 182 |
|
| 183 |
--echo Proof 1: Correct stop |
| 184 |
--connection slave |
| 185 |
--source include/wait_for_slave_sql_to_stop.inc |
| 186 |
--let $file_stop= query_get_value(SHOW SLAVE STATUS, Relay_Master_Log_File, 1) |
| 187 |
--let $pos_stop= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1) |
| 188 |
if (`SELECT "$file_stop" != "$fil_2" OR $pos_stop < $pos_until`) |
| 189 |
{ |
| 190 |
--echo *** ERROR: Slave stopped at $file_stop:$pos_stop which is not $fil_2:$pos_until. |
| 191 |
--die |
| 192 |
} |
| 193 |
--eval SELECT count(*) = 1 as 'trx2 is committed' FROM t1 WHERE b = 'trx2' |
| 194 |
--eval SELECT count(*) = 0 as 'trx3 is not committed' FROM t1 WHERE b = 'trx3' |
| 195 |
|
| 196 |
--echo Proof 2: Resume works out |
| 197 |
--source include/start_slave.inc |
| 198 |
--connection master |
| 199 |
--sync_slave_with_master |
| 200 |
|
| 201 |
|
| 202 |
--echo *** case 3 UNTIL inside trx1 |
| 203 |
|
| 204 |
--connection slave |
| 205 |
--eval DELETE FROM t1 WHERE a <> $a0 |
| 206 |
--eval UPDATE t1 SET b='trx0' WHERE a = $a0 |
| 207 |
|
| 208 |
|
| 209 |
--connection slave1 |
| 210 |
# Blocker to hold off EXEC_MASTER_LOG_POS advance |
| 211 |
BEGIN; |
| 212 |
--eval INSERT INTO t1 SET a= 1; # block trx1 |
| 213 |
|
| 214 |
--connection slave |
| 215 |
--source include/stop_slave.inc |
| 216 |
|
| 217 |
--let $pos_until=`SELECT $pos_0 - 1` |
| 218 |
--replace_result $pos_0 <pos_0> $pos_until <pos_until> $pos_trx2 <pos_trx2> |
| 219 |
--eval SELECT $pos_until < $pos_0 as "pos_until before trx2 start position" |
| 220 |
--replace_result $fil_1 file_1 $pos_trx0 <pos_trx0> |
| 221 |
--eval CHANGE MASTER TO MASTER_LOG_FILE = '$fil_1', MASTER_LOG_POS = $pos_trx0, MASTER_USE_GTID=no |
| 222 |
--replace_result $fil_2 file_2 $pos_until <pos_until> |
| 223 |
--eval START SLAVE UNTIL MASTER_LOG_FILE = '$fil_2', MASTER_LOG_POS = $pos_until |
| 224 |
|
| 225 |
--connection slave1 |
| 226 |
# unblock to see the slave applier stops at $until |
| 227 |
ROLLBACK; |
| 228 |
|
| 229 |
--echo Proof 1: Correct stop |
| 230 |
--connection slave |
| 231 |
--source include/wait_for_slave_sql_to_stop.inc |
| 232 |
--let $file_stop= query_get_value(SHOW SLAVE STATUS, Relay_Master_Log_File, 1) |
| 233 |
--let $pos_stop= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1) |
| 234 |
if (`SELECT "$file_stop" != "$fil_2" OR $pos_stop < $pos_until`) |
| 235 |
{ |
| 236 |
--echo *** ERROR: Slave stopped at $file_stop:$pos_stop which is not $fil_2:$pos_until. |
| 237 |
--die |
| 238 |
} |
| 239 |
--eval SELECT count(*) = $a0-1 as 'trx1 is committed' FROM t1 WHERE b = 'trx1' |
| 240 |
--eval SELECT count(*) = 0 as 'trx2 is not committed' FROM t1 WHERE b = 'trx2' |
| 241 |
|
| 242 |
--echo Proof 2: Resume works out |
| 243 |
--source include/start_slave.inc |
| 244 |
--connection master |
| 245 |
--sync_slave_with_master |
| 246 |
|
| 247 |
|
| 248 |
--echo *** case 4 Relay-log UNTIL inside trx1 |
| 249 |
|
| 250 |
--connection slave |
| 251 |
--eval DELETE FROM t1 WHERE a <> $a0 |
| 252 |
--eval UPDATE t1 SET b='trx0' WHERE a = $a0 |
| 253 |
|
| 254 |
--connection slave1 |
| 255 |
# Blocker to hold off EXEC_MASTER_LOG_POS advance |
| 256 |
BEGIN; |
| 257 |
--eval INSERT INTO t1 SET a= 1; # block trx1 |
| 258 |
|
| 259 |
--connection slave |
| 260 |
--source include/stop_slave.inc |
| 261 |
--replace_result $fil_1 file_1 $pos_trx0 <pos_trx0> |
| 262 |
--eval CHANGE MASTER TO MASTER_LOG_FILE = '$fil_1', MASTER_LOG_POS = $pos_trx0, MASTER_USE_GTID=no |
| 263 |
START SLAVE IO_THREAD; |
| 264 |
--source include/wait_for_slave_io_to_start.inc |
| 265 |
|
| 266 |
# The following test sets the stop coordinate to inside the first event |
| 267 |
# of a relay log that holds events of a transaction started in an earlier log. |
| 268 |
# Peek the stop position in the middle of trx1, not even on a event boundary. |
| 269 |
--let $pos_until=255 |
| 270 |
--let $file_rl=slave-relay-bin.000003 |
| 271 |
--let $binlog_file=$file_rl |
| 272 |
|
| 273 |
# Wait for the IO thread to write the trx1 to the relaylog before querying it. |
| 274 |
# (wait_for_slave_param.inc isn't flexible enough, so do it manually.) |
| 275 |
--let $continue= 1 |
| 276 |
--let $count=600 |
| 277 |
while ($continue) |
| 278 |
{ |
| 279 |
--let $cur_file= query_get_value(SHOW SLAVE STATUS, 'Master_Log_File', 1) |
| 280 |
--let $cur_pos= query_get_value(SHOW SLAVE STATUS, 'Read_Master_Log_Pos', 1) |
| 281 |
--let $continue= `SELECT '$cur_file' = '$fil_1' AND $cur_pos < $pos_trx1` |
| 282 |
if ($continue) |
| 283 |
{ |
| 284 |
--dec $count |
| 285 |
if (!$count) |
| 286 |
{ |
| 287 |
--echo **** ERROR: timeout waiting for Read_Master_Log_Pos($cur_pos) >= $pos_trx1 (file='$cur_file') ****" |
| 288 |
--die Timeout waiting for IO thread to write master events to the relaylog |
| 289 |
} |
| 290 |
--sleep 0.1 |
| 291 |
} |
| 292 |
} |
| 293 |
|
| 294 |
--let $pos_xid=508 |
| 295 |
--let $info= query_get_value(SHOW RELAYLOG EVENTS IN '$file_rl' FROM $pos_xid LIMIT 1, Info, 1) |
| 296 |
|
| 297 |
if (`SELECT "$info" NOT LIKE "COMMIT /* xid=% */" OR $pos_xid < $pos_until`) |
| 298 |
{ |
| 299 |
--echo *** Unexpected offset. Refine it to point to the correct XID event! |
| 300 |
--die |
| 301 |
} |
| 302 |
|
| 303 |
--replace_result $file_rl file_2 $pos_until <pos_until> |
| 304 |
--eval START SLAVE UNTIL RELAY_LOG_FILE = '$file_rl', RELAY_LOG_POS = $pos_until |
| 305 |
|
| 306 |
--connection slave1 |
| 307 |
# unblock to see the slave applier stops at $until |
| 308 |
ROLLBACK; |
| 309 |
|
| 310 |
--echo Proof 1: Correct stop |
| 311 |
--connection slave |
| 312 |
--source include/wait_for_slave_sql_to_stop.inc |
| 313 |
--let $file_stop= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1) |
| 314 |
--let $pos_stop= query_get_value(SHOW SLAVE STATUS, Relay_Log_Pos, 1) |
| 315 |
if (`SELECT strcmp("$file_rl","$file_stop") > -1`) |
| 316 |
{ |
| 317 |
--echo *** ERROR: Slave stopped at $file_stop:$pos_stop which is not $file_rl:$pos_until. |
| 318 |
--die |
| 319 |
} |
| 320 |
|
| 321 |
--eval SELECT count(*) = $a0-1 as 'trx1 is committed' FROM t1 WHERE b = 'trx1' |
| 322 |
--eval SELECT count(*) = 0 as 'trx2 is not committed' FROM t1 WHERE b = 'trx2' |
| 323 |
|
| 324 |
--echo Proof 2: Resume works out |
| 325 |
--source include/start_slave.inc |
| 326 |
--connection master |
| 327 |
--sync_slave_with_master |
| 328 |
|
| 329 |
|
| 330 |
|
| 331 |
--echo *** case 5 Relay-log UNTIL inside a "big" trx that spawns few relay logs |
| 332 |
|
| 333 |
--connection master |
| 334 |
CREATE TABLE t2 (a TEXT) ENGINE=InnoDB; |
| 335 |
FLUSH LOGS; |
| 336 |
|
| 337 |
--sync_slave_with_master |
| 338 |
--let $file_stop= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1) |
| 339 |
--let $pos_stop= query_get_value(SHOW SLAVE STATUS, Relay_Log_Pos, 1) |
| 340 |
--let $records=`SELECT floor(4*@@global.max_relay_log_size / 1024) + 1` |
| 341 |
|
| 342 |
--connection slave |
| 343 |
--source include/stop_slave.inc |
| 344 |
|
| 345 |
--connection master |
| 346 |
# trx4 |
| 347 |
BEGIN; |
| 348 |
--let $i=$records |
| 349 |
while ($i) |
| 350 |
{ |
| 351 |
INSERT INTO t2 SET a=repeat('a',1024); |
| 352 |
|
| 353 |
--dec $i |
| 354 |
} |
| 355 |
COMMIT; |
| 356 |
|
| 357 |
# slave will stop there: |
| 358 |
--let $file_trx4 = query_get_value(SHOW MASTER STATUS, File, 1) |
| 359 |
--let $pos_trx4 = query_get_value(SHOW MASTER STATUS, Position, 1) |
| 360 |
|
| 361 |
# trx5 |
| 362 |
INSERT INTO t2 SET a='a'; |
| 363 |
--let $pos_trx5 = query_get_value(SHOW MASTER STATUS, Position, 1) |
| 364 |
|
| 365 |
--connection slave |
| 366 |
START SLAVE IO_THREAD; |
| 367 |
--source include/wait_for_slave_io_to_start.inc |
| 368 |
|
| 369 |
# Set position inside the transaction though the value |
| 370 |
# specified is beyond that relay log file. |
| 371 |
# The coordianate may point to in a different event in future changes |
| 372 |
# but should not move away from inside this big group of events. |
| 373 |
# So we don't test which event in the transaction it points to. |
| 374 |
--let $pos_until= 4500 |
| 375 |
--let $file_rl= slave-relay-bin.000010 |
| 376 |
|
| 377 |
--replace_result $file_rl file_2 $pos_until <pos_until> |
| 378 |
--eval START SLAVE UNTIL RELAY_LOG_FILE = '$file_rl', RELAY_LOG_POS = $pos_until |
| 379 |
|
| 380 |
--echo Proof 1: Correct stop |
| 381 |
--connection slave |
| 382 |
--source include/wait_for_slave_sql_to_stop.inc |
| 383 |
--let $file_stop= query_get_value(SHOW SLAVE STATUS, Relay_Master_Log_File, 1) |
| 384 |
--let $pos_stop= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1) |
| 385 |
# It's showed the actual stop occurred before trx5 |
| 386 |
if (`SELECT strcmp("$file_trx4", "$file_stop") <> 0 OR $pos_stop >= $pos_trx5 OR count(*) <> $records FROM t2`) |
| 387 |
{ |
| 388 |
--echo *** ERROR: Slave stopped at *binlog* $file_stop:$pos_stop which is not $file_trx4:$pos_trx4. |
| 389 |
--die |
| 390 |
} |
| 391 |
|
| 392 |
--echo Proof 2: Resume works out |
| 393 |
--source include/start_slave.inc |
| 394 |
--connection master |
| 395 |
--sync_slave_with_master |
| 396 |
|
| 397 |
--let $diff_tables=master:t2,slave:t2 |
| 398 |
--source include/diff_tables.inc |
| 399 |
|
| 400 |
|
| 401 |
|
| 402 |
--echo *** case 6 Relay-log UNTIL inside a small trx inside a sequence of relay logs |
| 403 |
|
| 404 |
--connection slave |
| 405 |
--source include/stop_slave.inc |
| 406 |
|
| 407 |
--connection master |
| 408 |
# trx6 |
| 409 |
--let $records=`SELECT count(*) FROM t2` |
| 410 |
while ($records) |
| 411 |
{ |
| 412 |
BEGIN; |
| 413 |
DELETE FROM t2 LIMIT 1; |
| 414 |
COMMIT; |
| 415 |
--dec $records |
| 416 |
} |
| 417 |
COMMIT; |
| 418 |
|
| 419 |
--connection slave |
| 420 |
START SLAVE IO_THREAD; |
| 421 |
--source include/wait_for_slave_io_to_start.inc |
| 422 |
|
| 423 |
--connection master |
| 424 |
--source include/sync_slave_io_with_master.inc |
| 425 |
|
| 426 |
--connection slave |
| 427 |
# The relay-log coordinate is not at an event boundary and |
| 428 |
# also may change across the server version. |
| 429 |
# The test makes its best to check its coherance. |
| 430 |
--let $pos_until= 3130 |
| 431 |
--let $file_rl= slave-relay-bin.000018 |
| 432 |
|
| 433 |
--let $pos_gtid = 2987 |
| 434 |
--let $info= query_get_value(SHOW RELAYLOG EVENTS IN '$file_rl' FROM $pos_gtid LIMIT 1, Info, 1) |
| 435 |
|
| 436 |
if (`SELECT "$info" != "BEGIN GTID 0-1-23"`) |
| 437 |
{ |
| 438 |
--echo *** Unexpected offset. Refine it to point to the correct GTID! |
| 439 |
--die |
| 440 |
} |
| 441 |
--let $pos_event = 3120 |
| 442 |
--let $type= query_get_value(SHOW RELAYLOG EVENTS IN '$file_rl' FROM $pos_event LIMIT 1, Event_type, 1) |
| 443 |
if (`SELECT "$type" != "Delete_rows_v1"`) |
| 444 |
{ |
| 445 |
--echo *** Unexpected offset. Refine it to point to the expected event! |
| 446 |
--die |
| 447 |
} |
| 448 |
|
| 449 |
--replace_result $file_rl file_2 $pos_until <pos_until> |
| 450 |
--eval START SLAVE UNTIL RELAY_LOG_FILE = '$file_rl', RELAY_LOG_POS = $pos_until |
| 451 |
|
| 452 |
--echo Proof 1: Correct stop |
| 453 |
--connection slave |
| 454 |
--source include/wait_for_slave_sql_to_stop.inc |
| 455 |
--let $file_stop= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1) |
| 456 |
--let $pos_stop= query_get_value(SHOW SLAVE STATUS, Relay_Log_Pos, 1) |
| 457 |
if (`SELECT strcmp("$file_stop", "$file_rl") = -1 OR |
| 458 |
strcmp("$file_stop", "$file_rl") = 0 AND $pos_stop < $pos_until`) |
| 459 |
{ |
| 460 |
--echo *** ERROR: Slave stopped at *relay* $file_stop:$pos_stop which is not $file_rl:$pos_until. |
| 461 |
--die |
| 462 |
} |
| 463 |
|
| 464 |
--echo Proof 2: Resume works out |
| 465 |
--source include/start_slave.inc |
| 466 |
--connection master |
| 467 |
--sync_slave_with_master |
| 468 |
|
| 469 |
--let $diff_tables=master:t2,slave:t2 |
| 470 |
--source include/diff_tables.inc |
| 471 |
|
| 472 |
# |
| 473 |
# Clean up. |
| 474 |
# |
| 475 |
--connection slave |
| 476 |
--source include/stop_slave.inc |
| 477 |
SET GLOBAL max_relay_log_size=@old_max_relay_log_size; |
| 478 |
SET GLOBAL slave_parallel_mode=@old_parallel_mode; |
| 479 |
SET GLOBAL slave_parallel_threads=@old_parallel_threads; |
| 480 |
--source include/start_slave.inc |
| 481 |
|
| 482 |
--connection master |
| 483 |
DROP TABLE t1, t2; |
| 484 |
|
| 485 |
--sync_slave_with_master |
| 486 |
--source include/rpl_end.inc |