| 1 |
# Verify deadlock between XA-PREPARE and BACKUP on the optimistic slave |
| 2 |
--source include/have_debug.inc |
| 3 |
--source include/have_debug_sync.inc |
| 4 |
--source include/have_innodb.inc |
| 5 |
# The test is not format specific, MIXED is required to optimize testing time |
| 6 |
--source include/have_binlog_format_mixed.inc |
| 7 |
--source include/master-slave.inc |
| 8 |
|
| 9 |
--connection master |
| 10 |
CREATE TABLE t (a INT) ENGINE = innodb; |
| 11 |
|
| 12 |
--sync_slave_with_master |
| 13 |
--source include/stop_slave.inc |
| 14 |
SET STATEMENT sql_log_bin= 0 FOR ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; |
| 15 |
SET @old_parallel_threads= @@GLOBAL.slave_parallel_threads; |
| 16 |
SET @old_parallel_mode = @@GLOBAL.slave_parallel_mode; |
| 17 |
SET @@global.slave_parallel_threads= 2; |
| 18 |
SET @@global.slave_parallel_mode = 'optimistic'; |
| 19 |
|
| 20 |
--connection master |
| 21 |
--echo # MDEV-35110 |
| 22 |
SET @@gtid_seq_no=100; |
| 23 |
insert into t set a=1; |
| 24 |
xa start 'x'; |
| 25 |
insert into t set a=2; |
| 26 |
xa end 'x'; |
| 27 |
xa prepare 'x'; |
| 28 |
|
| 29 |
--connection slave |
| 30 |
SET @@global.debug_dbug="+d,hold_worker_on_schedule"; |
| 31 |
start slave; |
| 32 |
SET debug_sync = 'now WAIT_FOR reached_pause'; |
| 33 |
--let $wait_condition= SELECT count(*) = 1 FROM information_schema.processlist WHERE state LIKE "Waiting for prior transaction to commit" |
| 34 |
--source include/wait_condition.inc |
| 35 |
|
| 36 |
--connection slave1 |
| 37 |
backup stage start; |
| 38 |
backup stage block_commit; |
| 39 |
|
| 40 |
--connection slave |
| 41 |
--let $wait_condition= SELECT count(*) = 1 FROM information_schema.processlist WHERE state LIKE "Waiting for backup lock" |
| 42 |
SET debug_sync = 'now SIGNAL continue_worker'; |
| 43 |
--source include/wait_condition.inc |
| 44 |
SET debug_sync = RESET; |
| 45 |
|
| 46 |
--connection slave1 |
| 47 |
backup stage end; |
| 48 |
|
| 49 |
--connection master |
| 50 |
xa rollback 'x'; |
| 51 |
|
| 52 |
--sync_slave_with_master |
| 53 |
|
| 54 |
--echo # Clean up. |
| 55 |
--connection slave |
| 56 |
--source include/stop_slave.inc |
| 57 |
SET @@global.debug_dbug=""; |
| 58 |
SET @@global.slave_parallel_threads= @old_parallel_threads; |
| 59 |
SET @@global.slave_parallel_mode = @old_parallel_mode; |
| 60 |
|
| 61 |
--source include/start_slave.inc |
| 62 |
|
| 63 |
--connection server_1 |
| 64 |
DROP TABLE t; |
| 65 |
|
| 66 |
--source include/rpl_end.inc |