[MDEV-4487] FR: Allow replication from MySQL 5.6+ when GTID is enabled on the master Created: 2013-05-05  Updated: 2015-11-01  Resolved: 2015-10-09

Status: Closed
Project: MariaDB Server
Component/s: Replication
Fix Version/s: 10.0.22, 10.1.8

Type: Task Priority: Minor
Reporter: Elena Stepanova Assignee: Michael Widenius
Resolution: Fixed Votes: 11
Labels: None

Issue Links:
Blocks
blocks MDEV-5705 replication testing: 5.6->10.0 Stalled
blocks MDEV-8685 MariaDB fails to decode Anonymous_GTI... Closed
Relates

 Description   

Currently if MySQL 5.6 is running with GTID enabled, replication to MariaDB does not work, it breaks on the first GTID-related event (e.g. 'Previous_gtids' or 'Gtid') with

Relay log read failure: Could not parse relay log event entry. The possible reasons are: the master's binary log is corrupted (you can check this by running 'mysqlbinlog' on the binary log), the slave's relay log is corrupted (you can check this by running 'mysqlbinlog' on the relay log), a network problem, or a bug in the master's or slave's MySQL code. If you want to check the master's binary log or slave's relay log, you will be able to know their names by issuing 'SHOW SLAVE STATUS' on this slave.

If it's at all possible, I think it's fairly important to be able to replicate from MySQL 5.6 with GTID to MariaDB, as one of reasonable migration scenarios is that a production has the main pair of MySQL 5.6 master and slave (using GTID), and a second MariaDB slave is running in parallel.

Of course it would be old-style replication, not using MariaDB GTID.

That said, replication from MySQL 5.6 GTID to MySQL 5.6 without GTID does not work either (it fails with "The slave IO thread stops because the master has @@GLOBAL.GTID_MODE ON and this server has @@GLOBAL.GTID_MODE OFF"), so maybe it's impossible.



 Comments   
Comment by Michael Widenius [ 2014-01-14 ]

We think it's important that one can add MariaDB as a slave to a MySQL 5.6 with GTID enabled.

The way we will do it is as follows:

  • Continue to use the binary log positioning (not GTID) to read data from the Master
  • Ignore all GTID events in MariaDB

If you are enabling GTID on MariaDB, any slave to that will be able to use GTID.

This means that if one wants to replace a MySQL 5.6 slave with GTID with MariaDB, one has to find out the current log position with SHOW MASTER STATUS before one can enable the MariaDB slave.

Comment by Richard Bensley [ 2014-05-02 ]

If you want heterogeneous replication, you should look at Tungsten Replicator.

Mixing MariaDB 10 and MySQL 5.6/5.7 GTID replication streams would be a very bad idea. The whole point behind GTID is to make managed failovers, or slave promotion (in an emergency) easier. MariaDB and MySQL both have their own good solutions to this problem, but they don't have to be 100% compatible with each other. As Monty said, if you want a mixed environment, use the legacy format of log file + position. This is excluding all the other issues which arise as MySQL and MariaDB introduce their own features, which appear as differently formatted events in the binary log stream, i.e. checksums.

If your application relies on mixed RDBMS for high-availability for a single RDBMS type, something is very wrong.

Comment by Pavel Ivanov [ 2014-05-02 ]

> If your application relies on mixed RDBMS for high-availability for a single RDBMS type, something is very wrong.

This is not wrong, this is exactly how high availability works. If one wants to upgrade from MySQL 5.6 to MariaDB 10.0 or back he must tolerate mixed environment for some time (at least for several days). That's why GTIDs in 5.6 are fundamentally broken – they don't support mixed environment (when some replicas have GTIDs turned on and some don't).

Now how to manage reliable failovers in such mixed environment is a separate question, but at least replication itself should work.

Comment by Michael Widenius [ 2015-10-09 ]

Replication from MySQL 5.6 -> MySQL 10.0 should now work.
MariaDB will remove MySQL 5.6 GTID and MySQL Ignorable events and add the MariaDB GTID.

Comment by Ryan O [ 2015-10-31 ]

I have tried this without success on a MySQL 5.6.21 master and MariaDB 10.0.22 slave when GTID is enabled on the master. The error is:

Last_IO_Error: The slave I/O thread stops because master does not support MariaDB global transaction id. A fatal error is encountered when it tries to SELECT @@GLOBAL.gtid_domain_id. Error: Unknown system variable 'gtid_domain_id'

Is there a way to have MariaDB ignore the domain id?

Comment by Daniel Black [ 2015-10-31 ]

ryno@ryno.tv the problem here is that MariaDB is asking MySQL for the gtid_domain_id.

It appears that you have MariaDB in GTID replication mode. MariaDB and MySQL have different GTID implementations, and that these are not compatible with each other. As such MariaDB cannot replicate from a MySQL master in GTID mode. CHANGE MASTER TO MASTER_USE_GTID=no; START SLAVE; will clear the error.

Comment by Ryan O [ 2015-10-31 ]

@Daniel Black My impression from the MariaDB website was that this should work beginning with 10.0.22.

https://mariadb.com/kb/en/mariadb/setting-up-replication/
*Replicating from MySQL master to MariaDB slave
*Replicating from MySQL 5.5 to MariaDB 5.5+ should just work.
Replicating from MySQL 5.6 without GTID to MariaDB 10+ should work.
Replication from MySQL 5.6 with GTID, binlog_rows_query_log_events and ignorable events works starting from MariaDB 10.0.22 and MariaDB 10.1.8. In this case MariaDB will remove the MySQL GTIDs and other unneeded events and instead adds its own GTIDs.

Thanks,
Ryan

Comment by Elena Stepanova [ 2015-10-31 ]

ryno@ryno.tv,
This note refers to MySQL 5.6 with GTID, not to Replication with GTID. That is, when GTID is enabled on the MySQL 5.6 master, you can now use MariaDB 10.0 as a slave.

Using MASTER_USE_GTID with a master which does not support MariaDB GTIDs, be it MySQL (of any version), or MariaDB 5.5 or lower, is not supported.
Getting a failure when you explicitly set MASTER_USE_GTID on the slave and connect to a master which does not support it is a right thing to do – it's impossible to use GTID for such replication, and if the slave did not fail, the user would have an illusion that GTID is in use. This failure does not cause any damage, and this configuration would not bring any advantage – you just need to unset it as Daniel wrote above.

Comment by Ryan O [ 2015-11-01 ]

Understood. Thank you for such a quick response.

Generated at Thu Feb 08 06:56:49 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.