Skip to content
jnblanchet edited this page Aug 28, 2013 · 9 revisions

The store's consistency states describe the integrity of the data contained in the store by making sure the store and the transaction logs describe the same data. Unlike the master service member, consistency states apply to all replicas, i.e. masters and slaves.

![consistency states](https://raw.github.com/wajam/nrv/master/docs/consistency%20states.png)
_Consistency states_

Involved classes: MemberConsistencyState

Interaction with Service Member Status

In the case of a master, the consistency state interacts with the service member's status. In a similar way, a slave's consistency state will interact with the replication sessions. This section explains each state as well as its interaction with the service member (master) or session (slave).

Involved classes: MemberStatus, MemberConsistencyState

Master Replica

  • Recovering: The Recovering state is only set when the local service member has its status set to Joining. While in this state, steps are taken to: 1) verify consistency 2) attempt to restore consistency if necessary. If the master replica is consistent at the end of this check, the state is switched to OK. Otherwise, the state is set to Error.
  • Ok: The service member is consistent and member status can transition to Up.
  • Error: There is a problem with the service member consistency. The service member will not be able to switch to Up. The state will be periodically set to recovering, until consistency is restored.
  • None: Although None is not a consistent state, it represents the absence of a state, which is the initial value at launch. The absence of state allows initialization. The state will then be switched to recovering.

Slave Replica

  • Recovering: For slave replicas, the Recovering state occurs just before the replication session with the master is established. Aside from this detail, it does exactly the same thing on the slave replica.
  • Ok: The slave replica is consistency and a session may be initialized. This state is required to replicate.
  • Error: An inconsistency was detected while in the recovering state, but there was a problem when attempting to recover. The slave may not be used to handle traffic, and cannot replicate. To fix the inconsistency, the consistency check tool should be used.
  • None: Similar to the master replica, the consistency of the slave replica is initially set at None.

Clone this wiki locally