mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Jean-Noel Rouvignac
13.45.2014 e5db4199fda295578c53315b4182565a6aa2a6ed
Fixed "External Changelog Two Suffixes (Both Replicated)" robot functional test.

ECLServerHandler.java:
In assignChangeNumber(), used previousCookie.update() instead of overwriting previousCookie.
1 files modified
34 ■■■■ changed files
opends/src/server/org/opends/server/replication/server/ECLServerHandler.java 34 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/ECLServerHandler.java
@@ -388,7 +388,9 @@
      // until here session is encrypted then it depends on the negotiation
      // The session initiator decides whether to use SSL.
      if (!sessionInitiatorSSLEncryption)
      {
        session.stopEncryption();
      }
      // wait and process StartSessionMsg from remote RS
      StartECLSessionMsg inStartECLSessionMsg =
@@ -655,9 +657,11 @@
              e);
    }
    if (debugEnabled())
    {
      TRACER.debugInfo("initializeChangelogDomainCtxts() ends with "
          + dumpState());
  }
  }
  private Set<DomainContext> buildDomainContexts(String providedCookie,
      boolean allowUnknownDomains) throws DirectoryException
@@ -681,7 +685,9 @@
    {
      // skip the 'unreal' changelog domain
      if (domain == this.replicationServerDomain)
      {
        continue;
      }
      // skip the excluded domains
      Set<String> excludedBaseDNs = startECLSessionMsg.getExcludedBaseDNs();
@@ -689,14 +695,18 @@
      {
        // this is an excluded domain
        if (allowUnknownDomains)
        {
          startStatesFromProvidedCookie.remove(domain.getBaseDN());
        }
        continue;
      }
      // skip unused domains
      final ServerState latestState = domain.getLatestServerState();
      if (latestState.isEmpty())
      {
        continue;
      }
      // Creates the new domain context
      final DomainContext newDomainCtxt;
@@ -848,7 +858,9 @@
  public void shutdown()
  {
    if (debugEnabled())
    {
      TRACER.debugInfo(this + " shutdown()");
    }
    releaseCursor();
    for (DomainContext domainCtxt : domainCtxts) {
      if (!domainCtxt.unRegisterHandler()) {
@@ -1004,9 +1016,11 @@
    registerIntoDomain();
    if (debugEnabled())
    {
      TRACER.debugInfo(getClass().getCanonicalName() + " " + getOperationId()
          + " initialized: " + " " + dumpState() + domaimCtxtsToString(""));
  }
  }
  private void initializeChangelogSearch(StartECLSessionMsg msg)
      throws DirectoryException
@@ -1035,7 +1049,9 @@
    // TODO:ECL We should refactor so that a SH always have a session
    if (session == null)
    {
      return msg;
    }
    boolean interrupted = true;
    boolean acquired = false;
@@ -1071,8 +1087,10 @@
    {
      ECLUpdateMsg eclMsg = getNextECLUpdate();
      if (eclMsg != null)
      {
        return eclMsg.getUpdateMsg();
    }
    }
    catch(DirectoryException de)
    {
      TRACER.debugCaught(DebugLogLevel.ERROR, de);
@@ -1088,8 +1106,10 @@
  public ECLUpdateMsg getNextECLUpdate() throws DirectoryException
  {
    if (debugEnabled())
    {
      TRACER.debugInfo("In cn=changelog " + this +
          " getNextECLUpdate starts: " + dumpState());
    }
    ECLUpdateMsg oldestChange = null;
    try
@@ -1191,15 +1211,19 @@
    {
      final CSN csn = oldestChange.getUpdateMsg().getCSN();
      if (debugEnabled())
      {
        TRACER.debugInfo("getNextECLUpdate updates previousCookie:" + csn);
      }
      previousCookie.update(oldestChange.getBaseDN(), csn);
      oldestChange.setCookie(previousCookie);
      if (debugEnabled())
      {
        TRACER.debugInfo("getNextECLUpdate returns result oldestChange="
            + oldestChange);
    }
    }
    return oldestChange;
  }
@@ -1253,10 +1277,12 @@
      final DN baseDNFromCNIndexDB = currentRecord.getBaseDN();
      if (debugEnabled())
      {
        TRACER.debugInfo("assignChangeNumber() comparing the replicaDB's and"
            + " CNIndexDB's baseDNs :" + baseDNFromReplicaDB + "?="
            + baseDNFromCNIndexDB + " timestamps:" + asDate(csnFromReplicaDB)
            + " ?older" + asDate(csnFromCNIndexDB));
      }
      if (areSameChange(csnFromReplicaDB, baseDNFromReplicaDB,
          csnFromCNIndexDB, baseDNFromCNIndexDB))
@@ -1268,14 +1294,13 @@
              + currentRecord.getChangeNumber() + " to change="
              + replicaDBChange);
        previousCookie =
            new MultiDomainServerState(currentRecord.getPreviousCookie());
        previousCookie.update(
            new MultiDomainServerState(currentRecord.getPreviousCookie()));
        replicaDBChange.setCookie(previousCookie);
        replicaDBChange.setChangeNumber(currentRecord.getChangeNumber());
        return true;
      }
      if (!csnFromCNIndexDB.isOlderThan(csnFromReplicaDB))
      {
        // the change from the replicaDB is older
@@ -1287,7 +1312,6 @@
        return false; // TO BE CHECKED
      }
      // The change from the CNIndexDB is older.
      // It means that the CNIndexDB change has been purged from the replicaDB
      // and CNIndexDB has not been trimmed yet.
@@ -1339,8 +1363,10 @@
    // starvation of changelog messages
    // all domain have been unactived means are covered
    if (debugEnabled())
    {
      TRACER.debugInfo("In cn=changelog" + "," + this + " closeInitPhase(): "
          + dumpState());
    }
    // go to persistent phase if one
    for (DomainContext domainCtxt : domainCtxts) domainCtxt.active = true;