mysqlmysql-cluster

Mysql Cluster binlog replication order


We are facing an issue with our mysql replication stack: We actually have a mysql ndb cluster (7.6.11) acting as a master and an innoDB(5.7) as an slave. Everything seemed to be working right until we realized that some statements weren't being executed into the slave.

Long story short: some statements in the master binlog was written with their order switched (execution order != log order) and when the slave was trying to replicate it, it was facing foreign_key constraint errors.

We have review our configuration and everything looks right:

master (cluster) configuration:

-binlog_order_commits=ON
-innodb_api_enable_binlog=OFF
-innodb_flush_log_at_trx_commit=1
-log_bin=ON
-log_slave_updates=OFF
-slave_parallel_type=DATABASE
-slave_parallel_workers=0
-slave_preserve_commit_order=OFF
-sync_binlog=1
-ndb_log_binlog_index
-ndb_log_updated_only=ON
-ndb_log_update_as_write=OFF

slave (innodb) configuration:

-binlog_order_commits=ON
-innodb_api_enable_binlog=OFF
-innodb_flush_log_at_trx_commit=1
-log-bin
-log_slave_updates=ON
-slave_parallel_type=DATABASE
-slave_parallel_workers=0
-slave_preserve_commit_order=OFF
-sync_binlog=1

Did we ruined something?


Solution

  • For those arriving to this post with the same issue, I managed to acomplish the right order setting:

    I am actually sizing the impact of this change, but at least the replication is working as intended.