Search code examples
mysqlsqltransactionscluster-computingreplication

Transactions between two replicating master mysql servers


With a replicating mysql master to master database with innodb engine, if one transaction were to initiate on database A will that row lock for database B until the transaction has been committed?


Solution

  • The master getting the first transaction is completely separate from the second master and they communicate through a binary log.

    https://dev.mysql.com/doc/refman/5.7/en/replication-formats.html

    In the case of something requiring a transaction, then the actual statements are not written to the log until the transaction is complete.

    https://dev.mysql.com/doc/refman/5.7/en/replication-features-transactions.html

    So the second master should be completely unhindered, since it won't actually know anything about the request until the first master is done processing it.

    (Standard caveats though of it may depend on what type of replication SBR/RBR/mix and the actual transactions.)