Class RemovedReplicasStates
- java.lang.Object
-
- org.opends.server.replication.server.changelog.api.RemovedReplicasStates
-
public final class RemovedReplicasStates extends Object
Contains CSNs identifying the last state for all replicas removed from the changelog for a domain.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=changelog using 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=changelog}} using the cookie control with a cookie containing the same kind of CSNs should be refused
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static RemovedReplicasStates
fromStates(ServerState lastUpdates, ServerState lastMessages)
Initializes the removed replica states with information read from an external source, typically on disk.CSN
getLastMessageCsn(ReplicaId replica)
Returns the CSN for the last LDAP message from the provided replica.ServerState
getLastMessages()
Returns the CSNs of the last messages for all removed replicas.CSN
getLastUpdateCsn(ReplicaId replica)
Returns the CSN for the lastLDAPUpdateMsg
from the provided replica.ServerState
getLastUpdates()
Returns the CSNs of the lastLDAPUpdateMsg
for all removed replicas.boolean
hasRemovedReplicas()
Returns whether there are removed replicas.static RemovedReplicasStates
newRemovedReplicasStates()
Returns a removed replica state where all states are empty.void
replicaRejoined(ReplicaId replica)
Removes the provided replica from the removed replica states, because it rejoined.void
update(CSN lastUpdate, CSN lastMessage)
Updates the removed replicas states with the provided CSNs.
-
-
-
Method Detail
-
fromStates
public static RemovedReplicasStates fromStates(ServerState lastUpdates, ServerState lastMessages)
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
public static RemovedReplicasStates newRemovedReplicasStates()
Returns a removed replica state where all states are empty.- Returns:
- a removed replica state where all states are empty
-
update
public void update(CSN lastUpdate, CSN lastMessage)
Updates the removed replicas states with the provided CSNs.- Parameters:
lastUpdate
- the CSN of the lastLDAPUpdateMsg
, if anylastMessage
- the CSN of the lastUpdateMesg
, any kind
-
replicaRejoined
public void replicaRejoined(ReplicaId replica)
Removes the provided replica from the removed replica states, because it rejoined.- Parameters:
replica
- the replica to remove
-
getLastUpdateCsn
public CSN getLastUpdateCsn(ReplicaId replica)
Returns the CSN for the lastLDAPUpdateMsg
from the provided replica.- Parameters:
replica
- the removed replica- Returns:
- the CSN for the last
LDAPUpdateMsg
from the provided replica
-
getLastMessageCsn
public CSN getLastMessageCsn(ReplicaId replica)
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
public ServerState getLastUpdates()
Returns the CSNs of the lastLDAPUpdateMsg
for all removed replicas.- Returns:
- the CSNs of the last
LDAPUpdateMsg
for all removed replicas
-
getLastMessages
public ServerState 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
-
-