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

Matthew Swift
07.53.2013 984ba7b145520f02414eedf36b88946172ef4dd3
OPENDJ-1116 Introduce abstraction for the changelog DB

* rename CSN comparison methods to make them easier to understand.


18 files modified
326 ■■■■ changed files
opends/src/server/org/opends/server/replication/common/CSN.java 155 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/common/MultiDomainServerState.java 2 ●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/common/ServerState.java 8 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/plugin/AttrHistoricalMultiple.java 42 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/plugin/AttrHistoricalSingle.java 14 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/plugin/EntryHistorical.java 6 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java 9 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/plugin/PendingChanges.java 2 ●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/plugin/RemotePendingChanges.java 8 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/ECLServerHandler.java 4 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/ReplicationDomainMonitorData.java 2 ●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/ReplicationServer.java 5 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/ReplicationServerDomain.java 5 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/changelog/je/JEChangeNumberIndexDB.java 2 ●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/changelog/je/JEReplicaDB.java 6 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/changelog/je/ReplicationDB.java 4 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/service/ReplicationBroker.java 4 ●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/common/CSNTest.java 48 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/common/CSN.java
@@ -27,6 +27,8 @@
 */
package org.opends.server.replication.common;
import java.io.Serializable;
import java.util.Date;
@@ -98,7 +100,8 @@
  /**
   * Create a new {@link CSN} from a String.
   *
   * @param str the string from which to create a {@link CSN}
   * @param str
   *          the string from which to create a {@link CSN}
   */
  public CSN(String str)
  {
@@ -115,9 +118,12 @@
  /**
   * Create a new {@link CSN}.
   *
   * @param timeStamp timeStamp for the {@link CSN}
   * @param seqNum sequence number
   * @param serverId identity of server
   * @param timeStamp
   *          timeStamp for the {@link CSN}
   * @param seqNum
   *          sequence number
   * @param serverId
   *          identity of server
   */
  public CSN(long timeStamp, int seqNum, int serverId)
  {
@@ -128,6 +134,7 @@
  /**
   * Getter for the time.
   *
   * @return the time
   */
  public long getTime()
@@ -137,15 +144,17 @@
  /**
   * Get the timestamp associated to this {@link CSN} in seconds.
   *
   * @return timestamp associated to this {@link CSN} in seconds
   */
  public long getTimeSec()
  {
    return timeStamp/1000;
    return timeStamp / 1000;
  }
  /**
   * Getter for the sequence number.
   *
   * @return the sequence number
   */
  public int getSeqnum()
@@ -155,6 +164,7 @@
  /**
   * Getter for the server ID.
   *
   * @return the server ID
   */
  public int getServerId()
@@ -162,21 +172,26 @@
    return serverId;
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public boolean equals(Object obj)
  {
    if (obj instanceof CSN)
    if (this == obj)
    {
      CSN csn = (CSN) obj;
      return this.seqnum == csn.seqnum &&
          this.serverId == csn.serverId &&
          this.timeStamp == csn.timeStamp;
      return true;
    }
    return false;
    else if (obj instanceof CSN)
    {
      final CSN csn = (CSN) obj;
      return this.seqnum == csn.seqnum && this.serverId == csn.serverId
          && this.timeStamp == csn.timeStamp;
    }
    else
    {
      return false;
    }
  }
  /**
@@ -235,8 +250,7 @@
  }
  /**
   * Convert the {@link CSN} to a printable String with a user friendly
   * format.
   * Convert the {@link CSN} to a printable String with a user friendly format.
   *
   * @return the string
   */
@@ -250,45 +264,39 @@
  }
  /**
   * Compares 2 {@link CSN}.
   * @param csn1 the first {@link CSN} to compare
   * @param csn2 the second {@link CSN} to compare
   * @return value 0 if CSN matches, negative if first
   * CSN is smaller, positive otherwise
   * Compares this CSN with the provided CSN for order and returns a negative
   * number if {@code csn1} is older than {@code csn2}, zero if they have the
   * same age, or a positive number if {@code csn1} is newer than {@code csn2}.
   *
   * @param csn1
   *          The first CSN to be compared, which may be {@code null}.
   * @param csn2
   *          The second CSN to be compared, which may be {@code null}.
   * @return A negative number if {@code csn1} is older than {@code csn2}, zero
   *         if they have the same age, or a positive number if {@code csn1} is
   *         newer than {@code csn2}.
   */
  public static int compare(CSN csn1, CSN csn2)
  {
    if (csn1 == null)
    {
      if (csn2 == null)
        return 0;
      return -1;
      return csn2 == null ? 0 : -1;
    }
    else if (csn2 == null)
    {
      return 1;
    else if (csn1.timeStamp < csn2.timeStamp)
      return -1;
    else if (csn2.timeStamp < csn1.timeStamp)
      return 1;
    }
    else if (csn1.timeStamp != csn2.timeStamp)
    {
      return csn1.timeStamp < csn2.timeStamp ? -1 : 1;
    }
    else if (csn1.seqnum != csn2.seqnum)
    {
      return csn1.seqnum - csn2.seqnum;
    }
    else
    {
      // timestamps are equals compare seqnums
      if (csn1.seqnum < csn2.seqnum)
        return -1;
      else if (csn2.seqnum < csn1.seqnum)
        return 1;
      else
      {
        // timestamp and seqnum are equals compare serverIds
        if (csn1.serverId < csn2.serverId)
          return -1;
        else if (csn2.serverId < csn1.serverId)
          return 1;
        // if we get here {@link CSN} are equals
        return 0;
      }
      return csn1.serverId - csn2.serverId;
    }
  }
@@ -313,7 +321,7 @@
    {
      return csn1.getSeqnum();
    }
    if (csn2.newerOrEquals(csn1))
    if (csn2.isNewerThanOrEqualTo(csn1))
    {
      return 0;
    }
@@ -335,52 +343,67 @@
  }
  /**
   * check if the current Object is strictly older than {@link CSN}
   * given in parameter.
   * @param csn the {@link CSN} to compare with
   * @return true if strictly older, false if younger or same
   * Returns {@code true} if this CSN is older than the provided CSN.
   *
   * @param csn
   *          The CSN to be compared.
   * @return {@code true} if this CSN is older than the provided CSN.
   */
  public boolean older(CSN csn)
  public boolean isOlderThan(CSN csn)
  {
    return compare(this, csn) < 0;
  }
  /**
   * check if the current Object is older than {@link CSN}
   * given in parameter.
   * @param csn the {@link CSN} to compare with
   * @return true if older or equal, false if younger
   * Returns {@code true} if this CSN is older than or equal to the provided
   * CSN.
   *
   * @param csn
   *          The CSN to be compared.
   * @return {@code true} if this CSN is older than or equal to the provided
   *         CSN.
   */
  public boolean olderOrEqual(CSN csn)
  public boolean isOlderThanOrEqualTo(CSN csn)
  {
    return compare(this, csn) <= 0;
  }
  /**
   * Check if the current Object is newer than {@link CSN}.
   * @param csn the {@link CSN} to compare with
   * @return true if newer
   * Returns {@code true} if this CSN is newer than or equal to the provided
   * CSN.
   *
   * @param csn
   *          The CSN to be compared.
   * @return {@code true} if this CSN is newer than or equal to the provided
   *         CSN.
   */
  public boolean newerOrEquals(CSN csn)
  public boolean isNewerThanOrEqualTo(CSN csn)
  {
    return compare(this, csn) >= 0;
  }
  /**
   * Check if the current Object is strictly newer than {@link CSN}.
   * @param csn the {@link CSN} to compare with
   * @return true if strictly newer
   * Returns {@code true} if this CSN is newer than the provided CSN.
   *
   * @param csn
   *          The CSN to be compared.
   * @return {@code true} if this CSN is newer than the provided CSN.
   */
  public boolean newer(CSN csn)
  public boolean isNewerThan(CSN csn)
  {
    return compare(this, csn) > 0;
  }
  /**
   * Compares this object with the specified object for order.
   * @param csn the {@link CSN} to compare with.
   * @return a negative integer, zero, or a positive integer as this object
   *         is less than, equal to, or greater than the specified object.
   * Compares this CSN with the provided CSN for order and returns a negative
   * number if this CSN is older than {@code csn}, zero if they have the same
   * age, or a positive number if this CSN is newer than {@code csn}.
   *
   * @param csn
   *          The CSN to be compared.
   * @return A negative number if this CSN is older than {@code csn}, zero if
   *         they have the same age, or a positive number if this CSN is newer
   *         than {@code csn}.
   */
  @Override
  public int compareTo(CSN csn)
