public class ChangelogBackend extends LocalBackend<LocalBackendCfg>
ReplicationServer
and is not configurable.
There are two modes to search the changelog:
changeNumber
attribute is not returned with
the entries.ChangeNumberIndexDB
and their attributes are set with the information from the ReplicaDBs. The
changeNumber
attribute value is set from the content of ChangeNumberIndexDB
.Here is the flow of searches within the changelog backend APIs:
search(SearchOperation)
(once, single threaded)changesOnly=false
go through:
registerPersistentSearch(PersistentSearch)
(once, single threaded),search(SearchOperation)
(once, single threaded)ChangelogBackend#notifyChangeNumberEntryAdded(Dn, long, String, UpdateMsg)
, and
ChangelogBackend#notifyCookieEntryAdded(Dn, UpdateMsg)
(multiple times, multi-threaded)changesOnly=true
go through:
registerPersistentSearch(PersistentSearch)
(once, single threaded)ChangelogBackend#notifyChangeNumberEntryAdded(Dn, long, String, UpdateMsg)
, and
ChangelogBackend#notifyCookieEntryAdded(Dn, UpdateMsg)
(multiple times, multi-threaded)ReplicationServer
LocalBackend.BackendOperation
Modifier and Type | Field and Description |
---|---|
static String |
BACKEND_ID
The id of this backend.
|
static Dn |
CHANGELOG_BASE_DN
The base DN for the external change log.
|
Constructor and Description |
---|
ChangelogBackend(ReplicationServer replicationServer,
Predicate<Dn> isEclEnabledDomain)
Creates a new backend with the provided replication server.
|
Modifier and Type | Method and Description |
---|---|
void |
addEntry(Entry entry,
AddOperation addOperation)
Adds the provided entry to this backend.
|
void |
closeBackend()
Performs any necessary work to finally close this backend, particularly closing any underlying databases or
connections and deregistering any suffixes that it manages with the Directory Server.
|
void |
configureBackend(LocalBackendCfg config,
ServerContext serverContext)
Configure this backend based on the information in the provided configuration.
|
void |
deleteEntry(Dn entryDN,
DeleteOperation deleteOperation)
Removes the specified entry from this backend.
|
Set<Dn> |
getBaseDNs()
Retrieves the set of base-level DNs that may be used within this backend.
|
Entry |
getEntry(Dn entryDN)
Retrieves the requested entry from this backend.
|
long |
getEntryCount()
Retrieves the total number of entries contained in this backend, if that information is available.
|
long |
getNumberOfChildren(Dn parentDN)
Retrieves the number of subordinates immediately below the requested entry.
|
long |
getNumberOfEntriesInBaseDN(Dn baseDN)
Retrieves the number of entries for the specified base DN including all entries from the requested entry to the
lowest level in the tree.
|
Set<String> |
getSupportedControls()
Retrieves the OIDs of the controls that may be supported by this backend.
|
ConditionResult |
hasSubordinates(Dn entryDN)
Indicates whether the requested entry has any subordinates.
|
boolean |
isIndexed(AttributeType attributeType,
IndexType indexType)
Indicates whether search operations which target the specified attribute in the indicated manner would be
considered indexed in this backend.
|
boolean |
isPublicBackend()
Indicates whether the base DNs of this backend should be considered public or private.
|
void |
notifyChangeNumberEntryAdded(Dn baseDN,
long changeNumber,
String cookie,
LDAPUpdateMsg updateMsg)
Notifies persistent searches of this backend that a new change number entry was added to it.
|
void |
notifyCookieEntryAdded(Dn baseDN,
LDAPUpdateMsg updateMsg)
Notifies persistent searches of this backend that a new cookie entry was added to it.
|
void |
openBackend()
Opens this backend based on the information provided when the backend was configured.
|
void |
registerPersistentSearch(PersistentSearch pSearch)
Registers the provided persistent search operation with this backend so that it will be notified of any add,
delete, modify, or modify DN operations that are performed.
|
void |
renameEntry(Dn currentDN,
Entry entry,
ModifyDnOperation modifyDNOperation)
Moves and/or renames the provided entry in this backend, altering any subordinate entries as necessary.
|
void |
replaceEntry(Entry oldEntry,
Entry newEntry,
ModifyOperation modifyOperation)
Replaces the specified entry with the provided entry in this backend.
|
void |
search(SearchOperation searchOperation)
Processes the specified search in this backend.
|
static void |
updateCookieToMediumConsistencyPoint(MultiDomainServerState cookie,
ECLMultiDomainDBCursor cursor,
ChangeNumberIndexRecord cnIndexRecord)
Rebuilds the changelogcookie starting at the newest change number index record.
|
createBackup, deregisterBackendMonitor, entryExists, exportLDIF, finalizeBackend, getLocalBackendMonitor, getPersistentSearches, getWritabilityMode, handle, handlesEntry, handlesEntry, importLDIF, isIndexed, rebuildBackend, registerBackendMonitor, removeBackup, restoreBackup, setWritabilityMode, supports, supportsControl, verifyBackend
getBackendID, getHealthStatus, getSupportedFeatures, isConfigurationAcceptable, setBackendID, toString
public static final String BACKEND_ID
public static final Dn CHANGELOG_BASE_DN
public ChangelogBackend(ReplicationServer replicationServer, Predicate<Dn> isEclEnabledDomain)
replicationServer
- The replication server on which the changes are read.isEclEnabledDomain
- Returns whether a domain is enabled for the external changelog.public void configureBackend(LocalBackendCfg config, ServerContext serverContext) throws ConfigException
Backend
configureBackend
in class Backend<LocalBackendCfg>
config
- The configuration of this backend.serverContext
- The server context for this instanceConfigException
- If there is an error in the configuration.public void openBackend() throws InitializationException
LocalBackend
openBackend
in class LocalBackend<LocalBackendCfg>
InitializationException
- If a problem occurs during opening that is not related to the server configuration.Backend.configureBackend(C, org.opends.server.core.ServerContext)
public boolean isPublicBackend()
Backend
This method also controls the visibility of the associated naming contexts. i.e. if any base DN of this backend is a naming context, then it will be public or private, based on the value returned by this method.
Reminder: Public naming contexts are returned when querying the root DSE entry.
isPublicBackend
in class Backend<LocalBackendCfg>
true
if this backend's baseDNs could be exposed as a public naming context, false
if they
must remain private naming contexts.public void closeBackend()
LocalBackend
It will be called as final step of finalizeBackend()
, so subclasses might override it.
closeBackend
in class LocalBackend<LocalBackendCfg>
public Set<Dn> getBaseDNs()
Backend
getBaseDNs
in class Backend<LocalBackendCfg>
public boolean isIndexed(AttributeType attributeType, IndexType indexType)
LocalBackend
true
for the specified attribute and index type.isIndexed
in class LocalBackend<LocalBackendCfg>
attributeType
- The attribute type for which to make the determination.indexType
- The index type for which to make the determination.true
if search operations targeting the specified attribute in the indicated manner should be
considered indexed, or false
if not.public Entry getEntry(Dn entryDN) throws LdapException
LocalBackend
getEntry
in class LocalBackend<LocalBackendCfg>
entryDN
- The distinguished name of the entry to retrieve.null
if the entry does not exist.LdapException
- If a problem occurs while trying to retrieve the entry.public ConditionResult hasSubordinates(Dn entryDN) throws LdapException
LocalBackend
hasSubordinates
in class LocalBackend<LocalBackendCfg>
entryDN
- The distinguished name of the entry.ConditionResult.TRUE
if the entry has one or more subordinates or ConditionResult.FALSE
otherwise or ConditionResult.UNDEFINED
if it can not be determined.LdapException
- If a problem occurs while trying to retrieve the entry.public long getNumberOfEntriesInBaseDN(Dn baseDN) throws LdapException
LocalBackend
getNumberOfEntriesInBaseDN
in class LocalBackend<LocalBackendCfg>
baseDN
- The base distinguished name.LdapException
- If baseDN isn't a base dn managed by this backend or if a problem occurs while trying to retrieve the
entry.public long getNumberOfChildren(Dn parentDN) throws LdapException
LocalBackend
getNumberOfChildren
in class LocalBackend<LocalBackendCfg>
parentDN
- The distinguished name of the parent.LdapException
- If baseDN isn't a base dn managed by this backend or if a problem occurs while trying to retrieve the
entry.public void notifyCookieEntryAdded(Dn baseDN, LDAPUpdateMsg updateMsg) throws ChangelogException
Note: This method correspond to the "persistent search" phase. It is executed multiple times per persistent search, multi-threaded, until the persistent search is cancelled.
This method must only be called after the provided data have been persisted to disk.
baseDN
- the baseDN of the newly added entry.updateMsg
- the update message of the newly added entryChangelogException
- If a problem occurs while notifying of the newly added entry.public void notifyChangeNumberEntryAdded(Dn baseDN, long changeNumber, String cookie, LDAPUpdateMsg updateMsg) throws ChangelogException
Note: This method correspond to the "persistent search" phase. It is executed multiple times per persistent search, multi-threaded, until the persistent search is cancelled.
This method must only be called after the provided data have been persisted to disk.
baseDN
- the baseDN of the newly added entry.changeNumber
- the change number of the newly added entry. It will be greater than zero for entries added to the
change number index and less than or equal to zero for entries added to any replica DBcookie
- a string representing the cookie of the newly added entry. This is only meaningful for entries added
to the change number indexupdateMsg
- the update message of the newly added entryChangelogException
- If a problem occurs while notifying of the newly added entry.public void addEntry(Entry entry, AddOperation addOperation) throws LdapException
LocalBackend
addEntry
in class LocalBackend<LocalBackendCfg>
entry
- The entry to add to this backend.addOperation
- The add operation with which the new entry is associated. This may be null
for adds performed
internally.LdapException
- If a problem occurs while trying to add the entry.CancelledResultException
- If this backend noticed and reacted to a request to cancel or abandon the add operation.public void deleteEntry(Dn entryDN, DeleteOperation deleteOperation) throws LdapException
LocalBackend
deleteEntry
in class LocalBackend<LocalBackendCfg>
entryDN
- The DN of the entry to remove from this backend.deleteOperation
- The delete operation with which this action is associated. This may be null
for deletes
performed internally.LdapException
- If a problem occurs while trying to remove the entry.CancelledResultException
- If this backend noticed and reacted to a request to cancel or abandon the delete operation.public void replaceEntry(Entry oldEntry, Entry newEntry, ModifyOperation modifyOperation) throws LdapException
LocalBackend
replaceEntry
in class LocalBackend<LocalBackendCfg>
oldEntry
- The original entry that is being replaced.newEntry
- The new entry to use in place of the existing entry with the same DN.modifyOperation
- The modify operation with which this action is associated. This may be null
for modifications
performed internally.LdapException
- If a problem occurs while trying to replace the entry.CancelledResultException
- If this backend noticed and reacted to a request to cancel or abandon the modify operation.public void renameEntry(Dn currentDN, Entry entry, ModifyDnOperation modifyDNOperation) throws LdapException
LocalBackend
renameEntry
in class LocalBackend<LocalBackendCfg>
currentDN
- The current DN of the entry to be moved/renamed.entry
- The new content to use for the entry.modifyDNOperation
- The modify DN operation with which this action is associated. This may be null
for modify DN
operations performed internally.LdapException
- If a problem occurs while trying to perform the rename.CancelledResultException
- If this backend noticed and reacted to a request to cancel or abandon the modify DN operation.public void search(SearchOperation searchOperation) throws LdapException
SearchOperation.returnEntry
method. The caller is not required to have any locks when calling this
operation.
Runs the "initial search" phase (as opposed to a "persistent search" phase). The "initial search" phase is the
only search run by normal searches, but it is also run by persistent searches with
changesOnly=false
. Persistent searches with changesOnly=true
never execute this code.
Note: this method is executed only once per persistent search, single threaded.
search
in class LocalBackend<LocalBackendCfg>
searchOperation
- The search operation to be processed.LdapException
- If a problem occurs while processing the search.CancelledResultException
- If this backend noticed and reacted to a request to cancel or abandon the search operation.public Set<String> getSupportedControls()
Backend
getSupportedControls
in class Backend<LocalBackendCfg>
public long getEntryCount()
LocalBackend
getEntryCount
in class LocalBackend<LocalBackendCfg>
public void registerPersistentSearch(PersistentSearch pSearch) throws LdapException
LocalBackend
registerPersistentSearch
in class LocalBackend<LocalBackendCfg>
pSearch
- The persistent search operation to register with this backendLdapException
- If a problem occurs while registering the persistent searchpublic static void updateCookieToMediumConsistencyPoint(MultiDomainServerState cookie, ECLMultiDomainDBCursor cursor, ChangeNumberIndexRecord cnIndexRecord) throws ChangelogException
It updates the provided cookie with the changes from the provided ECL cursor, up to (and including) the provided change number index record.
Therefore, after calling this method, the cursor is positioned to the change immediately following the provided change number index record.
cookie
- the cookie to updatecursor
- the cursor where to read changes fromcnIndexRecord
- the change number index record to go right afterChangelogException
- if any problem occursCopyright 2010-2022 ForgeRock AS.