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

Yannick Lecaillez
02.29.2015 3f3becc26b7631dad31b5aee4290fc61cf552815
Fix: Remove redundant clearTree().
1 files modified
17 ■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/OnDiskMergeImporter.java 17 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/OnDiskMergeImporter.java
@@ -847,7 +847,7 @@
    final Callable<Void> newChunkCopierTask(TreeName treeName, final Chunk chunk,
        PhaseTwoProgressReporter progressReporter)
    {
      return new CleanImportTask(progressReporter, chunk, treeName, importer);
      return new ChunkCopierTask(progressReporter, chunk, treeName, importer);
    }
    final Callable<Void> newDN2IDImporterTask(TreeName treeName, final Chunk chunk,
@@ -901,7 +901,6 @@
    {
      if (isID2Entry(treeName))
      {
        importer.clearTree(treeName);
        return new MostlyOrderedChunk(asChunk(treeName, importer));
      }
      return newExternalSortChunk(treeName);
@@ -945,12 +944,10 @@
    {
      if (isID2Entry(treeName))
      {
        importer.clearTree(treeName);
        return new MostlyOrderedChunk(asChunk(treeName, importer));
      }
      else if (isDN2ID(treeName))
      {
        importer.clearTree(treeName);
        return asChunk(treeName, importer);
      }
      return newExternalSortChunk(treeName);
@@ -2024,18 +2021,15 @@
    return new ImporterToChunkAdapter(treeName, importer);
  }
  /**
   * Task to copy one {@link Chunk} into a database tree through an {@link Importer}. The specified tree is cleaned
   * before receiving the data contained in the {@link Chunk}.
   */
  private static final class CleanImportTask implements Callable<Void>
  /** Task to copy one {@link Chunk} into a database tree through an {@link Importer}. */
  private static final class ChunkCopierTask implements Callable<Void>
  {
    private final PhaseTwoProgressReporter reporter;
    private final TreeName treeName;
    private final Importer destination;
    private final Chunk source;
    CleanImportTask(PhaseTwoProgressReporter reporter, Chunk source, TreeName treeName, Importer destination)
    ChunkCopierTask(PhaseTwoProgressReporter reporter, Chunk source, TreeName treeName, Importer destination)
    {
      this.source = source;
      this.treeName = treeName;
@@ -2046,7 +2040,6 @@
    @Override
    public Void call()
    {
      destination.clearTree(treeName);
      try (final SequentialCursor<ByteString, ByteString> sourceCursor = trackCursorProgress(reporter, source.flip()))
      {
        copyIntoChunk(sourceCursor, asChunk(treeName, destination));
@@ -2116,7 +2109,7 @@
      // -1 because baseDN is not counted
      id2count.importPutTotalCount(asImporter(id2CountChunk), Math.max(0, totalNumberOfEntries - 1));
      new CleanImportTask(reporter, id2CountChunk, id2count.getName(), importer).call();
      new ChunkCopierTask(reporter, id2CountChunk, id2count.getName(), importer).call();
      return null;
    }