opends/src/server/org/opends/server/replication/common/MultiDomainServerState.java
@@ -109,7 +109,7 @@
      if (oldServerState == null)
        oldServerState = new ServerState();
      if (csn.newer(oldServerState.getCSN(serverId)))
      if (csn.isNewerThan(oldServerState.getCSN(serverId)))
      {
        oldServerState.update(csn);
        list.put(baseDN, oldServerState);
opends/src/server/org/opends/server/replication/common/ServerState.java
@@ -157,7 +157,7 @@
    {
      int serverId = csn.getServerId();
      CSN oldCSN = serverIdToCSN.get(serverId);
      if (oldCSN == null || csn.newer(oldCSN))
      if (oldCSN == null || csn.isNewerThan(oldCSN))
      {
        serverIdToCSN.put(serverId, csn);
        return true;
@@ -338,7 +338,7 @@
    {
      for (CSN csn : serverIdToCSN.values())
      {
        if (maxCSN == null || csn.newer(maxCSN))
        if (maxCSN == null || csn.isNewerThan(maxCSN))
          maxCSN = csn;
      }
    }
@@ -440,7 +440,7 @@
  {
    CSN change =
        this.serverIdToCSN.get(covered.getServerId());
    return change != null && !change.older(covered);
    return change != null && !change.isOlderThan(covered);
  }
  /**
@@ -543,7 +543,7 @@
    {
      for (CSN change : serverIdToCSN.values())
      {
        if (change.older(csn))
        if (change.isOlderThan(csn))
        {
          newState.serverIdToCSN.put(change.getServerId(), change);
        }
opends/src/server/org/opends/server/replication/plugin/AttrHistoricalMultiple.java
@@ -135,17 +135,17 @@
     while (it.hasNext())
     {
       AttrValueHistorical info = it.next();
       if (csn.newerOrEquals(info.getValueUpdateTime()) &&
           csn.newerOrEquals(info.getValueDeleteTime()))
       if (csn.isNewerThanOrEqualTo(info.getValueUpdateTime()) &&
           csn.isNewerThanOrEqualTo(info.getValueDeleteTime()))
         it.remove();
     }
     if (csn.newer(deleteTime))
     if (csn.isNewerThan(deleteTime))
     {
       deleteTime = csn;
     }
     if (csn.newer(lastUpdateTime))
     if (csn.isNewerThan(lastUpdateTime))
     {
       lastUpdateTime = csn;
     }
@@ -162,7 +162,7 @@
     AttrValueHistorical info = new AttrValueHistorical(val, null, csn);
     valuesHist.remove(info);
     valuesHist.put(info, info);
     if (csn.newer(lastUpdateTime))
     if (csn.isNewerThan(lastUpdateTime))
     {
       lastUpdateTime = csn;
     }
@@ -184,7 +184,7 @@
      AttrValueHistorical info = new AttrValueHistorical(val, null, csn);
      valuesHist.remove(info);
      valuesHist.put(info, info);
      if (csn.newer(lastUpdateTime))
      if (csn.isNewerThan(lastUpdateTime))
      {
        lastUpdateTime = csn;
      }
@@ -204,7 +204,7 @@
     AttrValueHistorical info = new AttrValueHistorical(addedValue, csn, null);
     valuesHist.remove(info);
     valuesHist.put(info, info);
     if (csn.newer(lastUpdateTime))
     if (csn.isNewerThan(lastUpdateTime))
     {
       lastUpdateTime = csn;
     }
@@ -225,7 +225,7 @@
      AttrValueHistorical info = new AttrValueHistorical(val, csn, null);
      valuesHist.remove(info);
      valuesHist.put(info, info);
      if (csn.newer(lastUpdateTime))
      if (csn.isNewerThan(lastUpdateTime))
      {
        lastUpdateTime = csn;
      }
@@ -262,7 +262,7 @@
      switch (m.getModificationType())
      {
      case DELETE:
        if (csn.older(getDeleteTime()))
        if (csn.isOlderThan(getDeleteTime()))
        {
          /* this delete is already obsoleted by a more recent delete
           * skip this mod
@@ -282,7 +282,7 @@
        break;
      case REPLACE:
        if (csn.older(getDeleteTime()))
        if (csn.isOlderThan(getDeleteTime()))
        {
          /* this replace is already obsoleted by a more recent delete
           * skip this mod
@@ -428,7 +428,7 @@
      {
        AttrValueHistorical valInfo = it.next();
        if (csn.older(valInfo.getValueUpdateTime()))
        if (csn.isOlderThan(valInfo.getValueUpdateTime()))
        {
          /*
           * this value has been updated after this delete, therefore
@@ -443,7 +443,7 @@
           * information unless it is a Deleted attribute value that is
           * more recent than this DELETE
           */
          if (csn.newerOrEquals(valInfo.getValueDeleteTime()))
          if (csn.isNewerThanOrEqualTo(valInfo.getValueDeleteTime()))
          {
            it.remove();
          }
@@ -452,11 +452,11 @@
      m.setAttribute(builder.toAttribute());
      if (csn.newer(getDeleteTime()))
      if (csn.isNewerThan(getDeleteTime()))
      {
        deleteTime = csn;
      }
      if (csn.newer(getLastUpdateTime()))
      if (csn.isNewerThan(getLastUpdateTime()))
      {
        lastUpdateTime = csn;
      }
@@ -484,8 +484,8 @@
            // we need to keep the delete.
            addedInCurrentOp = true;
          }
          if (csn.newerOrEquals(oldValInfo.getValueDeleteTime()) &&
              csn.newerOrEquals(oldValInfo.getValueUpdateTime()))
          if (csn.isNewerThanOrEqualTo(oldValInfo.getValueDeleteTime()) &&
              csn.isNewerThanOrEqualTo(oldValInfo.getValueUpdateTime()))
          {
            valuesHist.remove(oldValInfo);
            valuesHist.put(valInfo, valInfo);
@@ -523,7 +523,7 @@
      m.setAttribute(builder.toAttribute());
      if (csn.newer(getLastUpdateTime()))
      if (csn.isNewerThan(getLastUpdateTime()))
      {
        lastUpdateTime = csn;
      }
@@ -554,7 +554,7 @@
     * real entry
     */
    if (csn.older(getDeleteTime()))
    if (csn.isOlderThan(getDeleteTime()))
    {
      /* A delete has been done more recently than this add
       * forget this MOD ADD
@@ -586,7 +586,7 @@
           * in all cases suppress this value from the value list
           * as it is already present in the entry
           */
          if (csn.newer(oldValInfo.getValueUpdateTime()))
          if (csn.isNewerThan(oldValInfo.getValueUpdateTime()))
          {
            valuesHist.remove(oldValInfo);
            valuesHist.put(valInfo, valInfo);
@@ -598,7 +598,7 @@
          /* this value is marked as a deleted value
           * check if this mod is more recent the this delete
           */
          if (csn.newerOrEquals(oldValInfo.getValueDeleteTime()))
          if (csn.isNewerThanOrEqualTo(oldValInfo.getValueDeleteTime()))
          {
            /* this add is more recent,
             * remove the old delete historical information
@@ -629,7 +629,7 @@
      modsIterator.remove();
    }
    if (csn.newer(getLastUpdateTime()))
    if (csn.isNewerThan(getLastUpdateTime()))
    {
      lastUpdateTime = csn;
    }
opends/src/server/org/opends/server/replication/plugin/AttrHistoricalSingle.java
@@ -153,11 +153,11 @@
    switch (mod.getModificationType())
    {
    case DELETE:
      if (csn.newer(addTime))
      if (csn.isNewerThan(addTime))
      {
        if (newValue == null || newValue.equals(value) || value == null)
        {
          if (csn.newer(deleteTime))
          if (csn.isNewerThan(deleteTime))
          {
            deleteTime = csn;
          }
@@ -191,7 +191,7 @@
        if ((lastMod == HistAttrModificationKey.ADD)
            || (lastMod == HistAttrModificationKey.REPL))
        {
          if (csn.newer(deleteTime))
          if (csn.isNewerThan(deleteTime))
          {
            deleteTime = csn;
          }
@@ -213,7 +213,7 @@
      break;
    case ADD:
      if (csn.newerOrEquals(deleteTime) && csn.older(addTime))
      if (csn.isNewerThanOrEqualTo(deleteTime) && csn.isOlderThan(addTime))
      {
        conflict = true;
        mod.setModificationType(ModificationType.REPLACE);
@@ -223,8 +223,8 @@
      }
      else
      {
        if (csn.newerOrEquals(deleteTime)
            && ((addTime == null ) || addTime.older(deleteTime)))
        if (csn.isNewerThanOrEqualTo(deleteTime)
            && ((addTime == null ) || addTime.isOlderThan(deleteTime)))
        {
          // no conflict : don't do anything beside setting the addTime
          addTime = csn;
@@ -252,7 +252,7 @@
      break;
    case REPLACE:
      if (csn.older(deleteTime))
      if (csn.isOlderThan(deleteTime))
      {
        conflict = true;
        modsIterator.remove();
opends/src/server/org/opends/server/replication/plugin/EntryHistorical.java
@@ -595,7 +595,7 @@
   */
  public boolean addedOrRenamedAfter(CSN csn)
  {
    return csn.older(entryADDDate) || csn.older(entryMODDNDate);
    return csn.isOlderThan(entryADDDate) || csn.isOlderThan(entryMODDNDate);
  }
@@ -612,7 +612,7 @@
    if (entryMODDNDate == null)
      return entryADDDate;
    if (entryMODDNDate.older(entryADDDate))
    if (entryMODDNDate.isOlderThan(entryADDDate))
      return entryMODDNDate;
    else
      return entryADDDate;
@@ -885,7 +885,7 @@
  private void updateOldestCSN(CSN csn)
  {
    if (csn != null
        && (this.oldestCSN == null || csn.older(this.oldestCSN)))
        && (this.oldestCSN == null || csn.isOlderThan(this.oldestCSN)))
      this.oldestCSN = csn;
  }
opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
@@ -137,7 +137,7 @@
      for (FakeOperation op : updates)
      {
        CSN csn = op.getCSN();
        if (csn.newer(startCSN) && csn.older(endCSN))
        if (csn.isNewerThan(startCSN) && csn.isOlderThan(endCSN))
        {
          synchronized (replayOperations)
          {
@@ -4406,7 +4406,8 @@
      if (replServerMaxCSN != null && replServerMaxCSN.getSeqnum() != 0)
      {
        CSN ourMaxCSN = state.getMaxCSN(getServerId());
        if (ourMaxCSN != null && !ourMaxCSN.olderOrEqual(replServerMaxCSN))
        if (ourMaxCSN != null
            && !ourMaxCSN.isOlderThanOrEqualTo(replServerMaxCSN))
        {
          pendingChanges.setRecovering(true);
          broker.setRecoveryRequired(true);
@@ -4442,7 +4443,7 @@
      Iterator<CSN> it = replayOperations.keySet().iterator();
      while (it.hasNext())
      {
        if (it.next().newer(startCSN))
        if (it.next().isNewerThan(startCSN))
        {
          break;
        }
@@ -4478,7 +4479,7 @@
        while (itOp.hasNext())
        {
          FakeOperation fakeOp = itOp.next();
          if (fakeOp.getCSN().newer(endCSN) // sanity check
          if (fakeOp.getCSN().isNewerThan(endCSN) // sanity check
              || !state.cover(fakeOp.getCSN()))
          {
            break;
opends/src/server/org/opends/server/replication/plugin/PendingChanges.java
@@ -252,7 +252,7 @@
  public synchronized boolean recoveryUntil(CSN recovered)
  {
    CSN lastLocalChange = domain.getLastLocalChange();
    if (recovered != null && recovered.newerOrEquals(lastLocalChange))
    if (recovered != null && recovered.isNewerThanOrEqualTo(lastLocalChange))
    {
      recoveringOldChanges = false;
    }
opends/src/server/org/opends/server/replication/plugin/RemotePendingChanges.java
@@ -202,7 +202,7 @@
    for (PendingChange pendingChange : pendingChanges.values())
    {
      if (pendingChange.getCSN().older(csn))
      if (pendingChange.getCSN().isOlderThan(csn))
      {
        LDAPUpdateMsg pendingMsg = pendingChange.getMsg();
        if (pendingMsg != null)
@@ -292,7 +292,7 @@
    for (PendingChange pendingChange : pendingChanges.values())
    {
      if (pendingChange.getCSN().older(csn))
      if (pendingChange.getCSN().isOlderThan(csn))
      {
        LDAPUpdateMsg pendingMsg = pendingChange.getMsg();
        if (pendingMsg != null)
@@ -353,7 +353,7 @@
    for (PendingChange pendingChange : pendingChanges.values())
    {
      if (pendingChange.getCSN().older(csn))
      if (pendingChange.getCSN().isOlderThan(csn))
      {
        LDAPUpdateMsg pendingMsg = pendingChange.getMsg();
        if (pendingMsg != null)
@@ -437,7 +437,7 @@
    for (PendingChange pendingChange : pendingChanges.values())
    {
      if (pendingChange.getCSN().older(csn))
      if (pendingChange.getCSN().isOlderThan(csn))
      {
        LDAPUpdateMsg pendingMsg = pendingChange.getMsg();
        if (pendingMsg != null)
opends/src/server/org/opends/server/replication/server/ECLServerHandler.java
@@ -870,7 +870,7 @@
    for (CSN dbOldestChange : rsDomain.getStartState())
    {
      CSN providedChange = cookie.getCSN(dbOldestChange.getServerId());
      if (providedChange != null && providedChange.older(dbOldestChange))
      if (providedChange != null && providedChange.isOlderThan(dbOldestChange))
      {
        return true;
      }
@@ -1394,7 +1394,7 @@
      }
      if (!csnFromCNIndexDB.older(csnFromChangelogDb))
      if (!csnFromCNIndexDB.isOlderThan(csnFromChangelogDb))
      {
        // the change from the changelogDb is older
        // it should have been stored lately
opends/src/server/org/opends/server/replication/server/ReplicationDomainMonitorData.java
@@ -314,7 +314,7 @@
    {
      maxCSNs.put(serverId, newCSN);
    }
    else if (newCSN.newer(currentMaxCSN))
    else if (newCSN.isNewerThan(currentMaxCSN))
    {
      maxCSNs.replace(serverId, newCSN);
    }
opends/src/server/org/opends/server/replication/server/ReplicationServer.java
@@ -1316,8 +1316,9 @@
        continue;
      final CSN domainEligibleCSN = domain.getEligibleCSN();
      if (eligibleCSN == null
          ||(domainEligibleCSN != null && domainEligibleCSN.older(eligibleCSN)))
      if (eligibleCSN == null ||
          (domainEligibleCSN != null
           && domainEligibleCSN.isOlderThan(eligibleCSN)))
      {
        eligibleCSN = domainEligibleCSN;
      }
opends/src/server/org/opends/server/replication/server/ReplicationServerDomain.java
@@ -2619,12 +2619,13 @@
      }
      if (changelogNewestCSN != null
          && (eligibleCSN == null || changelogNewestCSN.newer(eligibleCSN)))
          && (eligibleCSN == null ||
              changelogNewestCSN.isNewerThan(eligibleCSN)))
      {
        eligibleCSN = changelogNewestCSN;
      }
      if (heartbeatLastCSN != null
          && (eligibleCSN == null || heartbeatLastCSN.newer(eligibleCSN)))
          && (eligibleCSN == null || heartbeatLastCSN.isNewerThan(eligibleCSN)))
      {
        eligibleCSN = heartbeatLastCSN;
      }
opends/src/server/org/opends/server/replication/server/changelog/je/JEChangeNumberIndexDB.java
@@ -363,7 +363,7 @@
          final long currentChangeNumber = record.getChangeNumber();
          if (csn.older(fcsn))
          if (csn.isOlderThan(fcsn))
          {
            cursor.delete();
            continue;
opends/src/server/org/opends/server/replication/server/changelog/je/JEReplicaDB.java
@@ -198,7 +198,7 @@
      queueByteSize += update.size();
      msgQueue.add(update);
      if (newestCSN == null || newestCSN.older(update.getCSN()))
      if (newestCSN == null || newestCSN.isOlderThan(update.getCSN()))
      {
        newestCSN = update.getCSN();
      }
@@ -456,7 +456,7 @@
              return;
            }
            if (!csn.equals(newestCSN) && csn.older(trimDate))
            if (!csn.equals(newestCSN) && csn.isOlderThan(trimDate))
            {
              cursor.delete();
            }
@@ -659,7 +659,7 @@
  {
    // Now that we always keep the last CSN in the DB to avoid expiring cookies
    // too quickly, we need to check if the "to" is older than the trim date.
    if (to == null || !to.older(new CSN(latestTrimDate, 0, 0)))
    if (to == null || !to.isOlderThan(new CSN(latestTrimDate, 0, 0)))
    {
      flush();
      return db.count(from, to);
opends/src/server/org/opends/server/replication/server/changelog/je/ReplicationDB.java
@@ -992,7 +992,7 @@
        // reached a regular change record
        // test whether we reached the 'stop' target
        if (!csn.newer(stop))
        if (!csn.isNewerThan(stop))
        {
          // let's loop
          distanceToCounterRecords[START]++;
@@ -1043,7 +1043,7 @@
        }
        // it is a regular change record
        if (!csn.older(start))
        if (!csn.isOlderThan(start))
        {
          distanceToCounterRecords[STOP]++;
          status = cursor.getPrev(key, data, LockMode.DEFAULT);
opends/src/server/org/opends/server/replication/service/ReplicationBroker.java
@@ -1647,7 +1647,7 @@
      }
      // Has this replication server the latest local change ?
      if (myCSN.olderOrEqual(rsCSN))
      if (myCSN.isOlderThanOrEqualTo(rsCSN))
      {
        if (myCSN.equals(rsCSN))
        {
@@ -1663,7 +1663,7 @@
            // Initialize the latest CSN
            latestRsCSN = rsCSN;
          }
          if (rsCSN.newerOrEquals(latestRsCSN))
          if (rsCSN.isNewerThanOrEqualTo(latestRsCSN))
          {
            if (rsCSN.equals(latestRsCSN))
            {
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/common/CSNTest.java
@@ -160,48 +160,48 @@
    assertTrue(CSN.compare(csn5, csn1) > 0);
  }
  /** Test {@link CSN#older(CSN)} method */
  /** Test {@link CSN#isOlderThan(CSN)} method */
  @Test(dataProvider = "createCSN")
  public void csnOlder(CSN csn1, CSN csn2, CSN csn3, CSN csn4, CSN csn5) throws Exception
  {
    assertFalse(csn1.older(null));
    assertFalse(csn1.older(csn1));
    assertTrue(csn1.older(csn3));
    assertTrue(csn1.older(csn4));
    assertTrue(csn1.older(csn5));
    assertFalse(csn1.isOlderThan(null));
    assertFalse(csn1.isOlderThan(csn1));
    assertTrue(csn1.isOlderThan(csn3));
    assertTrue(csn1.isOlderThan(csn4));
    assertTrue(csn1.isOlderThan(csn5));
  }
  /** Test {@link CSN#olderOrEqual(CSN)} method */
  /** Test {@link CSN#isOlderThanOrEqualTo(CSN)} method */
  @Test(dataProvider = "createCSN")
  public void csnOlderOrEqual(CSN csn1, CSN csn2, CSN csn3, CSN csn4, CSN csn5) throws Exception
  {
    assertFalse(csn1.olderOrEqual(null));
    assertTrue(csn1.olderOrEqual(csn1));
    assertTrue(csn1.olderOrEqual(csn3));
    assertTrue(csn1.olderOrEqual(csn4));
    assertTrue(csn1.olderOrEqual(csn5));
    assertFalse(csn1.isOlderThanOrEqualTo(null));
    assertTrue(csn1.isOlderThanOrEqualTo(csn1));
    assertTrue(csn1.isOlderThanOrEqualTo(csn3));
    assertTrue(csn1.isOlderThanOrEqualTo(csn4));
    assertTrue(csn1.isOlderThanOrEqualTo(csn5));
  }
  /** Test {@link CSN#newer(CSN)} method */
  /** Test {@link CSN#isNewerThan(CSN)} method */
  @Test(dataProvider = "createCSN")
  public void csnNewer(CSN csn1, CSN csn2, CSN csn3, CSN csn4, CSN csn5) throws Exception
  {
    assertTrue(csn1.newer(null));
    assertFalse(csn1.newer(csn1));
    assertFalse(csn1.newer(csn3));
    assertFalse(csn1.newer(csn4));
    assertFalse(csn1.newer(csn5));
    assertTrue(csn1.isNewerThan(null));
    assertFalse(csn1.isNewerThan(csn1));
    assertFalse(csn1.isNewerThan(csn3));
    assertFalse(csn1.isNewerThan(csn4));
    assertFalse(csn1.isNewerThan(csn5));
  }
  /** Test {@link CSN#newerOrEquals(CSN)} method */
  /** Test {@link CSN#isNewerThanOrEqualTo(CSN)} method */
  @Test(dataProvider = "createCSN")
  public void csnNewerOrEquals(CSN csn1, CSN csn2, CSN csn3, CSN csn4, CSN csn5) throws Exception
  {
    assertTrue(csn1.newerOrEquals(null));
    assertTrue(csn1.newerOrEquals(csn1));
    assertFalse(csn1.newerOrEquals(csn3));
    assertFalse(csn1.newerOrEquals(csn4));
    assertFalse(csn1.newerOrEquals(csn5));
    assertTrue(csn1.isNewerThanOrEqualTo(null));
    assertTrue(csn1.isNewerThanOrEqualTo(csn1));
    assertFalse(csn1.isNewerThanOrEqualTo(csn3));
    assertFalse(csn1.isNewerThanOrEqualTo(csn4));
    assertFalse(csn1.isNewerThanOrEqualTo(csn5));
  }