opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
@@ -268,7 +268,7 @@ */ /** Holds the fractional configuration for this domain, if any. */ private FractionalConfig fractionalConfig = null; private FractionalConfig fractionalConfig; /** * The list of attributes that cannot be used in fractional replication @@ -364,8 +364,7 @@ protected ServerStateFlush() { super("Replica DS(" + serverId + ") state checkpointer for domain \"" + baseDn.toString() + "\""); + ") state checkpointer for domain \"" + baseDn + "\""); } /** @@ -412,8 +411,7 @@ protected RSUpdater(CSN replServerMaxCSN) { super("Replica DS(" + serverId + ") missing change publisher for domain \"" + baseDn.toString() + "\""); + ") missing change publisher for domain \"" + baseDn + "\""); this.startCSN = replServerMaxCSN; } @@ -958,7 +956,7 @@ */ public static class AttributeValueStringIterator implements Iterator<String> { private Iterator<AttributeValue> attrValIt = null; private Iterator<AttributeValue> attrValIt; /** * Creates a new AttributeValueStringIterator object. @@ -1104,8 +1102,8 @@ NOTE_ERR_FRACTIONAL_CONFIG_UNKNOWN_OBJECT_CLASS.get(className)); } boolean isExtensibleObjectClass = className. equalsIgnoreCase("extensibleObject"); boolean isExtensibleObjectClass = "extensibleObject".equalsIgnoreCase(className); List<String> attributes = newFractionalSpecificClassesAttributes.get(className); @@ -1124,18 +1122,14 @@ if (attributeType != null) { // No more checking for the extensibleObject class if (!isExtensibleObjectClass) { if (fractionalMode == FractionalConfig.EXCLUSIVE_FRACTIONAL) { if (!isExtensibleObjectClass && fractionalMode == FractionalConfig.EXCLUSIVE_FRACTIONAL // Exclusive mode : the attribute must be optional if (!fractionalClass.isOptional(attributeType)) { throw new ConfigException( NOTE_ERR_FRACTIONAL_CONFIG_NOT_OPTIONAL_ATTRIBUTE. get(attrName, className)); } } && !fractionalClass.isOptional(attributeType)) { throw new ConfigException( NOTE_ERR_FRACTIONAL_CONFIG_NOT_OPTIONAL_ATTRIBUTE.get(attrName, className)); } } else @@ -1144,9 +1138,9 @@ NOTE_ERR_FRACTIONAL_CONFIG_UNKNOWN_ATTRIBUTE_TYPE.get(attrName)); } } } // Check consistency of all classes attributes for (String attrName : newFractionalAllClassesAttributes) { @@ -1221,30 +1215,22 @@ public boolean fractionalFilterOperation( PreOperationModifyDNOperation modifyDNOperation, boolean performFiltering) { boolean inconsistentOperation = false; // Quick exit if not called for analyze and if (performFiltering) if (performFiltering && modifyDNOperation.deleteOldRDN()) { if (modifyDNOperation.deleteOldRDN()) { // The core will remove any occurrence of attribute that was part // of the old RDN, nothing more to do. return true; // Will not be used as analyze was not requested } // The core will remove any occurrence of attribute that was part of the // old RDN, nothing more to do. return true; // Will not be used as analyze was not requested } /* * Create a list of filtered attributes for this entry */ // Create a list of filtered attributes for this entry Entry concernedEntry = modifyDNOperation.getOriginalEntry(); List<String> fractionalConcernedAttributes = createFractionalConcernedAttrList(fractionalConfig, concernedEntry.getObjectClasses().keySet()); boolean fractionalExclusive = fractionalConfig.isFractionalExclusive(); if ( fractionalExclusive && (fractionalConcernedAttributes.isEmpty()) ) if (fractionalExclusive && fractionalConcernedAttributes.isEmpty()) // No attributes to filter return false; @@ -1258,6 +1244,7 @@ * putting a modification to delete the attribute. */ boolean inconsistentOperation = false; RDN rdn = modifyDNOperation.getEntryDN().getRDN(); RDN newRdn = modifyDNOperation.getNewRDN(); @@ -1277,8 +1264,8 @@ break; } } boolean attributeToBeFiltered = ( (fractionalExclusive && found) || (!fractionalExclusive && !found) ); boolean attributeToBeFiltered = (fractionalExclusive && found) || (!fractionalExclusive && !found); if (attributeToBeFiltered && !newRdn.hasAttributeType(attributeType) && !modifyDNOperation.deleteOldRDN()) @@ -1329,7 +1316,7 @@ List<String> fractionalConcernedAttributes = createFractionalConcernedAttrList(fractionalConfig, classes.keySet()); boolean fractionalExclusive = fractionalConfig.isFractionalExclusive(); if ( fractionalExclusive && (fractionalConcernedAttributes.isEmpty()) ) if (fractionalExclusive && fractionalConcernedAttributes.isEmpty()) return false; // No attributes to filter // Prepare list of object classes of the added entry @@ -1572,7 +1559,7 @@ createFractionalConcernedAttrList(fractionalConfig, modifiedEntry.getObjectClasses().keySet()); boolean fractionalExclusive = fractionalConfig.isFractionalExclusive(); if ( fractionalExclusive && (fractionalConcernedAttributes.isEmpty()) ) if (fractionalExclusive && fractionalConcernedAttributes.isEmpty()) // No attributes to filter return FRACTIONAL_HAS_NO_FRACTIONAL_FILTERED_ATTRIBUTES; @@ -1689,7 +1676,7 @@ protected void initializeRemote(int target, int requestorID, Task initTask, int initWindow) throws DirectoryException { if ((target == RoutableMsg.ALL_SERVERS) && fractionalConfig.isFractional()) if (target == RoutableMsg.ALL_SERVERS && fractionalConfig.isFractional()) { Message msg = NOTE_ERR_FRACTIONAL_FORBIDDEN_FULL_UPDATE_FRACTIONAL.get( baseDn.toString(), Integer.toString(getServerId())); @@ -1719,8 +1706,7 @@ public SynchronizationProviderResult handleConflictResolution( PreOperationDeleteOperation deleteOperation) { if ((!deleteOperation.isSynchronizationOperation()) && (!brokerIsConnected())) if (!deleteOperation.isSynchronizationOperation() && !brokerIsConnected()) { Message msg = ERR_REPLICATION_COULD_NOT_CONNECT.get(baseDn.toString()); return new SynchronizationProviderResult.StopProcessing( @@ -1872,8 +1858,8 @@ { DN entryDN = addOperation.getEntryDN(); DN parentDnFromEntryDn = entryDN.getParentDNInSuffix(); if ((parentDnFromEntryDn != null) && (!parentDnFromCtx.equals(parentDnFromEntryDn))) if (parentDnFromEntryDn != null && !parentDnFromCtx.equals(parentDnFromEntryDn)) { // parentEntry has been renamed // replication name conflict resolution is expected to fix that @@ -1999,8 +1985,8 @@ * parent is the same as when the operation was performed. */ String newParentId = findEntryUUID(modifyDNOperation.getNewSuperior()); if ((newParentId != null) && (ctx.getNewSuperiorEntryUUID() != null) && (!newParentId.equals(ctx.getNewSuperiorEntryUUID()))) if (newParentId != null && ctx.getNewSuperiorEntryUUID() != null && !newParentId.equals(ctx.getNewSuperiorEntryUUID())) { return new SynchronizationProviderResult.StopProcessing( ResultCode.NO_SUCH_OBJECT, null); @@ -2123,8 +2109,8 @@ // - check for conflicts String modifiedEntryUUID = ctx.getEntryUUID(); String currentEntryUUID = EntryHistorical.getEntryUUID(modifiedEntry); if ((currentEntryUUID != null) && (!currentEntryUUID.equals(modifiedEntryUUID))) if (currentEntryUUID != null && !currentEntryUUID.equals(modifiedEntryUUID)) { /* * The current modified entry is not the same entry as the one on @@ -2272,8 +2258,8 @@ // If the operation is a DELETE on the base entry of the suffix // that is replicated, the generation is now lost because the // DB is empty. We need to save it again the next time we add an entry. if ((op.getOperationType().equals(OperationType.DELETE)) && (((PostOperationDeleteOperation) op).getEntryDN().equals(baseDn))) if (op.getOperationType().equals(OperationType.DELETE) && ((PostOperationDeleteOperation) op).getEntryDN().equals(baseDn)) { generationIdSavedStatus = false; } @@ -2283,15 +2269,12 @@ saveGenerationId(generationId); } } else if (!op.isSynchronizationOperation()) else if (!op.isSynchronizationOperation() && curCSN != null) { // Remove an unsuccessful non-replication operation from the pending // changes list. if (curCSN != null) { pendingChanges.remove(curCSN); pendingChanges.pushCommittedChanges(); } pendingChanges.remove(curCSN); pendingChanges.pushCommittedChanges(); } checkForClearedConflict(op); @@ -2526,7 +2509,7 @@ op = msg.createOperation(conn); dependency = remotePendingChanges.checkDependencies(op, msg); while ((!dependency) && (!replayDone) && (retryCount-- > 0)) while (!dependency && !replayDone && (retryCount-- > 0)) { if (shutdown.get()) { @@ -2694,7 +2677,7 @@ private String logDecodingOperationError(LDAPUpdateMsg msg, Exception e) { Message message = ERR_EXCEPTION_DECODING_OPERATION.get( String.valueOf(msg) + stackTraceToSingleLineString(e)); String.valueOf(msg) + " " + stackTraceToSingleLineString(e)); logError(message); return message.toString(); } @@ -2877,8 +2860,9 @@ for (Modification mod : mods) { AttributeType modAttrType = mod.getAttribute().getAttributeType(); if ((mod.getModificationType() == ModificationType.DELETE) || (mod.getModificationType() == ModificationType.REPLACE)) if ((mod.getModificationType() == ModificationType.DELETE || mod.getModificationType() == ModificationType.REPLACE) && currentRDN.hasAttributeType(modAttrType)) { if (currentRDN.hasAttributeType(modAttrType)) { @@ -3061,9 +3045,9 @@ return true; } if ((result == ResultCode.NO_SUCH_OBJECT) || (result == ResultCode.UNWILLING_TO_PERFORM) || (result == ResultCode.OBJECTCLASS_VIOLATION)) if (result == ResultCode.NO_SUCH_OBJECT || result == ResultCode.UNWILLING_TO_PERFORM || result == ResultCode.OBJECTCLASS_VIOLATION) { /* * The entry or it's new parent has not been found @@ -3156,15 +3140,14 @@ // handleConflict phase does not fail. msg.setParentEntryUUID(null); numUnresolvedNamingConflicts.incrementAndGet(); return false; } else { RDN entryRdn = DN.decode(msg.getDn()).getRDN(); msg.setDn(entryRdn + "," + parentDn); numResolvedNamingConflicts.incrementAndGet(); return false; } return false; } else if (result == ResultCode.ENTRY_ALREADY_EXISTS) { @@ -3629,8 +3612,7 @@ long aGenerationId=-1; if (debugEnabled()) TRACER.debugInfo( "Attempt to read generation ID from DB " + baseDn.toString()); TRACER.debugInfo("Attempt to read generation ID from DB " + baseDn); ByteString asn1BaseDn = ByteString.valueOf(baseDn.toString()); boolean found = false; @@ -3721,17 +3703,15 @@ saveGenerationId(aGenerationId); if (debugEnabled()) TRACER.debugInfo("Generation ID created for domain base DN=" + baseDn.toString() + " generationId=" + aGenerationId); TRACER.debugInfo("Generation ID created for domain base DN=" + baseDn + " generationId=" + aGenerationId); } else { generationIdSavedStatus = true; if (debugEnabled()) TRACER.debugInfo( "Generation ID successfully read from domain base DN=" + baseDn + " generationId=" + aGenerationId); TRACER.debugInfo("Generation ID successfully read from domain base DN=" + baseDn + " generationId=" + aGenerationId); } return aGenerationId; } @@ -3843,7 +3823,7 @@ long genID = 0; Backend backend = retrievesBackend(this.baseDn); long numberOfEntries = backend.numSubordinates(baseDn, true) + 1; long entryCount = ( (numberOfEntries < 1000 )? numberOfEntries : 1000); long entryCount = Math.min(numberOfEntries, 1000); // Acquire a shared lock for the backend. try @@ -3878,8 +3858,7 @@ os = ros; try { os.write((Long.toString(numberOfEntries)). getBytes()); os.write(Long.toString(numberOfEntries).getBytes()); } catch(Exception e) { @@ -4246,7 +4225,7 @@ // Check that there is not already a domain with the same DN DN dn = configuration.getBaseDN(); LDAPReplicationDomain domain = MultimasterReplication.findDomain(dn, null); if ((domain != null) && (domain.baseDn.equals(dn))) if (domain != null && domain.baseDn.equals(dn)) { Message message = ERR_SYNC_INVALID_DN.get(); unacceptableReasons.add(message); @@ -4442,7 +4421,7 @@ "objectClass: top", "objectClass: ds-cfg-external-changelog-domain", "cn: external changelog", "ds-cfg-enabled: " + (!getBackend().isPrivateBackend())); "ds-cfg-enabled: " + !getBackend().isPrivateBackend()); LDIFImportConfig ldifImportConfig = new LDIFImportConfig( new StringReader(ldif)); // No need to validate schema in replication @@ -4568,9 +4547,8 @@ } } catch (Exception e) { Message message = ERR_PUBLISHING_FAKE_OPS.get( baseDn.toNormalizedString(), e.getLocalizedMessage() + stackTraceToSingleLineString(e)); Message message = ERR_PUBLISHING_FAKE_OPS.get(baseDn.toNormalizedString(), e.getLocalizedMessage() + " " + stackTraceToSingleLineString(e)); logError(message); } } @@ -4635,7 +4613,7 @@ while (itOp.hasNext()) { FakeOperation fakeOp = itOp.next(); if ((fakeOp.getCSN().olderOrEqual(endCSN)) if (fakeOp.getCSN().olderOrEqual(endCSN) && state.cover(fakeOp.getCSN())) { lastRetrievedChange = fakeOp.getCSN(); @@ -4663,8 +4641,8 @@ currentStartCSN = endCSN; } } while (pendingChanges.recoveryUntil(lastRetrievedChange) && (op.getResultCode().equals(ResultCode.SUCCESS))); } while (pendingChanges.recoveryUntil(lastRetrievedChange) && op.getResultCode().equals(ResultCode.SUCCESS)); return op.getResultCode().equals(ResultCode.SUCCESS); } @@ -4857,7 +4835,7 @@ try { source = Integer.decode(sourceString); if ((source >= -1) && (source != serverId)) if (source >= -1 && source != serverId) { // TODO Verifies serverID is in the domain // We should check here that this is a server implied @@ -5086,7 +5064,7 @@ /** * Base DN the fractional configuration is for. */ private DN baseDn = null; private DN baseDn; /** * Constructs a new fractional configuration object. @@ -5267,9 +5245,9 @@ Iterator<String> iterator; // Deduce the wished fractional mode if ((exclIt != null) && exclIt.hasNext()) if (exclIt != null && exclIt.hasNext()) { if ((inclIt != null) && inclIt.hasNext()) if (inclIt != null && inclIt.hasNext()) { throw new ConfigException( NOTE_ERR_FRACTIONAL_CONFIG_BOTH_MODES.get()); @@ -5282,7 +5260,7 @@ } else { if ((inclIt != null) && inclIt.hasNext()) if (inclIt != null && inclIt.hasNext()) { fractionalMode = INCLUSIVE_FRACTIONAL; iterator = inclIt; @@ -5307,7 +5285,7 @@ } // Get the class name String classNameLower = st.nextToken().toLowerCase(); boolean allClasses = classNameLower.equals("*"); boolean allClasses = "*".equals(classNameLower); // Get the attributes String attributes = st.nextToken(); st = new StringTokenizer(attributes, ","); @@ -5346,7 +5324,7 @@ return fractionalMode; } // Return type of the parseFractionalConfig method /** Return type of the parseFractionalConfig method */ private static final int NOT_FRACTIONAL = 0; private static final int EXCLUSIVE_FRACTIONAL = 1; private static final int INCLUSIVE_FRACTIONAL = 2; opends/src/server/org/opends/server/replication/server/ReplicationDomainMonitor.java
@@ -99,7 +99,7 @@ * <p> * Guarded by pendingMonitorDataLock. */ private CountDownLatch pendingMonitorDataLatch = null; private CountDownLatch pendingMonitorDataLatch; /** * TODO: Remote monitor data cache lifetime is 500ms/should be configurable. @@ -372,8 +372,8 @@ catch (RuntimeException e) { // FIXME: do we really expect these??? logError(ERR_PROCESSING_REMOTE_MONITOR_DATA.get( e.getMessage() + stackTraceToSingleLineString(e))); logError(ERR_PROCESSING_REMOTE_MONITOR_DATA.get(e.getMessage() + " " + stackTraceToSingleLineString(e))); } finally { opends/src/server/org/opends/server/replication/server/ReplicationServerDomain.java
@@ -152,14 +152,14 @@ * The timer used to run the timeout code (timer tasks) for the assured update * messages we are waiting acks for. */ private Timer assuredTimeoutTimer = null; private Timer assuredTimeoutTimer; /** * Counter used to purge the timer tasks references in assuredTimeoutTimer, * every n number of treated assured messages. */ private int assuredTimeoutTimerPurgeCounter = 0; private ServerState ctHeartbeatState = null; private ServerState ctHeartbeatState; /** * Creates a new ReplicationServerDomain associated to the DN baseDn. @@ -413,6 +413,7 @@ */ MessageBuilder mb = new MessageBuilder(); mb.append(ERR_CHANGELOG_SHUTDOWN_DATABASE_ERROR.get()); mb.append(" "); mb.append(stackTraceToSingleLineString(e)); logError(mb.toMessage()); localReplicationServer.shutdown(); @@ -472,13 +473,13 @@ * Servers that are not in this list are servers not eligible for an ack * request. */ public List<Integer> expectedServers = null; public List<Integer> expectedServers; /** * The constructed ExpectedAcksInfo object to be used when acks will be * received. Null if expectedServers is null. */ public ExpectedAcksInfo expectedAcksInfo = null; public ExpectedAcksInfo expectedAcksInfo; } /** @@ -745,6 +746,7 @@ Integer.toString(localReplicationServer.getServerId()), Integer.toString(origServer.getServerId()), csn.toString(), baseDn)); mb.append(" "); mb.append(stackTraceToSingleLineString(e)); logError(mb.toMessage()); stopServer(origServer, false); @@ -767,7 +769,7 @@ */ private class AssuredTimeoutTask extends TimerTask { private CSN csn = null; private CSN csn; /** * Constructor for the timer task. @@ -822,6 +824,7 @@ Integer.toString(localReplicationServer.getServerId()), Integer.toString(origServer.getServerId()), csn.toString(), baseDn)); mb.append(" "); mb.append(stackTraceToSingleLineString(e)); logError(mb.toMessage()); stopServer(origServer, false); @@ -850,10 +853,7 @@ if (safeRead) { expectedDSInTimeout.incrementAssuredSrSentUpdatesTimeout(); } else { // No SD update sent to a DS (meaningless) } } // else no SD update sent to a DS (meaningless) } else if (expectedRSInTimeout != null) { if (safeRead) @@ -1576,6 +1576,7 @@ */ MessageBuilder mb2 = new MessageBuilder(); mb2.append(ERR_CHANGELOG_ERROR_SENDING_ERROR.get(this.toString())); mb2.append(" "); mb2.append(stackTraceToSingleLineString(ignored)); logError(mb2.toMessage()); stopServer(msgEmitter, false); opends/src/server/org/opends/server/replication/server/changelog/je/DbHandler.java
@@ -110,8 +110,8 @@ private int queueByteSize = 0; private ReplicationDB db; private CSN firstChange = null; private CSN lastChange = null; private CSN firstChange; private CSN lastChange; private int serverId; private String baseDn; private DbMonitorProvider dbMonitor = new DbMonitorProvider(); @@ -376,6 +376,7 @@ { MessageBuilder mb = new MessageBuilder(); mb.append(ERR_EXCEPTION_CHANGELOG_TRIM_FLUSH.get()); mb.append(" "); mb.append(stackTraceToSingleLineString(end)); logError(mb.toMessage()); synchronized (this) opends/src/server/org/opends/server/replication/server/changelog/je/DraftCNDB.java
@@ -58,8 +58,8 @@ private static final DebugTracer TRACER = getTracer(); private static final int DATABASE_EMPTY = 0; private Database db = null; private ReplicationDbEnv dbenv = null; private Database db; private ReplicationDbEnv dbenv; /** * The lock used to provide exclusive access to the thread that close the db @@ -168,7 +168,8 @@ catch (DatabaseException e) { MessageBuilder mb = new MessageBuilder(); mb.append(NOTE_EXCEPTION_CLOSING_DATABASE.get(this.toString())); mb.append(NOTE_EXCEPTION_CLOSING_DATABASE.get(toString())); mb.append(" "); mb.append(stackTraceToSingleLineString(e)); logError(mb.toMessage()); } @@ -231,7 +232,7 @@ // If the DB has been closed then return immediately. if (isDBClosed()) { return 0; return DATABASE_EMPTY; } cursor = db.openCursor(null, null); @@ -252,7 +253,7 @@ catch (DatabaseException e) { dbenv.shutdownOnException(e); return 0; return DATABASE_EMPTY; } } @@ -268,7 +269,7 @@ // If the DB has been closed then return immediately. if (isDBClosed()) { return 0L; return DATABASE_EMPTY; } return db.count(); @@ -281,7 +282,7 @@ { dbCloseLock.readLock().unlock(); } return 0L; return DATABASE_EMPTY; } /** @@ -299,7 +300,7 @@ // If the DB has been closed then return immediately. if (isDBClosed()) { return 0; return DATABASE_EMPTY; } cursor = db.openCursor(null, null); @@ -320,7 +321,7 @@ catch (DatabaseException e) { dbenv.shutdownOnException(e); return 0; return DATABASE_EMPTY; } } @@ -348,7 +349,7 @@ private final Transaction txn; private final DatabaseEntry key; private final DatabaseEntry entry; private DraftCNData seqnumData = null; private DraftCNData seqnumData; private boolean isClosed = false; @@ -740,9 +741,8 @@ catch(Exception e) { MessageBuilder mb = new MessageBuilder(); mb.append(ERR_ERROR_CLEARING_DB.get(this.toString(), e.getMessage() + " " + stackTraceToSingleLineString(e))); mb.append(ERR_ERROR_CLEARING_DB.get(toString(), e.getMessage() + " " + stackTraceToSingleLineString(e))); logError(mb.toMessage()); } finally opends/src/server/org/opends/server/replication/server/changelog/je/DraftCNDbHandler.java
@@ -281,6 +281,7 @@ { MessageBuilder mb = new MessageBuilder(); mb.append(ERR_EXCEPTION_CHANGELOG_TRIM_FLUSH.get()); mb.append(" "); mb.append(stackTraceToSingleLineString(end)); logError(mb.toMessage()); if (replicationServer != null) @@ -381,9 +382,9 @@ continue; } if ((csnVector == null) || (csnVector.getCSN(csn.getServerId()) != null && !csnVector .cover(startState))) if (csnVector == null || (csnVector.getCSN(csn.getServerId()) != null && !csnVector.cover(startState))) { cursor.delete(); if (debugEnabled()) opends/src/server/org/opends/server/replication/server/changelog/je/ReplicationDB.java
@@ -270,7 +270,8 @@ catch (DatabaseException e) { MessageBuilder mb = new MessageBuilder(); mb.append(NOTE_EXCEPTION_CLOSING_DATABASE.get(this.toString())); mb.append(NOTE_EXCEPTION_CLOSING_DATABASE.get(toString())); mb.append(" "); mb.append(stackTraceToSingleLineString(e)); logError(mb.toMessage()); } @@ -589,26 +590,24 @@ } localCursor = db.openCursor(txn, null); if (startCSN != null) if (startCSN != null && localCursor.getSearchKey(key, data, LockMode.DEFAULT) != SUCCESS) { if (localCursor.getSearchKey(key, data, LockMode.DEFAULT) != SUCCESS) // We could not move the cursor to the expected startCSN if (localCursor.getSearchKeyRange(key, data, DEFAULT) != SUCCESS) { // We could not move the cursor to the expected startCSN if (localCursor.getSearchKeyRange(key, data, DEFAULT) != SUCCESS) { // We could not even move the cursor close to it => failure throw new ChangelogException(Message.raw("CSN not available")); } // We could not even move the cursor close to it => failure throw new ChangelogException(Message.raw("CSN not available")); } // We can move close to the startCSN. // Let's create a cursor from that point. DatabaseEntry aKey = new DatabaseEntry(); DatabaseEntry aData = new DatabaseEntry(); if (localCursor.getPrev(aKey, aData, LockMode.DEFAULT) != SUCCESS) { localCursor.close(); localCursor = db.openCursor(txn, null); } // We can move close to the startCSN. // Let's create a cursor from that point. DatabaseEntry aKey = new DatabaseEntry(); DatabaseEntry aData = new DatabaseEntry(); if (localCursor.getPrev(aKey, aData, LockMode.DEFAULT) != SUCCESS) { localCursor.close(); localCursor = db.openCursor(txn, null); } } cursor = localCursor; @@ -892,7 +891,7 @@ catch(Exception e) { MessageBuilder mb = new MessageBuilder(); mb.append(ERR_ERROR_CLEARING_DB.get(this.toString(), mb.append(ERR_ERROR_CLEARING_DB.get(toString(), e.getMessage() + " " + stackTraceToSingleLineString(e))); logError(mb.toMessage()); opends/src/server/org/opends/server/replication/server/changelog/je/ReplicationDbEnv.java
@@ -394,6 +394,7 @@ { MessageBuilder mb = new MessageBuilder(); mb.append(ERR_ERROR_CLOSING_CHANGELOG_ENV.get()); mb.append(" "); mb.append(stackTraceToSingleLineString(e)); logError(mb.toMessage()); } @@ -405,6 +406,7 @@ { MessageBuilder mb = new MessageBuilder(); mb.append(ERR_ERROR_CLOSING_CHANGELOG_ENV.get()); mb.append(" "); mb.append(stackTraceToSingleLineString(e)); logError(mb.toMessage()); } opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ExternalChangeLogTest.java
@@ -96,7 +96,7 @@ private static final DebugTracer TRACER = getTracer(); /** The replicationServer that will be used in this test. */ private ReplicationServer replicationServer = null; private ReplicationServer replicationServer; /** The port of the replicationServer. */ private int replicationServerPort; @@ -112,17 +112,15 @@ private CSN gblCSN; private List<Control> NO_CONTROL = null; private int brokerSessionTimeout = 5000; private int maxWindow = 100; /** * When used in a search operation, it includes all attributes (user and * operational) */ private final Set<String> ALL_ATTRIBUTES = newSet("+", "*"); private static final Set<String> ALL_ATTRIBUTES = newSet("+", "*"); private static final List<Control> NO_CONTROL = null; /** * Set up the environment for performing the tests in this Class. @@ -3196,7 +3194,7 @@ debugInfo(tn, "Ending test with success"); } private SortedSet<String> newSet(String... values) private static SortedSet<String> newSet(String... values) { return new TreeSet<String>(Arrays.asList(values)); } opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/ReplicationServerLoadBalancingTest.java
@@ -27,11 +27,6 @@ */ package org.opends.server.replication.plugin; import static org.opends.server.TestCaseUtils.*; import static org.opends.server.loggers.ErrorLogger.*; import static org.opends.server.loggers.debug.DebugLogger.*; import static org.testng.Assert.*; import java.io.File; import java.util.*; @@ -47,10 +42,14 @@ import org.opends.server.replication.server.ReplicationServer; import org.opends.server.replication.server.ReplicationServerDomain; import org.opends.server.types.DN; import org.opends.server.types.DirectoryException; import org.opends.server.util.StaticUtils; import org.testng.annotations.Test; import static org.opends.server.TestCaseUtils.*; import static org.opends.server.loggers.ErrorLogger.*; import static org.opends.server.loggers.debug.DebugLogger.*; import static org.testng.Assert.*; /** * Test in real situations the algorithm for load balancing the DSs connections * to the RSs. This uses the weights of the RSs. We concentrate the tests on @@ -90,7 +89,7 @@ rsPort = TestCaseUtils.findFreePorts(NRS); } private void endTest() private void endTest() throws Exception { debugInfo("endTest"); for (int i = 0 ; i < NDS; i++) @@ -102,14 +101,8 @@ } } try { // Clear any reference to a domain in synchro plugin MultimasterReplication.deleteDomain(DN.decode(TEST_ROOT_DN_STRING)); } catch (DirectoryException ex) { fail("Error deleting reference to domain: " + TEST_ROOT_DN_STRING); } // Clear any reference to a domain in synchro plugin MultimasterReplication.deleteDomain(DN.decode(TEST_ROOT_DN_STRING)); for (int i = 0; i < NRS; i++) { opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/ValueInfoTest.java
@@ -85,37 +85,23 @@ csnUpdate, csnUpdate); // Check equals assertFalse(valInfo1.equals(new Object())) ; assertTrue(valInfo1.equals(valInfo1)) ; assertTrue(valInfo1.equals(valInfo2)) ; assertFalse(valInfo1.equals(valInfo3)) ; assertFalse(valInfo1.equals(new Object())); assertEquals(valInfo1, valInfo1); assertEquals(valInfo1, valInfo2); assertFalse(valInfo1.equals(valInfo3)); // Check hashcode assertTrue(valInfo1.hashCode() == valInfo2.hashCode()) ; assertEquals(valInfo1.hashCode(), valInfo2.hashCode()); // Check getValueDeleteTime if (valInfo1.getValueDeleteTime() != null) { assertTrue(valInfo1.getValueDeleteTime().compareTo(csnDelete) == 0); assertEquals(valInfo1.getValueDeleteTime(), csnDelete); } // Check getValueUpdateTime if (valInfo1.getValueUpdateTime() != null) { assertTrue(valInfo1.getValueUpdateTime().compareTo(csnUpdate) == 0); assertEquals(valInfo1.getValueUpdateTime(), csnUpdate); } // Check getValue assertTrue(valInfo1.getAttributeValue().equals(value)) ; // Chek valueUpdateTime if (csnUpdate == null) { assertFalse(valInfo1.isUpdate()); } else { assertTrue(valInfo1.isUpdate()); } assertEquals(valInfo1.getAttributeValue(), value); assertEquals(valInfo1.isUpdate(), csnUpdate != null); } } opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/ReplicationServerTest.java
@@ -84,22 +84,23 @@ /** * The replicationServer that will be used in this test. */ private ReplicationServer replicationServer = null; private ReplicationServer replicationServer; /** * The port of the replicationServer. */ private int replicationServerPort; private CSN firstCSNServer1 = null; private CSN secondCSNServer1 = null; private CSN firstCSNServer2 = null; private CSN secondCSNServer2 = null; private CSN firstCSNServer1; private CSN secondCSNServer1; private CSN firstCSNServer2; private CSN secondCSNServer2; private CSN unknownCSNServer1; private static final String exportLDIFAllFile = "exportLDIF.ldif"; private String exportLDIFDomainFile = null; private String exportLDIFDomainFile; /** * Set up the environment for performing the tests in this Class. * Replication @@ -564,7 +565,10 @@ join(client); stop(clientBroker); assertNull(reader.errDetails, reader.exc + " " + reader.errDetails); if (reader != null) { assertNull(reader.errDetails, reader.exc + " " + reader.errDetails); } } } @@ -675,7 +679,6 @@ * - Create replication server 2 connected with replication server 1 * - Create and connect client 2 to replication server 2 * - Check that client 2 receives the changes published by client 1 * */ @Test(enabled=true, dependsOnMethods = { "searchBackend"}) public void changelogChaining() throws Exception @@ -1252,14 +1255,12 @@ "ds-task-export-include-branch: "+suffix+",dc=replicationChanges"); } private List<UpdateMsg> createChanges(String suffix, int serverId) private List<UpdateMsg> createChanges(String suffix, int serverId) throws Exception { List<UpdateMsg> l = new ArrayList<UpdateMsg>(); long time = TimeThread.getTime(); int ts = 1; CSN csn; try { String user1entryUUID = "33333333-3333-3333-3333-333333333333"; String baseUUID = "22222222-2222-2222-2222-222222222222"; @@ -1270,7 +1271,7 @@ + "objectClass: domain\n" + "entryUUID: 11111111-1111-1111-1111-111111111111\n"; Entry entry = TestCaseUtils.entryFromLdifString(lentry); csn = new CSN(time, ts++, serverId); CSN csn = new CSN(time, ts++, serverId); AddMsg addMsg = new AddMsg(csn, "o=example,"+suffix, user1entryUUID, baseUUID, entry.getObjectClassAttribute(), entry .getAttributes(), new ArrayList<Attribute>()); @@ -1334,7 +1335,6 @@ DeleteMsg delMsg = new DeleteMsg("o=example,"+suffix, csn, "uid"); l.add(delMsg); } catch(Exception ignored) {} return l; } @@ -1496,8 +1496,8 @@ return op; } private void testReplicationBackendACIs() { private void testReplicationBackendACIs() throws Exception { ByteArrayOutputStream oStream = new ByteArrayOutputStream(); ByteArrayOutputStream eStream = new ByteArrayOutputStream(); @@ -1543,30 +1543,27 @@ assertEquals(0, retVal, "Returned error: " + eStream); assertTrue(!entries.equalsIgnoreCase(""), "Returned entries: " + entries); // test write fails : unwilling to perform try { String ldif = "dn: dc=foo, dc=replicationchanges\n" + "objectclass: top\n" + "objectClass: domain\n" + "dc:foo\n"; String path = TestCaseUtils.createTempFile(ldif); String[] args4 = { "-h", "127.0.0.1", "-p", String.valueOf(TestCaseUtils.getServerLdapPort()), "-D", "cn=Directory Manager", "-w", "password", "--noPropertiesFile", "-a", "-f", path }; // test write fails : unwilling to perform String ldif = "dn: dc=foo, dc=replicationchanges\n" + "objectclass: top\n" + "objectClass: domain\n" + "dc:foo\n"; String path = TestCaseUtils.createTempFile(ldif); String[] args4 = { "-h", "127.0.0.1", "-p", String.valueOf(TestCaseUtils.getServerLdapPort()), "-D", "cn=Directory Manager", "-w", "password", "--noPropertiesFile", "-a", "-f", path }; retVal = LDAPModify.mainModify(args4, false, oStream, eStream); assertEquals(retVal, 53, "Returned error: " + eStream); } catch(Exception e) {} } retVal = LDAPModify.mainModify(args4, false, oStream, eStream); assertEquals(retVal, 53, "Returned error: " + eStream); } /** * Replication Server configuration test of the replication Server code with