--source include/have_debug.inc --source include/have_binlog_format_statement.inc --source include/master-slave.inc # # Initialize # CREATE TABLE t1(c1 INT PRIMARY KEY, c2 INT, INDEX(c2)) ENGINE = InnoDB; CREATE TABLE t2(i int primary key) engine=innodb; INSERT INTO t1 VALUES(1, NULL),(2, 2), (3, NULL), (4, 4), (5, NULL), (6, 6); --source include/sync_slave_sql_with_master.inc connect(slave2,127.0.0.1,root,,test,$SLAVE_MYPORT,); --source include/stop_slave_sql.inc SET @saved_slave_parallel_type = @@GLOBAL.slave_parallel_type; SET @saved_slave_parallel_workers = @@GLOBAL.slave_parallel_workers; SET @saved_slave_preserve_commit_order = @@GLOBAL.slave_preserve_commit_order; SET @saved_innodb_lock_wait_timeout = @@GLOBAL.innodb_lock_wait_timeout; SET @saved_slave_transaction_retries = @@GLOBAL.slave_transaction_retries; SET GLOBAL slave_transaction_retries = 2; SET GLOBAL slave_parallel_type = "LOGICAL_CLOCK"; SET GLOBAL slave_parallel_workers = 3; SET GLOBAL slave_preserve_commit_order = ON; # Set it a long time to guarantee it doens't report an timeout error SET GLOBAL innodb_lock_wait_timeout = 1000; --echo # --echo # Case 1: Verify slave can find the deadlock when DELETE is waiting --echo # for its turn to commit --echo # --source include/rpl_connection_master.inc # There is a bug that the first two transactions cannot be applied parallel. # So we need to an extra transaction here. INSERT INTO t1 VALUES(10, 10); SET debug = "d,set_commit_parent_100"; INSERT INTO t1 VALUES(11, NULL); begin; DELETE FROM t1 WHERE c2 <= 3; INSERT INTO t2 values(1); commit; --source include/rpl_connection_slave.inc # It blocks above INSERT statement BEGIN; INSERT INTO t1 VALUES(11, 11); --source include/rpl_connection_slave1.inc BEGIN; INSERT INTO t2 VALUES(1); --connection slave2 --source include/start_slave_sql.inc # Resume the INSERT statement and trigger the deadlock --source include/rpl_connection_slave.inc ROLLBACK; sleep 10; --source include/rpl_connection_slave1.inc commit; --let $rpl_diff_statement= SELECT * FROM t1; --source include/rpl_diff.inc --source include/rpl_connection_master.inc SET debug = ""; --source include/rpl_end.inc