include/rpl_init.inc [topology=1->2->1]
# 
# For now we'll only have 1->2 running
# 
# Server 1
# Stop replication 2->1
include/stop_slave.inc
# 
# Server 2
# Use GTID for replication 1->2
include/stop_slave.inc
change master to master_use_gtid=slave_pos;
include/start_slave.inc
# 
# Create some 0-1-* and 0-2-* events in binlog of server 2
connection server_1;
create table t1 (i int) engine=InnoDB;
insert into t1 values (1);
connection server_2;
create table t2 (i int) engine=InnoDB;
connection server_1;
insert into t1 values (2);
connection server_2;
insert into t2 values (1);
# 
# All events are present in the binlog of server 2
include/show_binlog_events.inc
Log_name	Pos	Event_type	Server_id	End_log_pos	Info
slave-bin.000001	#	Gtid	#	#	GTID #-#-#
slave-bin.000001	#	Query	#	#	use `test`; create table t1 (i int) engine=InnoDB
slave-bin.000001	#	Gtid	#	#	BEGIN GTID #-#-#
slave-bin.000001	#	Query	#	#	use `test`; insert into t1 values (1)
slave-bin.000001	#	Xid	#	#	COMMIT /* XID */
slave-bin.000001	#	Gtid	#	#	GTID #-#-#
slave-bin.000001	#	Query	#	#	use `test`; create table t2 (i int) engine=InnoDB
slave-bin.000001	#	Gtid	#	#	BEGIN GTID #-#-#
slave-bin.000001	#	Query	#	#	use `test`; insert into t1 values (2)
slave-bin.000001	#	Xid	#	#	COMMIT /* XID */
slave-bin.000001	#	Gtid	#	#	BEGIN GTID #-#-#
slave-bin.000001	#	Query	#	#	use `test`; insert into t2 values (1)
slave-bin.000001	#	Xid	#	#	COMMIT /* XID */
# 
# Server 1
# Start replication 2->1 using GTID, 
change master to master_use_gtid=slave_pos;
include/start_slave.inc
select * from t1 order by i;
i
1
2
select * from t2 order by i;
i
1
select * from t1 order by i;
i
1
2
select * from t2 order by i;
i
1
drop table t1;
drop table t2;
include/rpl_end.inc
