public class FileChangelogDB extends Object implements ChangelogDB, ReplicationDomainDB
Constructor and Description |
---|
FileChangelogDB(ReplicationServer replicationServer,
String dbDirectoryPath,
CryptoSuite cryptoSuite)
Creates a new changelog DB.
|
Modifier and Type | Method and Description |
---|---|
void |
clearDB()
Clears all records from the changelog (does not remove the changelog itself).
|
ChangeNumberIndexDB |
getChangeNumberIndexDB()
Returns the
ChangeNumberIndexDB object. |
DBCursor<UpdateMsg> |
getCursorFrom(org.forgerock.opendj.ldap.Dn baseDN,
int serverId,
CSN startCSN,
DBCursor.CursorOptions options)
|
DBCursor<UpdateMsg> |
getCursorFrom(org.forgerock.opendj.ldap.Dn baseDN,
ServerState startState,
DBCursor.CursorOptions options)
Generates a
DBCursor across all the replicaDBs for the specified
replication domain starting before, at or after the provided
ServerState for each replicaDB, depending on the provided matching
and positioning strategies. |
MultiDomainDBCursor |
getCursorFrom(MultiDomainServerState startState,
DBCursor.CursorOptions options)
Generates a
DBCursor across all the domains starting before, at or
after the provided MultiDomainServerState for each domain,
depending on the provided matching and positioning strategies. |
MultiDomainDBCursor |
getCursorFrom(MultiDomainServerState startState,
DBCursor.CursorOptions options,
Set<org.forgerock.opendj.ldap.Dn> excludedDomainDns)
Generates a
DBCursor across all the domains starting before, at or
after the provided MultiDomainServerState for each domain,
excluding a provided set of domain DNs. |
ServerState |
getDomainNewestCSNs(org.forgerock.opendj.ldap.Dn baseDN)
Returns the newest
CSN s from the replicaDBs for each serverId in
the specified replication domain. |
ServerState |
getDomainOldestCSNs(org.forgerock.opendj.ldap.Dn baseDN)
Returns the oldest
CSN s from the replicaDBs for each serverId in
the specified replication domain. |
ReplicationDomainDB |
getReplicationDomainDB()
Returns the
ReplicationDomainDB object. |
void |
initializeDB()
Initializes the replication database by reading its previous state and
building the relevant ReplicaDBs according to the previous state.
|
void |
notifyReplicaOffline(org.forgerock.opendj.ldap.Dn baseDN,
CSN offlineCSN)
Let the DB know this replica is going down.
|
boolean |
publishUpdateMsg(org.forgerock.opendj.ldap.Dn baseDN,
UpdateMsg updateMsg)
Publishes the provided change to the changelog DB for the specified
serverId and replication domain.
|
void |
removeDB()
Removes the changelog database directory.
|
void |
removeDomain(org.forgerock.opendj.ldap.Dn baseDN)
Removes all the data relating to the specified replication domain and
shutdown all its replica databases.
|
void |
replicaHeartbeat(org.forgerock.opendj.ldap.Dn baseDN,
CSN heartbeatCSN)
Let the DB know this replica is alive.
|
void |
setComputeChangeNumber(boolean computeChangeNumber)
Sets whether the replication database must compute change numbers for
replicated changes.
|
void |
setPurgeDelay(long purgeDelayInMillis)
Sets the purge delay for the replication database.
|
void |
shutdownDB()
Shutdown the replication database.
|
void |
unregisterCursor(DBCursor<?> cursor)
Unregisters the provided cursor from this replication domain.
|
public FileChangelogDB(ReplicationServer replicationServer, String dbDirectoryPath, CryptoSuite cryptoSuite) throws org.forgerock.opendj.config.server.ConfigException
replicationServer
- the local replication server.dbDirectoryPath
- the path where the changelog files reside.cryptoSuite
- the cryptosuite to use for encryptionorg.forgerock.opendj.config.server.ConfigException
- if a problem occurs opening the supplied directorypublic void initializeDB()
ChangelogDB
initializeDB
in interface ChangelogDB
public void shutdownDB() throws ChangelogException
ChangelogDB
shutdownDB
in interface ChangelogDB
ChangelogException
- If a database problem happenedpublic void clearDB() throws ChangelogException
ChangelogException
- If an error occurs when clearing the changelog.public void removeDB() throws ChangelogException
ChangelogDB
removeDB
in interface ChangelogDB
ChangelogException
- If a database problem happenedpublic ServerState getDomainOldestCSNs(org.forgerock.opendj.ldap.Dn baseDN)
ReplicationDomainDB
CSN
s from the replicaDBs for each serverId in
the specified replication domain.getDomainOldestCSNs
in interface ReplicationDomainDB
baseDN
- the replication domain baseDNpublic ServerState getDomainNewestCSNs(org.forgerock.opendj.ldap.Dn baseDN)
ReplicationDomainDB
CSN
s from the replicaDBs for each serverId in
the specified replication domain.getDomainNewestCSNs
in interface ReplicationDomainDB
baseDN
- the replication domain baseDNpublic void removeDomain(org.forgerock.opendj.ldap.Dn baseDN) throws ChangelogException
ReplicationDomainDB
removeDomain
in interface ReplicationDomainDB
baseDN
- the replication domain baseDNChangelogException
- If a database problem happenedpublic void setPurgeDelay(long purgeDelayInMillis)
ChangelogDB
Purging happens on a best effort basis, i.e. the purge delay is used by the replication database to know which data can be purged, but there are no guarantees on when the purging will actually happen.
setPurgeDelay
in interface ChangelogDB
purgeDelayInMillis
- the purge delay in millisecondspublic void setComputeChangeNumber(boolean computeChangeNumber) throws ChangelogException
ChangelogDB
setComputeChangeNumber
in interface ChangelogDB
computeChangeNumber
- whether to compute change numbers for replicated changesChangelogException
- If a database problem happenedpublic ChangeNumberIndexDB getChangeNumberIndexDB()
ChangelogDB
ChangeNumberIndexDB
object.getChangeNumberIndexDB
in interface ChangelogDB
ChangeNumberIndexDB
objectpublic ReplicationDomainDB getReplicationDomainDB()
ChangelogDB
ReplicationDomainDB
object.getReplicationDomainDB
in interface ChangelogDB
ReplicationDomainDB
objectpublic MultiDomainDBCursor getCursorFrom(MultiDomainServerState startState, DBCursor.CursorOptions options) throws ChangelogException
ReplicationDomainDB
DBCursor
across all the domains starting before, at or
after the provided MultiDomainServerState
for each domain,
depending on the provided matching and positioning strategies.
When the cursor is not used anymore, client code MUST call the
DBCursor.close()
method to free the resources and locks used by the
cursor.
getCursorFrom
in interface ReplicationDomainDB
startState
- Starting point for each domain cursor. If any ServerState
for a domain is null, then start from the oldest CSN for each
replicaDBsoptions
- The cursor optionsDBCursor
ChangelogException
- If a database problem happened#getCursorFrom(Dn, ServerState, CursorOptions)
public MultiDomainDBCursor getCursorFrom(MultiDomainServerState startState, DBCursor.CursorOptions options, Set<org.forgerock.opendj.ldap.Dn> excludedDomainDns) throws ChangelogException
ReplicationDomainDB
DBCursor
across all the domains starting before, at or
after the provided MultiDomainServerState
for each domain,
excluding a provided set of domain DNs.
When the cursor is not used anymore, client code MUST call the
DBCursor.close()
method to free the resources and locks used by the
cursor.
getCursorFrom
in interface ReplicationDomainDB
startState
- Starting point for each domain cursor. If any ServerState
for a domain is null, then start from the oldest CSN for each
replicaDBsoptions
- The cursor optionsexcludedDomainDns
- Every domain appearing in this set is excluded from the cursorDBCursor
ChangelogException
- If a database problem happened#getCursorFrom(Dn, ServerState, CursorOptions)
public DBCursor<UpdateMsg> getCursorFrom(org.forgerock.opendj.ldap.Dn baseDN, ServerState startState, DBCursor.CursorOptions options) throws ChangelogException
ReplicationDomainDB
DBCursor
across all the replicaDBs for the specified
replication domain starting before, at or after the provided
ServerState
for each replicaDB, depending on the provided matching
and positioning strategies.
When the cursor is not used anymore, client code MUST call the
DBCursor.close()
method to free the resources and locks used by the
cursor.
getCursorFrom
in interface ReplicationDomainDB
baseDN
- the replication domain baseDNstartState
- Starting point for each ReplicaDB cursor. If any CSN for a
replicaDB is null, then start from the oldest CSN for this
replicaDBoptions
- The cursor optionsDBCursor
ChangelogException
- If a database problem happened#getCursorFrom(Dn, int, CSN, CursorOptions)
public DBCursor<UpdateMsg> getCursorFrom(org.forgerock.opendj.ldap.Dn baseDN, int serverId, CSN startCSN, DBCursor.CursorOptions options) throws ChangelogException
ReplicationDomainDB
DBCursor
for one replicaDB for the specified
replication domain and serverId starting before, at or after the provided
CSN
, depending on the provided matching and positioning strategies.
When the cursor is not used anymore, client code MUST call the
DBCursor.close()
method to free the resources and locks used by the
cursor.
getCursorFrom
in interface ReplicationDomainDB
baseDN
- the replication domain baseDN of the replicaDBserverId
- the serverId of the replicaDBstartCSN
- Starting point for the ReplicaDB cursor. If the CSN is null, then
start from the oldest CSN for this replicaDBoptions
- The cursor optionsDBCursor
ChangelogException
- If a database problem happenedpublic void unregisterCursor(DBCursor<?> cursor)
ReplicationDomainDB
unregisterCursor
in interface ReplicationDomainDB
cursor
- the cursor to unregister.public boolean publishUpdateMsg(org.forgerock.opendj.ldap.Dn baseDN, UpdateMsg updateMsg) throws ChangelogException
ReplicationDomainDB
publishUpdateMsg
in interface ReplicationDomainDB
baseDN
- the replication domain baseDNupdateMsg
- the update message to publish to the replicaDBChangelogException
- If a database problem happenedpublic void replicaHeartbeat(org.forgerock.opendj.ldap.Dn baseDN, CSN heartbeatCSN) throws ChangelogException
ReplicationDomainDB
This method allows the medium consistency point to move forward in case this replica did not publish new changes.
replicaHeartbeat
in interface ReplicationDomainDB
baseDN
- the replication domain baseDNheartbeatCSN
- The CSN heartbeat sent by this replica (contains the serverId and
timestamp of the heartbeat)ChangelogException
- If a database problem happenedpublic void notifyReplicaOffline(org.forgerock.opendj.ldap.Dn baseDN, CSN offlineCSN) throws ChangelogException
ReplicationDomainDB
This method allows to let the medium consistency point move forward while this replica is offline.
Note: This method must not be called to let the DB know the replica is not sending heartbeats anymore, i.e. it must not be used in case of suspected network partition.
notifyReplicaOffline
in interface ReplicationDomainDB
baseDN
- the replication domain baseDNofflineCSN
- The CSN (serverId and timestamp) for the replica's going offlineChangelogException
- If a database problem happenedCopyright © 2010-2017 ForgeRock AS. All Rights Reserved.