| 1 |
--echo *** MDEV-5921: In parallel replication, an error is not correctly signalled to the next transaction *** |
| 2 |
|
| 3 |
--source include/have_innodb.inc |
| 4 |
--source include/have_debug.inc |
| 5 |
--source include/have_debug_sync.inc |
| 6 |
--source include/master-slave.inc |
| 7 |
|
| 8 |
--connection server_2 |
| 9 |
--source include/stop_slave.inc |
| 10 |
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; |
| 11 |
SET GLOBAL slave_parallel_threads=10; |
| 12 |
CHANGE MASTER TO master_use_gtid=slave_pos; |
| 13 |
CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends"); |
| 14 |
--source include/start_slave.inc |
| 15 |
|
| 16 |
--connection server_1 |
| 17 |
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; |
| 18 |
CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; |
| 19 |
--save_master_pos |
| 20 |
|
| 21 |
--connection server_2 |
| 22 |
--sync_with_master |
| 23 |
|
| 24 |
--connection server_1 |
| 25 |
INSERT INTO t3 VALUES (110, 1); |
| 26 |
--save_master_pos |
| 27 |
|
| 28 |
--connection server_2 |
| 29 |
--sync_with_master |
| 30 |
SELECT * FROM t3 WHERE a >= 110 ORDER BY a; |
| 31 |
# Inject a duplicate key error. |
| 32 |
SET sql_log_bin=0; |
| 33 |
INSERT INTO t3 VALUES (111, 666); |
| 34 |
SET sql_log_bin=1; |
| 35 |
|
| 36 |
--connection server_1 |
| 37 |
|
| 38 |
# Create a group commit with two inserts, the first one conflicts with a row on the slave |
| 39 |
--connect (con1,127.0.0.1,root,,test,$SERVER_MYPORT_1,) |
| 40 |
SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; |
| 41 |
send INSERT INTO t3 VALUES (111, 2); |
| 42 |
--connection server_1 |
| 43 |
SET debug_sync='now WAIT_FOR master_queued1'; |
| 44 |
|
| 45 |
--connect (con2,127.0.0.1,root,,test,$SERVER_MYPORT_1,) |
| 46 |
SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; |
| 47 |
send INSERT INTO t3 VALUES (112, 3); |
| 48 |
|
| 49 |
--connection server_1 |
| 50 |
SET debug_sync='now WAIT_FOR master_queued2'; |
| 51 |
SET debug_sync='now SIGNAL master_cont1'; |
| 52 |
|
| 53 |
--connection con1 |
| 54 |
REAP; |
| 55 |
--connection con2 |
| 56 |
REAP; |
| 57 |
SET debug_sync='RESET'; |
| 58 |
--save_master_pos |
| 59 |
|
| 60 |
--connection server_2 |
| 61 |
--let $slave_sql_errno= 1062 |
| 62 |
--source include/wait_for_slave_sql_error.inc |
| 63 |
# We should not see the row (112,3) here, it should be rolled back due to |
| 64 |
# error signal from the prior transaction. |
| 65 |
SELECT * FROM t3 WHERE a >= 110 ORDER BY a; |
| 66 |
SET sql_log_bin=0; |
| 67 |
DELETE FROM t3 WHERE a=111 AND b=666; |
| 68 |
SET sql_log_bin=1; |
| 69 |
START SLAVE SQL_THREAD; |
| 70 |
--sync_with_master |
| 71 |
SELECT * FROM t3 WHERE a >= 110 ORDER BY a; |
| 72 |
|
| 73 |
# Clean up. |
| 74 |
--connection server_2 |
| 75 |
--source include/stop_slave.inc |
| 76 |
SET GLOBAL slave_parallel_threads=@old_parallel_threads; |
| 77 |
--source include/start_slave.inc |
| 78 |
SET DEBUG_SYNC= 'RESET'; |
| 79 |
|
| 80 |
--connection server_1 |
| 81 |
--disconnect con1 |
| 82 |
--disconnect con2 |
| 83 |
DROP TABLE t3; |
| 84 |
SET DEBUG_SYNC= 'RESET'; |
| 85 |
|
| 86 |
--source include/rpl_end.inc |