天天看點

An explanation of how sync and async replication work in eXtremeDB

Here is an explanation of howsync and async replication work:

Synchronous replication:

1.      Master sendstransaction data to replica using send() with commit_timeout.

2.      Then master waitsfor ACK from the replica during synch_timeout.

The first step is usuallysuccessful even if the replica has already died because the data for a singletransaction is relatively small and fits the OS's socket buffer. Thus, themaster detects the replica disconnection if it doesn't receive an ACK after synch_timeoutmsecs.

Asynchronous replication:

1.       mco_trans_commit() puts the transaction data to async.buffer is there is enough free space.

2.       Other thread running mco_HA_async_send_data_to_replicas()takes data from the buffer and sends it to the replica. (using commit_timeout)

Inthis case the replica doesn't send ACKs and if a replica dies; the transactionsdata fills a socket buffer, then the async. buffer, and the commit threadsticks on the semaphore as we see in the stack trace. After commit_timeout thesend() operation returns an error and master detects the replica disconnection.

繼續閱讀