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

boli
08.46.2009 1a74022252cf186105fcc53863ca2d1bc46ae189
Fix for issue 2070: Added validation of DB cache size before applying it to JE.
2 files modified
31 ■■■■ changed files
opends/src/messages/messages/jeb.properties 6 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/backends/jeb/ConfigurableEnvironment.java 25 ●●●● patch | view | raw | blame | history
opends/src/messages/messages/jeb.properties
@@ -358,3 +358,9 @@
 backup in '%s'.  A full backup will be executed
SEVERE_ERR_CONFIG_INDEX_TYPE_NEEDS_VALID_MATCHING_RULE_192=The attribute '%s' \
cannot have extensible index type for invalid matching rule name '%s'
SEVERE_ERR_CONFIG_JEB_CACHE_SIZE_GREATER_THAN_JVM_HEAP_193=Configuration \
  attribute ds-cfg-db-cache-size has a value of %d but the JVM is only \
  configured for %d. Consider using ds-cfg-db-cache-percent
SEVERE_ERR_CONFIG_JEB_CACHE_SIZE_TOO_SMALL_194=Configuration \
  attribute ds-cfg-db-cache-size has a value of %d which is less than \
  the minimum: %d
opends/src/server/org/opends/server/backends/jeb/ConfigurableEnvironment.java
@@ -27,6 +27,7 @@
package org.opends.server.backends.jeb;
import com.sleepycat.je.EnvironmentConfig;
import com.sleepycat.je.dbi.MemoryBudget;
import org.opends.server.config.ConfigConstants;
import org.opends.server.config.ConfigException;
@@ -43,6 +44,7 @@
import java.util.Arrays;
import org.opends.messages.Message;
import static org.opends.messages.JebMessages.*;
import org.opends.server.loggers.debug.DebugTracer;
import org.opends.server.admin.std.server.LocalDBBackendCfg;
@@ -426,6 +428,21 @@
  public static EnvironmentConfig parseConfigEntry(LocalDBBackendCfg cfg)
       throws ConfigException
  {
    // See if the db cache size setting is valid.
    if(cfg.getDBCacheSize() != 0)
    {
      if (MemoryBudget.getRuntimeMaxMemory() < cfg.getDBCacheSize()) {
        throw new ConfigException(
            ERR_CONFIG_JEB_CACHE_SIZE_GREATER_THAN_JVM_HEAP.get(
                cfg.getDBCacheSize(), MemoryBudget.getRuntimeMaxMemory()));
      }
      if (cfg.getDBCacheSize() < MemoryBudget.MIN_MAX_MEMORY_SIZE) {
        throw new ConfigException(
            ERR_CONFIG_JEB_CACHE_SIZE_TOO_SMALL.get(
                cfg.getDBCacheSize(), MemoryBudget.MIN_MAX_MEMORY_SIZE));
      }
    }
    EnvironmentConfig envConfig = defaultConfig();
    // Handle the attributes that do not have a JE property.
@@ -445,13 +462,7 @@
    // See if there are any native JE properties specified in the config
    // and if so try to parse, evaluate and set them.
    SortedSet<String> jeProperties = cfg.getJEProperty();
    try {
      envConfig = setJEProperties(envConfig, jeProperties, attrMap);
    } catch (ConfigException e) {
      throw e;
    }
    return envConfig;
    return setJEProperties(envConfig, jeProperties, attrMap);
  }