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

Jean-Noel Rouvignac
07.02.2013 4cd3d75a0c4b165101245c51f7ca4b8f8bdad7dc
opends/src/server/org/opends/server/replication/server/ReplicationServerDomain.java
@@ -2561,71 +2561,6 @@
  }
  /**
   * Computes the eligible server state for the domain.
   *
   * <pre>
   *     s1               s2          s3
   *     --               --          --
   *                                 csn31
   *     csn15
   *
   *  ----------------------------------------- eligibleCSN
   *     csn14
   *                     csn26
   *     csn13
   * </pre>
   *
   * The eligibleState is : s1;csn14 / s2;csn26 / s3;csn31
   *
   * @param eligibleCSN
   *          The provided eligible CSN.
   * @return The computed eligible server state.
   */
  public ServerState getEligibleState(CSN eligibleCSN)
  {
    ServerState latestState = getLatestServerState();
    // The result is initialized from the dbState.
    // From it, we don't want to keep the changes newer than eligibleCSN.
    ServerState result = latestState.duplicate();
    if (eligibleCSN != null)
    {
      for (CSN mostRecentDbCSN : latestState)
      {
        try {
          // Is the most recent change in the Db newer than eligible CSN ?
          // if yes (like csn15 in the example above, then we have to go back
          // to the Db and look for the change older than eligible CSN (csn14)
          if (eligibleCSN.olderOrEqual(mostRecentDbCSN))
          {
            // let's try to seek the first change <= eligibleCSN
            CSN newCSN = domainDB.getCSNAfter(baseDN,
                mostRecentDbCSN.getServerId(), eligibleCSN);
            result.update(newCSN);
          }
          else
          {
            // for this serverId, all changes in the ChangelogDb are holder
            // than eligibleCSN, the most recent in the db is our guy.
            result.update(mostRecentDbCSN);
          }
        } catch (Exception e) {
          logError(ERR_WRITER_UNEXPECTED_EXCEPTION
              .get(stackTraceToSingleLineString(e)));
          TRACER.debugCaught(DebugLogLevel.ERROR, e);
        }
      }
    }
    if (debugEnabled())
    {
      debug("getEligibleState() result is " + result);
    }
    return result;
  }
  /**
   * Returns the start state of the domain, made of the oldest CSN stored for
   * each serverId.
   * <p>