| | |
| | | */ |
| | | public abstract class ReplicationDomain |
| | | { |
| | | |
| | | /** Contains all the attributes included for the ECL (External Changelog). */ |
| | | @Immutable |
| | | private static final class ECLIncludes |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Current status for this replicated domain. |
| | | */ |
| | | /** Current status for this replicated domain. */ |
| | | private ServerStatus status = ServerStatus.NOT_CONNECTED_STATUS; |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | |
| | | */ |
| | | private Date lastStatusChangeDate = new Date(); |
| | | |
| | | /** |
| | | * The state maintained by the Concrete Class. |
| | | */ |
| | | /** The state maintained by the Concrete Class. */ |
| | | private final ServerState state; |
| | | |
| | | /** |
| | | * The generator that will be used to generate {@link CSN} |
| | | * for this domain. |
| | | */ |
| | | /** The generator that will be used to generate {@link CSN} for this domain. */ |
| | | private final CSNGenerator generator; |
| | | |
| | | private final AtomicReference<ECLIncludes> eclIncludes = new AtomicReference<>(new ECLIncludes()); |
| | |
| | | setNewStatus(event); |
| | | } |
| | | |
| | | /** |
| | | * Called when first connection or disconnection detected. |
| | | */ |
| | | /** Called when first connection or disconnection detected. */ |
| | | void toNotConnectedStatus() |
| | | { |
| | | // Go into not connected status |
| | |
| | | * |
| | | * @return the initWindow |
| | | */ |
| | | protected int getInitWindow() |
| | | private int getInitWindow() |
| | | { |
| | | return config.getInitializationWindowSize(); |
| | | } |
| | |
| | | return broker.getRsInfos(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Gets the server ID of the Replication Server to which the domain |
| | | * is currently connected. |
| | |
| | | return broker.getRsServerId(); |
| | | } |
| | | |
| | | /** |
| | | * Increment the number of processed updates. |
| | | */ |
| | | /** Increment the number of processed updates. */ |
| | | private void incProcessedUpdates() |
| | | { |
| | | numProcessedUpdates.incrementAndGet(); |
| | |
| | | |
| | | if ( hasTimeout || hasReplayErrors || hasWrongStatus) |
| | | { |
| | | /* |
| | | Some problems detected: message did not correctly reach every |
| | | requested servers. Log problem |
| | | */ |
| | | // Some problems detected: message did not correctly reach every requested servers. |
| | | logger.info(NOTE_DS_RECEIVED_ACK_ERROR, getBaseDN(), getServerId(), update, ack.errorsToString()); |
| | | |
| | | List<Integer> failedServers = ack.getFailedServers(); |
| | |
| | | private final int serverIdToInitialize; |
| | | private final int initWindow; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Constructor for the ExportThread. |
| | | * |
| | |
| | | this.initWindow = initWindow; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Run method for this class. |
| | | */ |
| | | @Override |
| | | public void run() |
| | | { |
| | |
| | | } |
| | | |
| | | /** This class contains the context related to an import or export launched on the domain. */ |
| | | protected class ImportExportContext |
| | | protected static final class ImportExportContext |
| | | { |
| | | /** The private task that initiated the operation. */ |
| | | private Task initializeTask; |
| | |
| | | */ |
| | | private int initNumLostConnections; |
| | | |
| | | /** |
| | | * Request message sent when this server has the initializeFromRemote task. |
| | | */ |
| | | /** Request message sent when this server has the initializeFromRemote task. */ |
| | | private InitializeRequestMsg initReqMsgSent; |
| | | |
| | | /** |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() |
| | | { |
| | |
| | | |
| | | return this.slowestServerId; |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | getBaseDN(), getServerId(), serverToInitialize, cause); |
| | | } |
| | | |
| | | |
| | | if (exportRootException != null) |
| | | { |
| | | throw exportRootException; |
| | |
| | | int serverId = it.next(); |
| | | if (ieCtx.failureList.contains(serverId)) |
| | | { |
| | | /* |
| | | this server has already been in error during initialization |
| | | don't wait for it |
| | | */ |
| | | /* this server has already been in error during initialization don't wait for it */ |
| | | continue; |
| | | } |
| | | |
| | |
| | | && initFromTask != null |
| | | && ++ieCtx.attemptCnt < 2) |
| | | { |
| | | /* |
| | | Worth a new attempt |
| | | since initFromTask is in this server, connection is ok |
| | | */ |
| | | /* Worth a new attempt since initFromTask is in this server, connection is ok */ |
| | | try |
| | | { |
| | | /* |
| | |
| | | */ |
| | | Thread.sleep(1000); |
| | | |
| | | /* |
| | | Restart the whole import protocol exchange by sending again |
| | | the request |
| | | */ |
| | | /* Restart the whole import protocol exchange by sending again the request */ |
| | | logger.info(NOTE_RESENDING_INIT_FROM_REMOTE_REQUEST, |
| | | ieCtx.getException().getLocalizedMessage()); |
| | | |
| | |
| | | return lastStatusChangeDate; |
| | | } |
| | | |
| | | /** |
| | | * Resets the values of the monitoring counters. |
| | | */ |
| | | /** Resets the values of the monitoring counters. */ |
| | | private void resetMonitoringCounters() |
| | | { |
| | | numProcessedUpdates = new AtomicInteger(0); |
| | |
| | | synchronized (sessionLock) |
| | | { |
| | | /* |
| | | Stop the broker first in order to prevent the listener from |
| | | reconnecting - see OPENDJ-457. |
| | | * Stop the broker first in order to prevent the listener from reconnecting - see OPENDJ-457. |
| | | */ |
| | | if (broker != null) |
| | | { |
| | |
| | | */ |
| | | public abstract long countEntries() throws DirectoryException; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This method should handle the processing of {@link UpdateMsg} receive from |
| | | * remote replication entities. |
| | |
| | | return current != updated; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Get the attributes to include in each change for the ECL. |
| | | * |
| | |
| | | return eclIncludes.get().includedAttrsAllServers; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Get the attributes to include in each delete change for the ECL. |
| | | * |
| | |
| | | return eclIncludes.get().includedAttrsForDeletesAllServers; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Get the attributes to include in each change for the ECL for a given |
| | | * serverId. |
| | |
| | | return eclIncludes.get().includedAttrsByServer.get(serverId); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Get the attributes to include in each change for the ECL for a given |
| | | * serverId. |
| | |
| | | && cfg.getAssuredSdLevel() != getAssuredSdLevel(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() |
| | | { |