Class ChangelogState
- java.lang.Object
-
- org.opends.server.replication.server.ChangelogState
-
@Immutable public final class ChangelogState extends Object
This is the changelog state stored in the changelogStateDB. For each replication domain, it contains:- its generationId
- the list of replicaIds composing it
This class is used during replication initialization to decouple the code that reads the changelogStateDB from the code that makes use of its data.
-
-
Field Summary
Fields Modifier and Type Field Description static long
EMPTY_BACKEND_GENERATION_ID
This is the generation id for an empty backend.static long
NO_GENERATION_ID
To be used when the generation id is not set.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ChangelogState
addReplica(DomainReplicaId replica)
Returns a changelog state with the specified replica added if it is not already present.Map<Dn,Long>
getDomainToGenerationId()
Returns the Map of domainBaseDN to generationId.Set<DomainReplicaId>
getRemovedReplicasNotProperlyStopped()
Returns all the replicas whose changelog has been purged and did not send aReplicaOfflineMsg
when they stopped.Set<DomainReplicaId>
getReplicas()
Returns all the replicas which have a dedicated replica DB.static ChangelogState
newChangelogState(Map<Dn,Long> domainToGenerationId, Set<DomainReplicaId> replicas, Set<DomainReplicaId> replicasNotProperlyStopped)
Builds a changelog state.ChangelogState
removeDomain(Dn baseDn)
Returns a new changelog state where supplied replication domain has been removed.ChangelogState
removeReplica(DomainReplicaId replica)
Returns a changelog state with the specified replica removed if it was present.ChangelogState
setDomainGenerationId(Dn baseDn, long generationId)
Returns a new changelog state with the generationId associated to the supplied replication domain.String
toString()
-
-
-
Field Detail
-
NO_GENERATION_ID
public static final long NO_GENERATION_ID
To be used when the generation id is not set.- See Also:
- Constant Field Values
-
EMPTY_BACKEND_GENERATION_ID
public static final long EMPTY_BACKEND_GENERATION_ID
This is the generation id for an empty backend.
-
-
Method Detail
-
newChangelogState
public static ChangelogState newChangelogState(Map<Dn,Long> domainToGenerationId, Set<DomainReplicaId> replicas, Set<DomainReplicaId> replicasNotProperlyStopped)
Builds a changelog state.- Parameters:
domainToGenerationId
- Maps domains to their generation IDsreplicas
- All the replicas having a changelogreplicasNotProperlyStopped
- Replicas whose changelog has been purged and did not send a ReplicaOfflineMsg- Returns:
- a new changelog state
-
setDomainGenerationId
public ChangelogState setDomainGenerationId(Dn baseDn, long generationId)
Returns a new changelog state with the generationId associated to the supplied replication domain.- Parameters:
baseDn
- the targeted replication domain baseDNgenerationId
- the generation Id to set- Returns:
- a new changelog state
-
removeDomain
public ChangelogState removeDomain(Dn baseDn)
Returns a new changelog state where supplied replication domain has been removed.- Parameters:
baseDn
- the replication domain base DN to remove- Returns:
- a new changelog state
-
addReplica
public ChangelogState addReplica(DomainReplicaId replica)
Returns a changelog state with the specified replica added if it is not already present.- Parameters:
replica
- the replica to add- Returns:
- a changelog state
-
removeReplica
public ChangelogState removeReplica(DomainReplicaId replica)
Returns a changelog state with the specified replica removed if it was present.- Parameters:
replica
- the replica to remove- Returns:
- a new changelog state
-
getDomainToGenerationId
public Map<Dn,Long> getDomainToGenerationId()
Returns the Map of domainBaseDN to generationId.- Returns:
- a Map of domainBaseDN to generationId
-
getReplicas
public Set<DomainReplicaId> getReplicas()
Returns all the replicas which have a dedicated replica DB.The returned value is an unmodifiable set of replicas. If the set of replicas known to this RS does not change, then the returned set is always the same. This ensures equality tests on the set return
true
very quickly in case nothing changed. The change number indexer uses this trick to avoid spending too much comparing sets ofDomainReplicaId
s that rarely change.- Returns:
- all the replicas as a Set of
DomainReplicaId
.
-
getRemovedReplicasNotProperlyStopped
public Set<DomainReplicaId> getRemovedReplicasNotProperlyStopped()
Returns all the replicas whose changelog has been purged and did not send aReplicaOfflineMsg
when they stopped.- Returns:
- all the replicas whose changelog has been purged and did not send a
ReplicaOfflineMsg
when they stopped
-
-