| 1 |
--source include/master-slave.inc |
| 2 |
--source include/have_innodb.inc |
| 3 |
--source include/have_debug.inc |
| 4 |
--source include/have_binlog_format_row.inc |
| 5 |
|
| 6 |
--echo # MDEV-31448 OOO finish event group by killed worker |
| 7 |
# The test demonstrates how a killed worker access gco lists |
| 8 |
# in finish_event_group() out-of-order to fire |
| 9 |
# DBUG_ASSERT(!tmp_gco->next_gco || tmp_gco->last_sub_id > sub_id); |
| 10 |
# in the buggy version. |
| 11 |
|
| 12 |
--echo # Initialize test data |
| 13 |
--connection master |
| 14 |
call mtr.add_suppression("Slave: Connection was killed"); |
| 15 |
call mtr.add_suppression("Slave: Commit failed due to failure of an earlier commit on which this one depends"); |
| 16 |
create table t1 (a int) engine=innodb; |
| 17 |
create table t2 (a int) engine=innodb; |
| 18 |
|
| 19 |
insert into t1 values (1); |
| 20 |
--source include/save_master_gtid.inc |
| 21 |
|
| 22 |
--connection slave |
| 23 |
--source include/sync_with_master_gtid.inc |
| 24 |
--source include/stop_slave.inc |
| 25 |
--let $save_slave_parallel_threads= `SELECT @@global.slave_parallel_threads` |
| 26 |
--let $save_slave_parallel_mode= `SELECT @@global.slave_parallel_mode` |
| 27 |
--let $save_innodb_lock_wait_timeout= `SELECT @@global.innodb_lock_wait_timeout` |
| 28 |
--let $save_transaction_retries= `SELECT @@global.slave_transaction_retries` |
| 29 |
set @@global.slave_parallel_threads= 4; |
| 30 |
set @@global.slave_parallel_mode= OPTIMISTIC; |
| 31 |
set @@global.innodb_lock_wait_timeout= 30; |
| 32 |
set @@global.slave_transaction_retries= 0; |
| 33 |
|
| 34 |
--connection slave1 |
| 35 |
BEGIN; |
| 36 |
SELECT * FROM t1 WHERE a=1 FOR UPDATE; |
| 37 |
|
| 38 |
--connection master |
| 39 |
SET @old_dbug= @@SESSION.debug_dbug; |
| 40 |
SET @@SESSION.debug_dbug="+d,binlog_force_commit_id"; |
| 41 |
|
| 42 |
# GCO 1 |
| 43 |
SET @commit_id= 10000; |
| 44 |
# T1 |
| 45 |
update t1 set a=2 where a=1; |
| 46 |
# T2 |
| 47 |
set statement skip_parallel_replication=1 for insert into t2 values (1); |
| 48 |
|
| 49 |
# GCO 2 |
| 50 |
# T3 |
| 51 |
drop table t2; |
| 52 |
|
| 53 |
--connection slave |
| 54 |
--source include/start_slave.inc |
| 55 |
|
| 56 |
--echo # wait for T1 |
| 57 |
# Wildcard for `state` as it depends on whether WSREP is compiled in or not. |
| 58 |
--let $wait_condition= SELECT count(*)=1 FROM information_schema.processlist WHERE state LIKE 'Update_rows_log_event::find_row(%' and command LIKE 'Slave_worker'; |
| 59 |
--source include/wait_condition.inc |
| 60 |
|
| 61 |
--echo # wait for T2 |
| 62 |
--let $wait_condition= SELECT count(*)=1 FROM information_schema.processlist WHERE state LIKE 'Waiting for prior transaction to commit%' and command LIKE 'Slave_worker'; |
| 63 |
--source include/wait_condition.inc |
| 64 |
--let $t2_tid= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'Waiting for prior transaction to commit%' and command LIKE 'Slave_worker'` |
| 65 |
--echo # wait for T3 |
| 66 |
--let $wait_condition= SELECT count(*)=1 FROM information_schema.processlist WHERE state LIKE 'Waiting for prior transaction to start commit%' and command LIKE 'Slave_worker'; |
| 67 |
--source include/wait_condition.inc |
| 68 |
|
| 69 |
--replace_result $t2_tid T2_TID |
| 70 |
--eval kill $t2_tid |
| 71 |
|
| 72 |
--sleep 1 |
| 73 |
|
| 74 |
--connection slave1 |
| 75 |
# Release the blocked T1 |
| 76 |
ROLLBACK; |
| 77 |
|
| 78 |
--connection master |
| 79 |
DROP TABLE t1; |
| 80 |
--source include/save_master_gtid.inc |
| 81 |
|
| 82 |
--connection slave |
| 83 |
--echo # |
| 84 |
--echo # Cleanup |
| 85 |
--let $rpl_allow_error= 1 |
| 86 |
--source include/wait_for_slave_sql_to_stop.inc |
| 87 |
--source include/stop_slave_io.inc |
| 88 |
eval set @@global.slave_parallel_threads= $save_slave_parallel_threads; |
| 89 |
eval set @@global.slave_parallel_mode= $save_slave_parallel_mode; |
| 90 |
eval set @@global.innodb_lock_wait_timeout= $save_innodb_lock_wait_timeout; |
| 91 |
eval set @@global.slave_transaction_retries= $save_transaction_retries; |
| 92 |
--source include/start_slave.inc |
| 93 |
--source include/sync_with_master_gtid.inc |
| 94 |
|
| 95 |
--source include/rpl_end.inc |
| 96 |
|