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

dugan
30.33.2009 df19b64b2e66df0c8555157d0f8d7e8398df48fb
Fix import memory calculation to use maxMemory()
2 files modified
17 ■■■■ changed files
opends/src/messages/messages/jeb.properties 2 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/backends/jeb/importLDIF/Importer.java 15 ●●●● patch | view | raw | blame | history
opends/src/messages/messages/jeb.properties
@@ -369,3 +369,5 @@
buffer count %d and read ahead cache size %d
NOTICE_JEB_IMPORT_LDIF_INDIRECT_MEM_REPORT_196=Memory phase two \
buffer count %d and read ahead cache size %d
NOTICE_JEB_IMPORT_LDIF_BUFF_SIZE_LESS_DEFAULT_197=Setting phase one buffer \
size to minimal %d bytes and proceeding
opends/src/server/org/opends/server/backends/jeb/importLDIF/Importer.java
@@ -192,7 +192,9 @@
      dbCacheSize =  MIN_DB_CACHE_SIZE;
      if(bufferSize < MIN_BUFFER_SIZE)
      {
        System.out.println("Log size less than default -- give it a try");
        Message msg =
               NOTE_JEB_IMPORT_LDIF_BUFF_SIZE_LESS_DEFAULT.get(MIN_BUFFER_SIZE);
        logError(msg);
        bufferSize = MIN_BUFFER_SIZE;
      }
      else
@@ -244,7 +246,10 @@
    Message msg;
    Runtime runtime = Runtime.getRuntime();
    long freeMemory = runtime.freeMemory();
    long availMemImport = (freeMemory * MEM_PCT_PHASE_1) / 100;
    long maxMemory = runtime.maxMemory();
    long totMemory = runtime.totalMemory();
    long totFreeMemory = (freeMemory + (maxMemory - totMemory));
    long availMemImport = (totFreeMemory * MEM_PCT_PHASE_1) / 100;
    int phaseOneBuffers = 2 * (indexCount * threadCount);
    msg = NOTE_JEB_IMPORT_LDIF_TOT_MEM_BUF.get(availMemImport, phaseOneBuffers);
    logError(msg);
@@ -463,7 +468,11 @@
  private int cacheSizeFromFreeMemory()
  {
    Runtime runtime = Runtime.getRuntime();
    long availMemory = runtime.freeMemory()  * MEM_PCT_PHASE_2 / 100;
    long freeMemory = runtime.freeMemory();
    long maxMemory = runtime.maxMemory();
    long totMemory = runtime.totalMemory();
    long totFreeMemory = (freeMemory + (maxMemory - totMemory));
    long availMemory = (totFreeMemory * MEM_PCT_PHASE_2) / 100;
    int avgBufSize = (int)(availMemory / bufferCount.get());
    int cacheSize = Math.max(MIN_READ_AHEAD_CACHE_SIZE, avgBufSize);
    if(cacheSize > bufferSize)