-
Notifications
You must be signed in to change notification settings - Fork 63
Description
https://dev.mysql.com/doc/refman/5.7/en/replication-semisync.html
In addition to the built-in asynchronous replication, MySQL 5.7 supports an interface to semisynchronous replication[...]. With asynchronous replication, if the master crashes, transactions that it has committed might not have been transmitted to any slave. Compared to asynchronous replication, semisynchronous replication provides improved data integrity because when a commit returns successfully, it is known that the data exists in at least two places.
Semisynchronous replication falls between asynchronous and fully synchronous replication. The master waits only until at least one slave has received and logged the events. It does not wait for all slaves to acknowledge receipt, and it requires only receipt, not that the events have been fully executed and committed on the slave side.
If semisynchronous replication is enabled on the master side and there is at least one semisynchronous slave, a thread that performs a transaction commit on the master blocks and waits until at least one semisynchronous slave acknowledges that it has received all events for the transaction, or until a timeout occurs.
Spitballing:
If semisynchronous replication is implemented, it may improve the consistency that may be expected of Autopilot Pattern MySQL in case of a failure of the primary.
It does not appear that all replicas need to be semisynchronous. Indeed, it may not be desirable for them to be. That suggests it might be ideal to designate one replica as semisynchronous for this purpose. That one semisynchronous replica might report itself to Consul as a different service name, just as the mysql-primary is a different service name from mysql. The semisynchronous replica would have dibs on promotion to primary in case of any primary failure.