Replication

Partitioned objects are replicated to multiple nodes based on the node list in their partition definition. Objects that have been replicated to one or more nodes are highly available and are available to the application following a node failure.

Replication can be synchronous or asynchronous on a per-node basis in a partition. A mix of synchronous and asynchronous replication within the same partition is supported. For example in Figure 7.1, “Partition definitions”, partition One is defined to use synchronous replication to node B and asynchronous replication to node C.

Synchronous replication guarantees that all replica nodes are updated in the same transaction in which the replicated object was modified. There can be no loss of data. However, the latency to update all of the replica nodes is part of the initiating transaction. By default, synchronous replication uses the deferred write protocol described in the section called “Deferred Write Protocol”.

Asynchronous replication guarantees that any modified objects are queued in a separate transaction. The object queue is per node and is maintained on the same node on which the modification occurred. Modified objects are updated on the replica nodes in the same order in which the modification occurred in the original transaction. The advantage of asynchronous replication is that it removes the update latency from the initiating transaction. However, there is potential for data loss if a failure occurs on the initiating node before the queued modifications have been replicated.

Figure 7.5, “Asynchronous replication” shows asynchronous replication behavior when a modification is made on the active node for a partition. The following steps are taken in this diagram:

  1. A transaction is started.

  2. Replicated objects are modified on the active node.

  3. The modified objects are transactionally queued on the active node.

  4. The transaction commits.

  5. A separate transaction is started on the active node to replicate the objects to the target replica node.

  6. The transaction is committed after all queued object modifications are replicated to the target node.

Asynchronous replication

Figure 7.5. Asynchronous replication


Because asynchronous replication is done in a separate transaction consistency errors can occur. When consistency errors are detected they are ignored, the replicated object is discarded, and a warning message is generated. These errors include:

All other object modifications in the transaction are performed when consistency errors are detected.

Figure 7.6, “Replication protocol” provides more details on the differences between synchronous and asynchronous replication. The key things to notice are:

These cases are shown in Figure 7.6, “Replication protocol”. These steps are shown in the diagram for a partition P with the specified node list:

  1. A transaction is started on node C - a replica node.

  2. A replicated object in partition P is modified on node C.

  3. When the transaction is committed on node C, the update is synchronously done on node A (the active node) and node B (a synchronous replica).

  4. Node A (the active node) queues the update for node D - an asynchronous replica node.

  5. A new transaction is started on node A and the update is applied to node D.

Replication protocol

Figure 7.6. Replication protocol


Error handling

If an I/O error is detected attempting to send creates, updates, or deletes to a replica node, an error is logged on the node initiating the replication and the object modifications for the replica node are discarded and the replica node is removed from the node list for the partition. These errors include:

  • the replica node has not been discovered yet

  • the replica node is down

  • an error occurred while sending the modifications

The replica node will be re-synchronized with the active node when the replica node is restored (see the section called “Restore”).