| File was renamed from opends/src/server/org/opends/server/replication/server/changelog/je/DraftCNDbHandler.java |
| | |
| | | * This class publishes some monitoring information below <code> |
| | | * cn=monitor</code>. |
| | | */ |
| | | public class DraftCNDbHandler implements ChangeNumberIndexDB, Runnable |
| | | public class JEChangeNumberIndexDB implements ChangeNumberIndexDB, Runnable |
| | | { |
| | | /** |
| | | * The tracer object for the debug logger. |
| | |
| | | |
| | | |
| | | /** |
| | | * Creates a new dbHandler associated to a given LDAP server. |
| | | * Creates a new JEChangeNumberIndexDB associated to a given LDAP server. |
| | | * |
| | | * @param replicationServer The ReplicationServer that creates this dbHandler. |
| | | * @param replicationServer The ReplicationServer that creates this instance. |
| | | * @param dbenv the Database Env to use to create the ReplicationServer DB. |
| | | * server for this domain. |
| | | * @throws ChangelogException If a database problem happened |
| | | */ |
| | | public DraftCNDbHandler(ReplicationServer replicationServer, |
| | | public JEChangeNumberIndexDB(ReplicationServer replicationServer, |
| | | ReplicationDbEnv dbenv) throws ChangelogException |
| | | { |
| | | this.replicationServer = replicationServer; |
| | |
| | | new AtomicLong((lastRecord != null) ? lastRecord.getChangeNumber() : 0); |
| | | |
| | | // Trimming thread |
| | | thread = new DirectoryThread(this, "Replication DraftCN db"); |
| | | thread = |
| | | new DirectoryThread(this, "Replication ChangeNumberIndexDB Trimmer"); |
| | | thread.start(); |
| | | |
| | | // Monitoring registration |
| | |
| | | db.addRecord(record); |
| | | |
| | | if (debugEnabled()) |
| | | TRACER.debugInfo("In DraftCNDbhandler.add, added: " + record); |
| | | TRACER.debugInfo("In JEChangeNumberIndexDB.add, added: " + record); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | |
| | | public ChangeNumberIndexDBCursor getCursorFrom(long startChangeNumber) |
| | | throws ChangelogException |
| | | { |
| | | return new DraftCNDbIterator(db, startChangeNumber); |
| | | return new JEChangeNumberIndexDBCursor(db, startChangeNumber); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | |
| | | { |
| | | for (int j = 0; j < 50; j++) |
| | | { |
| | | // let's traverse the DraftCNDb |
| | | // let's traverse the CNIndexDB |
| | | if (!cursor.next()) |
| | | { |
| | | cursor.close(); |
| | | return; |
| | | } |
| | | |
| | | // From the draftCNDb change record, get the domain and CSN |
| | | final CNIndexRecord record = cursor.currentRecord(); |
| | | if (baseDNToClear != null && baseDNToClear.equals(record.getBaseDN())) |
| | | { |
| | |
| | | if (domain == null) |
| | | { |
| | | // the domain has been removed since the record was written in the |
| | | // draftCNDb, thus it makes no sense to keep the record in the |
| | | // draftCNDb. |
| | | // CNIndexDB, thus it makes no sense to keep this record in the DB. |
| | | cursor.delete(); |
| | | continue; |
| | | } |
| | |
| | | csnVector = csnStartStates.get(record.getBaseDN()); |
| | | |
| | | if (debugEnabled()) |
| | | TRACER.debugInfo("DraftCNDBHandler:clear() - ChangeVector:" |
| | | TRACER.debugInfo("JEChangeNumberIndexDB:clear() - ChangeVector:" |
| | | + csnVector + " -- StartState:" + startState); |
| | | } |
| | | catch(Exception e) |
| | | { |
| | | // We couldn't parse the mdss from the DraftCNData Value |
| | | // We could not parse the MultiDomainServerState from the record |
| | | cursor.delete(); |
| | | continue; |
| | | } |
| | |
| | | { |
| | | cursor.delete(); |
| | | if (debugEnabled()) |
| | | TRACER.debugInfo("DraftCNDBHandler:clear() - deleted " + csn |
| | | TRACER.debugInfo("JEChangeNumberIndexDB:clear() - deleted " + csn |
| | | + "Not covering startState"); |
| | | continue; |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * This internal class is used to implement the Monitoring capabilities |
| | | * of the dbHandler. |
| | | * This internal class is used to implement the Monitoring capabilities of the |
| | | * JEChangeNumberIndexDB. |
| | | */ |
| | | private class DbMonitorProvider extends MonitorProvider<MonitorProviderCfg> |
| | | { |
| | |
| | | @Override |
| | | public String toString() |
| | | { |
| | | return "draftCNdb:" + " " + firstChangeNumber + " " + lastChangeNumber; |
| | | return "JEChangeNumberIndexDB: " + firstChangeNumber + " " |
| | | + lastChangeNumber; |
| | | } |
| | | |
| | | /** |