| 1 |
*** Test two transactions in different domains committed in opposite order on slave but in a single group commit. *** |
| 2 |
include/master-slave.inc |
| 3 |
[connection master] |
| 4 |
connection server_2; |
| 5 |
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; |
| 6 |
include/stop_slave.inc |
| 7 |
SET GLOBAL slave_parallel_threads=10; |
| 8 |
CHANGE MASTER TO master_use_gtid=slave_pos; |
| 9 |
include/start_slave.inc |
| 10 |
connection server_1; |
| 11 |
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; |
| 12 |
CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=MyISAM; |
| 13 |
CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; |
| 14 |
INSERT INTO t1 VALUES (1); |
| 15 |
INSERT INTO t2 VALUES (1); |
| 16 |
connection server_2; |
| 17 |
include/stop_slave.inc |
| 18 |
connection server_1; |
| 19 |
SET sql_log_bin=0; |
| 20 |
CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) |
| 21 |
RETURNS INT DETERMINISTIC |
| 22 |
BEGIN |
| 23 |
RETURN x; |
| 24 |
END |
| 25 |
|| |
| 26 |
SET sql_log_bin=1; |
| 27 |
SET @old_format= @@SESSION.binlog_format; |
| 28 |
SET binlog_format='statement'; |
| 29 |
SET gtid_domain_id=1; |
| 30 |
INSERT INTO t2 VALUES (foo(10, |
| 31 |
'commit_before_enqueue SIGNAL ready1 WAIT_FOR cont1', |
| 32 |
'commit_after_release_LOCK_prepare_ordered SIGNAL ready2')); |
| 33 |
connection server_2; |
| 34 |
FLUSH LOGS; |
| 35 |
SET sql_log_bin=0; |
| 36 |
CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) |
| 37 |
RETURNS INT DETERMINISTIC |
| 38 |
BEGIN |
| 39 |
IF d1 != '' THEN |
| 40 |
SET debug_sync = d1; |
| 41 |
END IF; |
| 42 |
IF d2 != '' THEN |
| 43 |
SET debug_sync = d2; |
| 44 |
END IF; |
| 45 |
RETURN x; |
| 46 |
END |
| 47 |
|| |
| 48 |
SET sql_log_bin=1; |
| 49 |
SET @old_format=@@GLOBAL.binlog_format; |
| 50 |
SET GLOBAL binlog_format=statement; |
| 51 |
SET GLOBAL slave_parallel_threads=0; |
| 52 |
SET GLOBAL slave_parallel_threads=10; |
| 53 |
include/start_slave.inc |
| 54 |
SET debug_sync='now WAIT_FOR ready1'; |
| 55 |
connection server_1; |
| 56 |
SET gtid_domain_id=2; |
| 57 |
INSERT INTO t2 VALUES (foo(11, |
| 58 |
'commit_before_enqueue SIGNAL ready3 WAIT_FOR cont3', |
| 59 |
'commit_after_release_LOCK_prepare_ordered SIGNAL ready4 WAIT_FOR cont4')); |
| 60 |
SET gtid_domain_id=0; |
| 61 |
SELECT * FROM t2 WHERE a >= 10 ORDER BY a; |
| 62 |
a |
| 63 |
10 |
| 64 |
11 |
| 65 |
connection server_2; |
| 66 |
SET debug_sync='now WAIT_FOR ready3'; |
| 67 |
SET debug_sync='now SIGNAL cont3'; |
| 68 |
SET debug_sync='now WAIT_FOR ready4'; |
| 69 |
SET debug_sync='now SIGNAL cont1'; |
| 70 |
SET debug_sync='now WAIT_FOR ready2'; |
| 71 |
SET debug_sync='now SIGNAL cont4'; |
| 72 |
SELECT * FROM t2 WHERE a >= 10 ORDER BY a; |
| 73 |
a |
| 74 |
10 |
| 75 |
11 |
| 76 |
include/show_binlog_events.inc |
| 77 |
Log_name Pos Event_type Server_id End_log_pos Info |
| 78 |
slave-bin.000002 # Binlog_checkpoint # # slave-bin.000002 |
| 79 |
slave-bin.000002 # Gtid # # BEGIN GTID #-#-# cid=# |
| 80 |
slave-bin.000002 # Query # # use `test`; INSERT INTO t2 VALUES (foo(11, |
| 81 |
'commit_before_enqueue SIGNAL ready3 WAIT_FOR cont3', |
| 82 |
'commit_after_release_LOCK_prepare_ordered SIGNAL ready4 WAIT_FOR cont4')) |
| 83 |
slave-bin.000002 # Xid # # COMMIT /* XID */ |
| 84 |
slave-bin.000002 # Gtid # # BEGIN GTID #-#-# cid=# |
| 85 |
slave-bin.000002 # Query # # use `test`; INSERT INTO t2 VALUES (foo(10, |
| 86 |
'commit_before_enqueue SIGNAL ready1 WAIT_FOR cont1', |
| 87 |
'commit_after_release_LOCK_prepare_ordered SIGNAL ready2')) |
| 88 |
slave-bin.000002 # Xid # # COMMIT /* XID */ |
| 89 |
FLUSH LOGS; |
| 90 |
connection server_2; |
| 91 |
include/stop_slave.inc |
| 92 |
SET GLOBAL slave_parallel_threads=@old_parallel_threads; |
| 93 |
include/start_slave.inc |
| 94 |
SET DEBUG_SYNC= 'RESET'; |
| 95 |
SET GLOBAL binlog_format=@old_format; |
| 96 |
connection server_1; |
| 97 |
DROP function foo; |
| 98 |
DROP TABLE t1,t2; |
| 99 |
SET DEBUG_SYNC= 'RESET'; |
| 100 |
SET GLOBAL binlog_format=@old_format; |
| 101 |
include/rpl_end.inc |