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

Jean-Noel Rouvignac
02.01.2013 891159050af4aa3fe47c67e3ba7d3f21299027a4
opends/src/server/org/opends/server/replication/server/ECLServerHandler.java
@@ -841,8 +841,8 @@
      domain.registerHandler(mh);
      newDomainCtxt.mh = mh;
      previousCookie.update(newDomainCtxt.rsDomain.getBaseDN(),
                            newDomainCtxt.startState.duplicate());
      previousCookie.replace(newDomainCtxt.rsDomain.getBaseDN(),
                             newDomainCtxt.startState.duplicate());
      results.add(newDomainCtxt);
    }
@@ -1260,13 +1260,9 @@
        final DomainContext oldestContext = findDomainCtxtWithOldestChange();
        if (oldestContext != null)
        {
          final ECLUpdateMsg change = newECLUpdateMsg(oldestContext);
          oldestContext.currentState.update(change.getUpdateMsg().getCSN());
          if (draftCompat)
          {
            assignNewChangeNumberAndStore(change);
          }
          oldestChange = change;
          oldestChange = newECLUpdateMsg(oldestContext);
          oldestContext.currentState.update(
              oldestChange.getUpdateMsg().getCSN());
        }
      }
    }
@@ -1326,7 +1322,7 @@
   *           if a database problem occurs.
   */
  private boolean assignChangeNumber(final ECLUpdateMsg replicaDBChange)
      throws ChangelogException
      throws ChangelogException, DirectoryException
  {
    // We also need to check if the CNIndexDB is consistent with the replicaDBs.
    // If not, 2 potential reasons:
@@ -1337,15 +1333,8 @@
    CSN csnFromReplicaDB = replicaDBChange.getUpdateMsg().getCSN();
    DN baseDNFromReplicaDB = replicaDBChange.getBaseDN();
    while (true)
    while (!isEndOfCNIndexDBReached)
    {
      if (isEndOfCNIndexDBReached)
      {
        // we are at the end of the CNIndexDB in the append mode
        assignNewChangeNumberAndStore(replicaDBChange);
        return true;
      }
      final ChangeNumberIndexRecord currentRecord = cnIndexDBCursor.getRecord();
      final CSN csnFromCNIndexDB = currentRecord.getCSN();
      final DN baseDNFromCNIndexDB = currentRecord.getBaseDN();
@@ -1366,6 +1355,9 @@
              + currentRecord.getChangeNumber() + " to change="
              + replicaDBChange);
        previousCookie =
            new MultiDomainServerState(currentRecord.getPreviousCookie());
        replicaDBChange.setCookie(previousCookie);
        replicaDBChange.setChangeNumber(currentRecord.getChangeNumber());
        return true;
      }
@@ -1411,6 +1403,7 @@
        // continuously throws ChangelogExceptions
      }
    }
    return false;
  }
  private Date asDate(CSN csn)
@@ -1425,18 +1418,6 @@
    return sameDN && sameCSN;
  }
  private void assignNewChangeNumberAndStore(ECLUpdateMsg change)
      throws ChangelogException
  {
    final ChangeNumberIndexRecord record =
        new ChangeNumberIndexRecord(previousCookie.toString(),
            change.getBaseDN(), change.getUpdateMsg().getCSN());
    // store in CNIndexDB the pair
    // (change number of the current change, state before this change)
    change.setChangeNumber(
        replicationServer.getChangeNumberIndexDB().addRecord(record));
  }
  /**
   * Terminates the first (non persistent) phase of the search on the ECL.
   */