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

Jean-Noel Rouvignac
11.13.2014 24558f69b45a25f40844490d17dfb42e13e0f417
Since OpenDJ 3 forces a rebuild of all indexes, we do not need to maintain backward compatibility for ds-sync-hist index. This means the fix for OPENDJ-992 is no longer needed.

Removed custom code for comparing ds-sync-hist and used ByteString.compareTo() method instead.

Code Review: Matthew Swift


HistoricalCsnOrderingMatchingRuleImpl.java:
In compareValues(), replaced all the code by simply calling ByteString.compareTo().
1 files modified
35 ■■■■■ changed files
opendj3-server-dev/src/server/org/opends/server/replication/plugin/HistoricalCsnOrderingMatchingRuleImpl.java 35 ●●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/replication/plugin/HistoricalCsnOrderingMatchingRuleImpl.java
@@ -82,40 +82,7 @@
   */
  private int compareValues(ByteSequence value1, ByteSequence value2)
  {
    /*
     * See OPENDJ-992: do not use StaticUtils.compare() because it performs
     * unsigned comparisons whereas the 2.4 implementation (below) performs
     * signed comparisons. Changes to indexing comparators require that the
     * index be rebuilt, otherwise the DB can fail unexpectedly.
     */
    int minLength = Math.min(value1.length(), value2.length());
    for (int i = 0; i < minLength; i++)
    {
      final byte b1 = value1.byteAt(i);
      final byte b2 = value2.byteAt(i);
      if (b1 < b2)
      {
        return -1;
      }
      else if (b1 > b2)
      {
        return 1;
      }
    }
    if (value1.length() == value2.length())
    {
      return 0;
    }
    else if (value1.length() < value2.length())
    {
      return -1;
    }
    else
    {
      return 1;
    }
    return value1.compareTo(value2);
  }
  /** {@inheritDoc} */