| 1 |
# The test file is created to prove fixes to |
| 2 |
# MDEV-30323 Some DDLs like ANALYZE can complete on parallel slave out of order |
| 3 |
# Debug-sync tests aiming at parallel replication of ADMIN commands |
| 4 |
# are welcome here. |
| 5 |
|
| 6 |
--source include/have_innodb.inc |
| 7 |
--source include/have_debug_sync.inc |
| 8 |
--source include/master-slave.inc |
| 9 |
|
| 10 |
--echo # Initialize |
| 11 |
--connection slave |
| 12 |
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; |
| 13 |
|
| 14 |
--echo # Setup data |
| 15 |
--connection master |
| 16 |
CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=InnoDB; |
| 17 |
CREATE TABLE ta (a int); |
| 18 |
--let $pre_load_gtid=`SELECT @@last_gtid` |
| 19 |
--source include/save_master_gtid.inc |
| 20 |
|
| 21 |
--connection slave |
| 22 |
--source include/sync_with_master_gtid.inc |
| 23 |
|
| 24 |
--source suite/rpl/include/create_or_drop_sync_func.inc |
| 25 |
|
| 26 |
# configure MDEV-30323 slave |
| 27 |
--source include/stop_slave.inc |
| 28 |
SET @old_parallel_threads =@@GLOBAL.slave_parallel_threads; |
| 29 |
SET @old_parallel_mode =@@GLOBAL.slave_parallel_mode; |
| 30 |
SET @old_gtid_strict_mode =@@GLOBAL.gtid_strict_mode; |
| 31 |
SET GLOBAL slave_parallel_threads=10; |
| 32 |
SET GLOBAL slave_parallel_mode=conservative; |
| 33 |
SET GLOBAL gtid_strict_mode=ON; |
| 34 |
--source include/start_slave.inc |
| 35 |
|
| 36 |
# MDEV-30323 setup needs two group of events the first of which is a DML |
| 37 |
# and ANALYZE is the 2nd. |
| 38 |
# The latter is made to race in slave execution over the DML thanks |
| 39 |
# to a DML latency simulation. |
| 40 |
# In the fixed case the race-over should not be a problem: ultimately |
| 41 |
# ANALYZE must wait for its turn to update slave@@global.gtid_binlog_pos. |
| 42 |
# Otherwise the reported OOO error must be issued. |
| 43 |
|
| 44 |
--connection master |
| 45 |
SET @old_format= @@SESSION.binlog_format; |
| 46 |
SET binlog_format=statement; |
| 47 |
INSERT INTO t1 VALUES (foo(1, 'rpl_parallel_after_mark_start_commit WAIT_FOR sig_go', '')); |
| 48 |
|
| 49 |
ANALYZE TABLE ta; |
| 50 |
--source include/save_master_gtid.inc |
| 51 |
|
| 52 |
--connection slave |
| 53 |
--let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE state = "Waiting for prior transaction to commit" |
| 54 |
--source include/wait_condition.inc |
| 55 |
|
| 56 |
SELECT info FROM information_schema.processlist WHERE state = "Waiting for prior transaction to commit"; |
| 57 |
if (`select strcmp(@@global.gtid_binlog_pos, '$pre_load_gtid') <> 0 or strcmp(@@global.gtid_slave_pos, '$pre_load_gtid') <> 0`) |
| 58 |
{ |
| 59 |
--let $bs=`SELECT @@global.gtid_binlog_pos` |
| 60 |
--let $es=`SELECT @@global.gtid_slave_pos` |
| 61 |
--echo Mismatch between expected $pre_load_gtid state and the actual binlog state " @@global.gtid_binlog_pos = $bs or/and slave execution state @@global.gtid_slave_pos = $es. |
| 62 |
--die |
| 63 |
} |
| 64 |
|
| 65 |
set @@debug_sync="now signal sig_go"; |
| 66 |
--source include/sync_with_master_gtid.inc |
| 67 |
|
| 68 |
--echo # Cleanup |
| 69 |
--connection master |
| 70 |
DROP TABLE t1,ta; |
| 71 |
--let $create_or_drop=drop |
| 72 |
--source suite/rpl/include/create_or_drop_sync_func.inc |
| 73 |
|
| 74 |
--source include/save_master_gtid.inc |
| 75 |
|
| 76 |
--connection slave |
| 77 |
--source include/sync_with_master_gtid.inc |
| 78 |
--source include/stop_slave.inc |
| 79 |
SET @@GLOBAL.slave_parallel_threads=@old_parallel_threads; |
| 80 |
SET @@GLOBAL.slave_parallel_mode =@old_parallel_mode; |
| 81 |
SET @@GLOBAL.gtid_strict_mode =@old_gtid_strict_mode; |
| 82 |
--source include/start_slave.inc |
| 83 |
|
| 84 |
--source include/rpl_end.inc |