| 1 |
# Invoked from parallel_backup.test |
| 2 |
# Parameters: |
| 3 |
# $complete = COMMIT or ROLLBACK |
| 4 |
# $slave_ooo_error = 1 means slave group commit did not succeed |
| 5 |
# |
| 6 |
--let $kind = Normal |
| 7 |
if ($slave_ooo_error) |
| 8 |
{ |
| 9 |
--let $kind = Errored out |
| 10 |
} |
| 11 |
--echo # |
| 12 |
--echo # $kind XA $complete |
| 13 |
|
| 14 |
--connection slave |
| 15 |
--source include/stop_slave.inc |
| 16 |
|
| 17 |
--connection master |
| 18 |
# val_0 is the first value to insert on master in prepared xa |
| 19 |
# val_1 is the next one to insert which is the value to block on slave |
| 20 |
--let $val_0 = `SELECT max(a)+1 FROM t1` |
| 21 |
--let $val_1 = $val_0 |
| 22 |
--inc $val_1 |
| 23 |
|
| 24 |
--connection aux_slave |
| 25 |
BEGIN; |
| 26 |
--eval INSERT INTO t1 VALUES ($val_1) |
| 27 |
|
| 28 |
--connection master |
| 29 |
XA START '1'; |
| 30 |
--eval INSERT INTO t1 VALUES ($val_0) |
| 31 |
XA END '1'; |
| 32 |
XA PREPARE '1'; |
| 33 |
--connection master1 |
| 34 |
--eval INSERT INTO t1 VALUES ($val_1) |
| 35 |
--connection master |
| 36 |
--eval XA $complete '1' |
| 37 |
--source include/save_master_gtid.inc |
| 38 |
|
| 39 |
--connection slave |
| 40 |
if ($slave_ooo_error) |
| 41 |
{ |
| 42 |
SET @sav_innodb_lock_wait_timeout = @@global.innodb_lock_wait_timeout; |
| 43 |
SET @sav_slave_transaction_retries = @@global.slave_transaction_retries; |
| 44 |
SET @@global.innodb_lock_wait_timeout =5; |
| 45 |
SET @@global.slave_transaction_retries=0; |
| 46 |
} |
| 47 |
--source include/start_slave.inc |
| 48 |
--connection aux_slave |
| 49 |
--let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE state = "Waiting for prior transaction to commit" |
| 50 |
--source include/wait_condition.inc |
| 51 |
--echo # Xid '1' must be in the output: |
| 52 |
XA RECOVER; |
| 53 |
--connection backup_slave |
| 54 |
BACKUP STAGE START; |
| 55 |
--send BACKUP STAGE BLOCK_COMMIT |
| 56 |
--connection aux_slave |
| 57 |
--sleep 1 |
| 58 |
if ($slave_ooo_error) |
| 59 |
{ |
| 60 |
--let $wait_condition= SELECT COUNT(*) = 0 FROM information_schema.processlist WHERE state = "Waiting for prior transaction to commit" |
| 61 |
--source include/wait_condition.inc |
| 62 |
--let $rpl_allow_error=1 |
| 63 |
} |
| 64 |
ROLLBACK; |
| 65 |
--let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE state = "Waiting for backup lock" |
| 66 |
--source include/wait_condition.inc |
| 67 |
--connection backup_slave |
| 68 |
--reap |
| 69 |
BACKUP STAGE END; |
| 70 |
--connection slave |
| 71 |
if (!$slave_ooo_error) |
| 72 |
{ |
| 73 |
--source include/sync_with_master_gtid.inc |
| 74 |
} |
| 75 |
--let $rpl_only_running_threads= 1 |
| 76 |
--source include/stop_slave.inc |
| 77 |
if ($slave_ooo_error) |
| 78 |
{ |
| 79 |
SET @@global.innodb_lock_wait_timeout = @sav_innodb_lock_wait_timeout; |
| 80 |
SET @@global.slave_transaction_retries= @sav_slave_transaction_retries; |
| 81 |
} |