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

Jean-Noel Rouvignac
01.30.2015 5ce37304338fc81da78fced35938872f5f37e000
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/OnDiskMergeStorageImporter.java
@@ -1765,7 +1765,7 @@
        else if (treeName.getIndexId().equals(ID2CHILDREN_COUNT_NAME))
        {
          // key conflicts == sum values
          // TODO JNR
          return new AddLongMerger(entryContainer.getID2ChildrenCount());
        }
        else if (treeName.getIndexId().equals(DN2ID_INDEX_NAME)
            || treeName.getIndexId().equals(DN2URI_INDEX_NAME)
@@ -1874,7 +1874,10 @@
    @Override
    public V merge()
    {
      // copy before cleaning state
      final boolean mustThrow = moreThanOne;
      final V mergedValue = first;
      // clean up state
      first = null;
      moreThanOne = false;
@@ -1883,7 +1886,7 @@
      {
        throw new IllegalArgumentException();
      }
      return first;
      return mergedValue;
    }
  }
@@ -1969,6 +1972,35 @@
    }
  }
  /**
   * {@link MergingConsumer} that accepts {@link ByteSequence} objects
   * and produces a {@link ByteSequence} representing the added {@code long}s.
   */
  private static final class AddLongMerger implements MergingConsumer<ByteString>
  {
    private final ID2Count id2ChildrenCount;
    private long count;
    AddLongMerger(ID2Count id2ChildrenCount)
    {
      this.id2ChildrenCount = id2ChildrenCount;
    }
    @Override
    public void accept(ByteString value)
    {
      this.count += id2ChildrenCount.fromValue(value);
    }
    @Override
    public ByteString merge()
    {
      final ByteString result = id2ChildrenCount.toValue(count);
      count = 0;
      return result;
    }
  }
  /** Task used to migrate excluded branch. */
  private final class MigrateExcludedTask extends ImportTask
  {