| | |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import org.opends.server.replication.common.*; |
| | | import org.opends.server.replication.protocol.*; |
| | | import org.opends.server.replication.server.changelog.api.ChangelogDB; |
| | | import org.opends.server.replication.server.changelog.api.ChangelogException; |
| | | import org.opends.server.replication.server.changelog.api.ReplicaDBCursor; |
| | | import org.opends.server.replication.server.changelog.api.ReplicationDomainDB; |
| | | import org.opends.server.types.*; |
| | | |
| | | import static org.opends.messages.ReplicationMessages.*; |
| | |
| | | private final Queue<MessageHandler> otherHandlers = |
| | | new ConcurrentLinkedQueue<MessageHandler>(); |
| | | |
| | | private final ChangelogDB changelogDB; |
| | | private final ReplicationDomainDB domainDB; |
| | | /** The ReplicationServer that created the current instance. */ |
| | | private ReplicationServer localReplicationServer; |
| | | |
| | |
| | | this.assuredTimeoutTimer = new Timer("Replication server RS(" |
| | | + localReplicationServer.getServerId() |
| | | + ") assured timer for domain \"" + baseDN + "\"", true); |
| | | this.changelogDB = localReplicationServer.getChangelogDB(); |
| | | this.domainDB = |
| | | localReplicationServer.getChangelogDB().getReplicationDomainDB(); |
| | | |
| | | DirectoryServer.registerMonitorProvider(this); |
| | | } |
| | |
| | | { |
| | | try |
| | | { |
| | | if (this.changelogDB.publishUpdateMsg(baseDN, serverId, updateMsg)) |
| | | if (this.domainDB.publishUpdateMsg(baseDN, serverId, updateMsg)) |
| | | { |
| | | /* |
| | | * JNR: Matt and I had a hard time figuring out where to put this |
| | |
| | | */ |
| | | public Set<Integer> getServerIds() |
| | | { |
| | | return changelogDB.getDomainServerIds(baseDN); |
| | | return domainDB.getDomainServerIds(baseDN); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param startAfterCSN |
| | | * Starting point for the cursor. If null, start from the oldest CSN |
| | | * @return a non null {@link ReplicaDBCursor} |
| | | * @see ChangelogDB#getCursorFrom(DN, int, CSN) |
| | | * @see ReplicationDomainDB#getCursorFrom(DN, int, CSN) |
| | | */ |
| | | public ReplicaDBCursor getCursorFrom(int serverId, CSN startAfterCSN) |
| | | { |
| | | return changelogDB.getCursorFrom(baseDN, serverId, startAfterCSN); |
| | | return domainDB.getCursorFrom(baseDN, serverId, startAfterCSN); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public long getCount(int serverId, CSN from, CSN to) |
| | | { |
| | | return changelogDB.getCount(baseDN, serverId, from, to); |
| | | return domainDB.getCount(baseDN, serverId, from, to); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public long getChangesCount() |
| | | { |
| | | return changelogDB.getDomainChangesCount(baseDN); |
| | | return domainDB.getDomainChangesCount(baseDN); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | stopAllServers(true); |
| | | |
| | | changelogDB.shutdownDomain(baseDN); |
| | | domainDB.shutdownDomain(baseDN); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public ServerState getLatestServerState() |
| | | { |
| | | return changelogDB.getDomainNewestCSNs(baseDN); |
| | | return domainDB.getDomainNewestCSNs(baseDN); |
| | | } |
| | | |
| | | /** |
| | |
| | | { |
| | | try |
| | | { |
| | | changelogDB.removeDomain(baseDN); |
| | | domainDB.removeDomain(baseDN); |
| | | } |
| | | catch (ChangelogException e) |
| | | { |
| | |
| | | if (eligibleCSN.olderOrEqual(mostRecentDbCSN)) |
| | | { |
| | | // let's try to seek the first change <= eligibleCSN |
| | | CSN newCSN = changelogDB.getCSNAfter(baseDN, serverId, eligibleCSN); |
| | | CSN newCSN = domainDB.getCSNAfter(baseDN, serverId, eligibleCSN); |
| | | result.update(newCSN); |
| | | } else { |
| | | // for this serverId, all changes in the ChangelogDb are holder |
| | |
| | | */ |
| | | public ServerState getStartState() |
| | | { |
| | | return changelogDB.getDomainOldestCSNs(baseDN); |
| | | return domainDB.getDomainOldestCSNs(baseDN); |
| | | } |
| | | |
| | | /** |
| | |
| | | { |
| | | CSN eligibleCSN = null; |
| | | |
| | | final ServerState newestCSNs = changelogDB.getDomainNewestCSNs(baseDN); |
| | | final ServerState newestCSNs = domainDB.getDomainNewestCSNs(baseDN); |
| | | for (final int serverId : newestCSNs) |
| | | { |
| | | // Consider this producer (DS/db). |
| | |
| | | */ |
| | | public long getLatestDomainTrimDate() |
| | | { |
| | | return changelogDB.getDomainLatestTrimDate(baseDN); |
| | | return domainDB.getDomainLatestTrimDate(baseDN); |
| | | } |
| | | |
| | | /** |