Class ReplicaChangelogImpl

java.lang.Object
org.forgerock.opendj.server.leaderbasedreplication.ReplicaChangelogImpl
All Implemented Interfaces:
ReplicaChangelog, ChangelogContext

public class ReplicaChangelogImpl extends Object implements ChangelogContext, ReplicaChangelog
Class responsible for interactions with the changelog of a replica in the context of LAR.
  • it handles the communication with core registry to retrieve the topology
  • it fetches changes from remote replicas and appends them to the changelog
  • it triggers the purge of outdated changes from the changelog
  • it appends local changes received from the replica clients to the changelog
  • Field Details

  • Constructor Details

    • ReplicaChangelogImpl

      public ReplicaChangelogImpl(ServerContext serverContext, ReplicaId replicaId, ReplicaClient replicaClient, Stoppable parent) throws ConfigException
      Creates a new ReplicaChangelogImpl.
      Parameters:
      serverContext - server context
      replicaId - replica id
      replicaClient - replica client
      parent - parent
      Throws:
      ConfigException - if a problem occurs
  • Method Details

    • start

      public void start()
      Description copied from interface: ReplicaChangelog
      Starts the changelog.
      Specified by:
      start in interface ReplicaChangelog
    • stop

      public void stop()
      Description copied from interface: ReplicaChangelog
      Stops the changelog.
      Specified by:
      stop in interface ReplicaChangelog
    • shutdown

      public void shutdown()
      Description copied from interface: ChangelogContext
      Shutdown replication.
      Specified by:
      shutdown in interface ChangelogContext
      Specified by:
      shutdown in interface ReplicaChangelog
    • csnNow

      public Csn csnNow()
      Description copied from interface: ReplicaChangelog
      Returns a Csn representing the current time, not attached to an update. It has a similar function to the ChangeTime heartbeat we used to have in MultiMaster Replication
      Specified by:
      csnNow in interface ReplicaChangelog
      Returns:
      a Csn representing the current time
    • getChangelogState

      public Map<Domain, ReplicaState> getChangelogState()
      Description copied from interface: ReplicaChangelog
      Returns the changelog state.
      Specified by:
      getChangelogState in interface ReplicaChangelog
      Returns:
      the changelog state
    • purgeUpTo

      public void purgeUpTo(Csn purgeCsn)
      Removes all the changes from the changelog which have a Csn older than the one specified.
      Specified by:
      purgeUpTo in interface ReplicaChangelog
      Parameters:
      purgeCsn - The Csn of the oldest change to keep in the changelog. All changes which are older than this Csn will be deleted.
    • getOldestChangeOfStream

      public Csn getOldestChangeOfStream(Domain domain, StreamId streamId)
      Description copied from interface: ReplicaChangelog
      Returns the oldest change of the provided stream for the given domain.
      Specified by:
      getOldestChangeOfStream in interface ReplicaChangelog
      Parameters:
      domain - the domain to get the oldest change from
      streamId - the stream to get the oldest change from
      Returns:
      the oldest change of the provided stream
    • appendUserRequest

      public boolean appendUserRequest(ReplicatedDomain domain, PreOperationOperation operation)
      Description copied from interface: ReplicaChangelog
      Appends a user request to the changelog.
      Specified by:
      appendUserRequest in interface ReplicaChangelog
      Parameters:
      domain - the replicated domain
      operation - the operation to append
      Returns:
      the Csn of the appended operation
    • getReplicationServerId

      public ReplicationServerId getReplicationServerId()
      Description copied from interface: ChangelogContext
      Returns the replication server id.
      Specified by:
      getReplicationServerId in interface ChangelogContext
      Returns:
      the replication server id
    • getPurgeDelay

      public Duration getPurgeDelay()
      Description copied from interface: ChangelogContext
      Returns the purge delay.
      Specified by:
      getPurgeDelay in interface ChangelogContext
      Returns:
      the purge delay
    • getGenerationId

      public GenerationId getGenerationId(Dn baseDn)
      Description copied from interface: ChangelogContext
      Returns the generation id of the replica.
      Specified by:
      getGenerationId in interface ChangelogContext
      Parameters:
      baseDn - the base dn of the replication domain
      Returns:
      the generation id of the replica
    • setGenerationId

      public void setGenerationId(Dn baseDn, GenerationId generationId)
      Description copied from interface: ChangelogContext
      Set the generation id of the provided replication domain.
      Specified by:
      setGenerationId in interface ChangelogContext
      Parameters:
      baseDn - the base dn of the replication domain
      generationId - the generation id to set
    • fetchChangelogChanges

      public void fetchChangelogChanges(Dn domain, ReplicaState fromStartingPoint, SearchResultHandler handler) throws LdapException
      Description copied from interface: ReplicaChangelog
      Fetches changelog changes for the specified domain starting from the given replica state.
      Specified by:
      fetchChangelogChanges in interface ReplicaChangelog
      Parameters:
      domain - the base DN of the domain
      fromStartingPoint - the starting point of the changes to fetch
      handler - the handler to process the fetched results
      Throws:
      LdapException
    • diskFullThresholdReached

      public void diskFullThresholdReached()
      Description copied from interface: ChangelogContext
      Notify the disk is full.
      Specified by:
      diskFullThresholdReached in interface ChangelogContext
    • failedToRestartAfterDiskFullRecovers

      public boolean failedToRestartAfterDiskFullRecovers()
      Description copied from interface: ChangelogContext
      Returns whether after disk space recovers, we should consider the disk still full for internal management..
      Specified by:
      failedToRestartAfterDiskFullRecovers in interface ChangelogContext
      Returns:
      whether after disk space recovers, we should consider the disk still full for internal management.