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

ludovicp
05.19.2010 eeaf7092624ac9c96ecfe4a47a1b1f6687a1dbea
Fix issue with rebuild index and memory budgetting: Always round usable memory up to 16MB minimum in order to allow import/rebuild to run in limited memory cases such as unit tests. Also, clear additional memory between rebuild phase 1 and 2.
1 files modified
23 ■■■■ changed files
opends/src/server/org/opends/server/backends/jeb/importLDIF/Importer.java 23 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/backends/jeb/importLDIF/Importer.java
@@ -563,7 +563,10 @@
        configuredMemory = backendConfiguration.getDBCachePercent()
            * Runtime.getRuntime().maxMemory() / 100;
      }
      availableMemory = Math.min(usableMemory, configuredMemory);
      // Round up to minimum of 16MB (e.g. unit tests only use 2% cache).
      availableMemory = Math.max(Math.min(usableMemory, configuredMemory),
          16 * MB);
    }
    else
    {
@@ -3240,14 +3243,22 @@
          result.get();
        }
      }
      //Try to clear as much memory as possible.
      // Try to clear as much memory as possible.
      rebuildIndexService.shutdown();
      rebuildIndexService.awaitTermination(30, TimeUnit.SECONDS);
      bufferSortService.shutdown();
      bufferSortService.awaitTermination(30, TimeUnit.SECONDS);
      scratchFileWriterService.shutdown();
      scratchFileWriterService.awaitTermination(30, TimeUnit.SECONDS);
      timer.cancel();
      tasks.clear();
      results.clear();
      rebuildIndexService.shutdown();
      scratchFileWriterList.clear();
      scratchFileWriterFutures.clear();
      indexKeyQueMap.clear();
      freeBufferQueue.clear();
      bufferSortService.shutdown();
      scratchFileWriterService.shutdown();
      timer.cancel();
    }