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

dugan
06.18.2009 cc1d6f1efeb4a4845453976f9e0a621d28afd1d3
This fix tries to alleviate this problem somewhat by allocating more memory to the DB cache if more than 1 GB of heap space is defined and turning on the cleaner threads if the skipDNValidation flag is not specified. Issue 4337. 
1 files modified
12 ■■■■■ changed files
opends/src/server/org/opends/server/backends/jeb/importLDIF/Importer.java 12 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/backends/jeb/importLDIF/Importer.java
@@ -64,6 +64,7 @@
  private final int TIMER_INTERVAL = 10000;
  private final int KB = 1024;
  private final int MB =  (KB * KB);
  private final int GB = (1000 * MB);
  private final int LDIF_READER_BUFFER_SIZE = 2 * MB;
  private final int MIN_IMPORT_MEMORY_REQUIRED = 16 * MB;
  private final int MAX_BUFFER_SIZE = 48 * MB;
@@ -74,6 +75,7 @@
  private final int MAX_DB_LOG_BUFFER_BYTES = 100 * MB;
  private final int MEM_PCT_PHASE_1 = 45;
  private final int MEM_PCT_PHASE_2 = 55;
  private final int EXTRA_DB_CACHE_PCT = 30;
  private final int DN_STATE_CACHE_SIZE = 32 * KB;
  private final String DIRECT_PROPERTY = "import.directphase2";
@@ -390,7 +392,12 @@
      long maxMemory = runTime.maxMemory();
      long totMemory = runTime.totalMemory();
      long totFreeMemory = (freeMemory + (maxMemory - totMemory));
      long extraDBCache = 0;
      long availableMemoryImport = (totFreeMemory * MEM_PCT_PHASE_1) / 100;
      if(!skipDNValidation && (totFreeMemory > GB)){
        extraDBCache = (availableMemoryImport * EXTRA_DB_CACHE_PCT) / 100;
        availableMemoryImport -= extraDBCache;
       }
      int phaseOneBuffers = 2 * (indexCount * threadCount);
      message = NOTE_JEB_IMPORT_LDIF_TOT_MEM_BUF.get(availableMemoryImport,
              phaseOneBuffers);
@@ -404,6 +411,11 @@
          }
      }
      getBufferSizes(availableMemoryImport, phaseOneBuffers);
      dbCacheSize += extraDBCache;
      if(!skipDNValidation)
      {
        envConfig.setConfigParam(EnvironmentConfig.ENV_RUN_CLEANER, "true");
      }
      envConfig.setConfigParam("je.maxMemory", Long.toString(dbCacheSize));
      message =
              NOTE_JEB_IMPORT_LDIF_DB_MEM_BUF_INFO.get(dbCacheSize, bufferSize);