| 1 |
--source include/have_innodb.inc |
| 2 |
--source include/have_debug.inc |
| 3 |
--source include/have_debug_sync.inc |
| 4 |
--source include/master-slave.inc |
| 5 |
|
| 6 |
--connection server_2 |
| 7 |
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; |
| 8 |
--source include/stop_slave.inc |
| 9 |
SET GLOBAL slave_parallel_threads=10; |
| 10 |
--source include/start_slave.inc |
| 11 |
|
| 12 |
|
| 13 |
--echo *** MDEV-6589: Incorrect relay log start position when restarting SQL thread after error in parallel replication *** |
| 14 |
|
| 15 |
--connection server_1 |
| 16 |
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; |
| 17 |
CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=MyISAM; |
| 18 |
CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; |
| 19 |
INSERT INTO t1 VALUES (1); |
| 20 |
INSERT INTO t2 VALUES (1); |
| 21 |
--save_master_pos |
| 22 |
|
| 23 |
--connection server_2 |
| 24 |
--sync_with_master |
| 25 |
SELECT * FROM t1; |
| 26 |
SELECT * FROM t2; |
| 27 |
|
| 28 |
# Block one domain, which we will later cause to give an error. And let some |
| 29 |
# other domains proceed so we can check that after restart, the slave is able |
| 30 |
# to correctly restart each domain in a separate position. |
| 31 |
|
| 32 |
--connect (con_temp1,127.0.0.1,root,,test,$SERVER_MYPORT_2,) |
| 33 |
SET sql_log_bin=0; |
| 34 |
BEGIN; |
| 35 |
INSERT INTO t2 VALUES (5); |
| 36 |
|
| 37 |
--connection server_1 |
| 38 |
SET gtid_domain_id=0; |
| 39 |
INSERT INTO t1 VALUES (2); |
| 40 |
INSERT INTO t2 VALUES (3); |
| 41 |
FLUSH LOGS; |
| 42 |
INSERT INTO t1 VALUES (4); |
| 43 |
|
| 44 |
SET gtid_domain_id=1; |
| 45 |
# This query will be blocked on the slave, and later give a duplicate key error. |
| 46 |
INSERT INTO t2 VALUES (5); |
| 47 |
|
| 48 |
SET gtid_domain_id=0; |
| 49 |
INSERT INTO t1 VALUES (6); |
| 50 |
INSERT INTO t1 VALUES (7); |
| 51 |
|
| 52 |
SET gtid_domain_id=2; |
| 53 |
INSERT INTO t2 VALUES (8); |
| 54 |
INSERT INTO t1 VALUES (9); |
| 55 |
FLUSH LOGS; |
| 56 |
|
| 57 |
SET gtid_domain_id=3; |
| 58 |
INSERT INTO t2 VALUES (10); |
| 59 |
INSERT INTO t1 VALUES (11); |
| 60 |
|
| 61 |
# These cannot be replicated before the error, as a prior commit is blocked. |
| 62 |
SET gtid_domain_id=1; |
| 63 |
INSERT INTO t1 VALUES (12); |
| 64 |
INSERT INTO t2 VALUES (13); |
| 65 |
|
| 66 |
SET gtid_domain_id=0; |
| 67 |
INSERT INTO t2 VALUES (14); |
| 68 |
FLUSH LOGS; |
| 69 |
|
| 70 |
SET gtid_domain_id=3; |
| 71 |
INSERT INTO t2 VALUES (15); |
| 72 |
|
| 73 |
SET gtid_domain_id=2; |
| 74 |
INSERT INTO t2 VALUES (16); |
| 75 |
|
| 76 |
SET gtid_domain_id=0; |
| 77 |
INSERT INTO t1 VALUES (17); |
| 78 |
SET @gtid0 = @@last_gtid; |
| 79 |
SET gtid_domain_id=2; |
| 80 |
INSERT INTO t1 VALUES (18); |
| 81 |
SET @gtid2 = @@last_gtid; |
| 82 |
SET gtid_domain_id=3; |
| 83 |
INSERT INTO t1 VALUES (19); |
| 84 |
SET @gtid3 = @@last_gtid; |
| 85 |
--let $wait_pos= `SELECT CONCAT(@gtid0, ",", @gtid2, ",", @gtid3)` |
| 86 |
|
| 87 |
SELECT * FROM t1 ORDER BY a; |
| 88 |
SELECT * FROM t2 ORDER BY a; |
| 89 |
--source include/save_master_gtid.inc |
| 90 |
|
| 91 |
|
| 92 |
--connection server_2 |
| 93 |
# First wait for domains 0, 2, and 3 to complete. |
| 94 |
--replace_result $wait_pos WAIT_POS |
| 95 |
eval SELECT MASTER_GTID_WAIT('$wait_pos'); |
| 96 |
|
| 97 |
# Then release the row lock, and wait for the domain 1 to fail with |
| 98 |
# duplicate key error. |
| 99 |
--connection con_temp1 |
| 100 |
COMMIT; |
| 101 |
CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends"); |
| 102 |
SET sql_log_bin=1; |
| 103 |
|
| 104 |
--connection server_2 |
| 105 |
--let $slave_sql_errno= 1062 |
| 106 |
--source include/wait_for_slave_sql_error.inc |
| 107 |
|
| 108 |
SELECT * FROM t1 ORDER BY a; |
| 109 |
SELECT * FROM t2 ORDER BY a; |
| 110 |
|
| 111 |
SET sql_log_bin=0; |
| 112 |
DELETE FROM t2 WHERE a=5; |
| 113 |
SET sql_log_bin=1; |
| 114 |
--source include/start_slave.inc |
| 115 |
--source include/sync_with_master_gtid.inc |
| 116 |
|
| 117 |
SELECT * FROM t1 ORDER BY a; |
| 118 |
SELECT * FROM t2 ORDER BY a; |
| 119 |
|
| 120 |
|
| 121 |
# Clean up. |
| 122 |
--connection server_2 |
| 123 |
--source include/stop_slave.inc |
| 124 |
SET GLOBAL slave_parallel_threads=@old_parallel_threads; |
| 125 |
--source include/start_slave.inc |
| 126 |
SET DEBUG_SYNC= 'RESET'; |
| 127 |
|
| 128 |
--connection server_1 |
| 129 |
DROP TABLE t1,t2; |
| 130 |
SET DEBUG_SYNC= 'RESET'; |
| 131 |
|
| 132 |
--source include/rpl_end.inc |