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

Ludovic Poitou
12.25.2015 22848a560559c9137da4322330cdd9ef55b89620
Fix OPENDJ-2018: Wrong number of entries returned in ldapsearch with the new backend.
Recent regression with the latest index optimisation. The EntryIDSet returned when cursoring the dn2id index was not sorted.
Thanks Yannick for the quick resolution.
1 files modified
8 ■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/EntryContainer.java 8 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/EntryContainer.java
@@ -1028,7 +1028,7 @@
  private static EntryIDSet newIDSetFromCursor(SequentialCursor<?, EntryID> cursor, boolean includeCurrent)
  {
    final long ids[] = new long[SCOPE_IDSET_LIMIT];
    long ids[] = new long[SCOPE_IDSET_LIMIT];
    int offset = 0;
    if (includeCurrent) {
      ids[offset++] = cursor.getValue().longValue();
@@ -1036,9 +1036,13 @@
    for(; offset < ids.length && cursor.next() ; offset++) {
      ids[offset] = cursor.getValue().longValue();
    }
    ids = Arrays.copyOf(ids, offset);
    Arrays.sort(ids);
    return offset == SCOPE_IDSET_LIMIT
        ? EntryIDSet.newUndefinedSet()
        : EntryIDSet.newDefinedSet(Arrays.copyOf(ids, offset));
        : EntryIDSet.newDefinedSet(ids);
  }
  private <E1 extends Exception, E2 extends Exception>