maria-developers team mailing list archive
Mailing list archive
Best way of starting multi-source connections with active slave.
I am setting up multi-source replication with four nodes, where nodes 1, 2, and 3 are masters and node 4 is the slave of the first 3. The slave is *active*, meaning that it has a binary log and runs transactions of its own.
All is well if I run 'reset master' in all nodes before setting up replication.
CHANGE MASTER 'node1' TO master_host='host1', master_port=3306, master_user='some_slave', master_password='some_slave', master_use_gtid=current_pos;
CHANGE MASTER 'node2' TO master_host='host2', master_port=3306, master_user='some_slave', master_password='some_slave', master_use_gtid=current_pos;
CHANGE MASTER 'node3' TO master_host='host3', master_port=3306, master_user='some_slave', master_password='some_slave', master_use_gtid=current_pos;
start all slaves;
However, if host 4 has a binary log and has logged one or more transactions before starting replication, we get a conflict.
Got fatal error 1236 from master when reading data from binary log: 'Error: connecting slave requested to start from GTID 0-104-1, which is not in the master's binlog. Since the master's binlog contains GTIDs with higher sequence numbers, it probably means that the slave has diverged due to executing extra erroneous transactions'
I get the same result if I use 'slave_pos' instead of 'current_pos'.
Notice that the changes in the slave do not conflict with anything that happens in the masters.
#1 node4 (fan-in slave): create user distribution_user identified by 'something';
#2 node4 CHANGE MASTER ...
#3 node4 start all slaves
#4 node1 (master): create table t1
#5 node2 (master): create table t2
#6 node3 (master): create table t3
This sequence of events fails.
If I execute event #1 after #2 and #3, then all works as expected. Or it all works if I say master_use_gtid=no, but that would defeat the purpose of having GTIDs, or am I missing something?
Is there a way of enabling multi-source replication with the slave having non-conflicting transactions already logged?