Class RemovedReplicasStates
When deleting a replica from the changelog because all data is older than the purge delay, there is no guarantee the
replica will never rejoin the topology again.
Moreover the current protocol does not differentiate between a replica being down for a long time and an uninstalled
replica, meaning removing a replica is a local decision.
That poses problems for other replicas presenting a ServerState referencing a replica removed from the
changelog, since the changelog will be unable to position on the CSN.
We keep data on removed replicas by recording off-band the CSN of the last message sent by the replica and of
the last update originating from it, since depending on the version a ServerState could include one or
the other. Let the couple of CSNs be called TCSNs.
The following is the intended behaviour:
- The changelog DB records the TCSNs for a replica DB that is purged entirely (it guarantees no updates have been missed)
- In the event a removed replica rejoins the topology,the TCSNs are kept even when new updates are coming in for its replica, they ensure continuity of service for server states / cookies referencing it
- The first successful purge on its replica DB will remove the corresponding TCSNs because they can no longer guarantee that updates have not been missed
- RSes accept connections from DSes which present a server state containing only CSNs newer than the purge delay TCSNs
- Searches on
cn=changelogusing the cookie control with a cookie containing the same kind of CSNs should complete successfully - RSs rejects connections from DSs which present a server state containing a CSN older than the purge delay that is not a tombstone CSN
- Searches on
cn=changelogusing the cookie control with a cookie containing the same kind of CSNs should be refused
-
Method Summary
Modifier and TypeMethodDescriptionstatic RemovedReplicasStatesfromStates(ServerState lastUpdates, ServerState lastMessages) Initializes the removed replica states with information read from an external source, typically on disk.getLastMessageCsn(ReplicaId replica) Returns the CSN for the last LDAP message from the provided replica.Returns the CSNs of the last messages for all removed replicas.getLastUpdateCsn(ReplicaId replica) Returns the CSN for the lastLDAPUpdateMsgfrom the provided replica.Returns the CSNs of the lastLDAPUpdateMsgfor all removed replicas.booleanReturns whether there are removed replicas.static RemovedReplicasStatesReturns a removed replica state where all states are empty.voidreplicaRejoined(ReplicaId replica) Removes the provided replica from the removed replica states, because it rejoined.voidUpdates the removed replicas states with the provided CSNs.
-
Method Details
-
fromStates
Initializes the removed replica states with information read from an external source, typically on disk.- Parameters:
lastUpdates- the state containing the CSNs of the lastLDAPUpdateMsg, if anylastMessages- the state containing the CSNs of the lastUpdateMsg- Returns:
- a new removed replicas state
-
newRemovedReplicasStates
Returns a removed replica state where all states are empty.- Returns:
- a removed replica state where all states are empty
-
update
Updates the removed replicas states with the provided CSNs.- Parameters:
lastUpdate- the CSN of the lastLDAPUpdateMsg, if anylastMessage- the CSN of the lastUpdateMsg, any kind
-
replicaRejoined
Removes the provided replica from the removed replica states, because it rejoined.- Parameters:
replica- the replica to remove
-
getLastUpdateCsn
Returns the CSN for the lastLDAPUpdateMsgfrom the provided replica.- Parameters:
replica- the removed replica- Returns:
- the CSN for the last
LDAPUpdateMsgfrom the provided replica
-
getLastMessageCsn
Returns the CSN for the last LDAP message from the provided replica.- Parameters:
replica- the removed replica- Returns:
- the CSN for the last LDAP message from the provided replica
-
getLastUpdates
Returns the CSNs of the lastLDAPUpdateMsgfor all removed replicas.- Returns:
- the CSNs of the last
LDAPUpdateMsgfor all removed replicas
-
getLastMessages
Returns the CSNs of the last messages for all removed replicas.- Returns:
- the CSNs of the last messages for all removed replicas
-
hasRemovedReplicas
public boolean hasRemovedReplicas()Returns whether there are removed replicas.- Returns:
- whether there are removed replicas
-