Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I was researching about MySQL Semisynchronous Replication, my understanding about the workflow is the follow:

  1. Master Receive a successful transaction from a client session.
  2. Master write it to his binaty log
  3. Master wait for rpl_semi_sync_master_timeout milliseconds to receive an acknowledgment from at least one slave
  4. Slave pick this successful transaction, write it to his relay log, flush it to disk
  5. Slave return an acknowledgment to master
  6. Master return successful to his client session.

My question is, at any point, this type of replication ensures that the transaction is executed on slave(SQL_TREAD applies it). Having in mind that it will add a delay on each transaction and in a case of master failure, is not 100% guaranteed that the slave will be consistent with master, what is the benefit(s) of using this type of replication?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

Baron Schwartz wrote an excellent article on this, and I think one key sentence answers your question:

What does semi-synchronous replication guarantee me then? If there are no errors or timeouts, then the guarantee is essentially that only one transaction per client is likely to be lost if the master crashes.

So semi-synchronous replication minimises (but doesn't entirely eliminate) the chance of this exact problem:

  1. Replicant B's replication IO Thread starts running behind its master - Server A - for some reason
  2. Server A dies - unrecoverably
  3. Transactions are lost forever

As noted in Baron's post (and based on your wording I'm sure you're aware of this), it isn't bulletproof - MySQL will fall back to regular replication if it stops getting a response from the replicants - but irrecoverable data loss is less likely to occur.

The upshot is that it prevents the situation above, it's "out of the box", and it doesn't require any third-party or infrastructure-level solutions (e.g. Galera/Xtradb Cluster, or DRBD). Whether the benefits are worth the cost is likely to vary depending on your situation.

share|improve this answer
2  
Semisynchronous Replication is not exactly out-of-the-box. Some assembly is required : dba.stackexchange.com/a/27853/877. Still, +1 on the overall perspective presented. –  RolandoMySQLDBA May 6 '13 at 11:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.