From 8ef902b7a80dfc0aa75ab840de2c04995385c0a1 Mon Sep 17 00:00:00 2001
From: Valery Kharseko <vharseko@3a-systems.ru>
Date: Fri, 25 Sep 2026 09:20:01 +0000
Subject: [PATCH] [#1068] Apply what a running backend takes of a configuration change, and ask for a restart for what it does not (#1069)
---
opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/ConfigurableEnvironment.java | 51 ++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 46 insertions(+), 5 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/ConfigurableEnvironment.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/ConfigurableEnvironment.java
index c364a19..3b51122 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/ConfigurableEnvironment.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/ConfigurableEnvironment.java
@@ -378,7 +378,25 @@
static EnvironmentConfig parseConfigEntry(JEBackendCfg cfg) throws ConfigException
{
validateDbCacheSize(cfg.getDBCacheSize());
+ final EnvironmentConfig envConfig = toEnvironmentConfig(cfg);
+ // The JE loggers are shared by every environment of the JVM: their level is set by the open, not
+ // built into the configuration of one environment.
+ Logger.getLogger("com.sleepycat.je").setLevel(parseLoggingLevel(cfg.getDBLoggingLevel(), cfg.dn()));
+ return envConfig;
+ }
+ /**
+ * Build the environment configuration the given configuration describes, and nothing else: no
+ * check of the cache size against the memory quota, no level set on the JE loggers. What a
+ * configuration change is checked as, applied to a running environment and held against, is
+ * built here.
+ *
+ * @param cfg The configuration to be parsed.
+ * @return An environment config instance corresponding to the configuration.
+ * @throws ConfigException If there is an error in the provided configuration.
+ */
+ static EnvironmentConfig toEnvironmentConfig(JEBackendCfg cfg) throws ConfigException
+ {
EnvironmentConfig envConfig = defaultConfig();
setDurability(envConfig, cfg.isDBTxnNoSync(), cfg.isDBTxnWriteNoSync());
setJEProperties(cfg, envConfig, cfg.dn().rdn().getFirstAVA().getAttributeValue());
@@ -389,6 +407,19 @@
return setJEProperties(envConfig, cfg.getJEProperty(), attrMap);
}
+ /**
+ * Get the name a JE property is configured under: the property of the backend configuration
+ * which is mapped to it, or the JE property's own name when it is set through je-property alone.
+ *
+ * @param jeProperty The JE property name.
+ * @return The name the operator changes it by.
+ */
+ static String configuredNameOf(String jeProperty)
+ {
+ final String attrName = attrMap.get(jeProperty);
+ return attrName != null ? attrName.substring(ConfigConstants.NAME_PREFIX_CFG.length()) : jeProperty;
+ }
+
private static void validateDbCacheSize(long dbCacheSize) throws ConfigException
{
if (dbCacheSize != 0)
@@ -430,6 +461,12 @@
{
envConfig.setDurability(Durability.COMMIT_WRITE_NO_SYNC);
}
+ else
+ {
+ // What JE falls back on when a configuration sets none - but set, so that a change back from
+ // either flag replaces the durability the environment runs with rather than leaving it be.
+ envConfig.setDurability(Durability.COMMIT_SYNC);
+ }
}
private static void setJEProperties(BackendCfg cfg, EnvironmentConfig envConfig, ByteString backendId)
@@ -447,18 +484,22 @@
private static void setDBLoggingLevel(EnvironmentConfig envConfig, String loggingLevel, DN dn,
boolean loggingFileHandlerOn) throws ConfigException
{
- Logger parent = Logger.getLogger("com.sleepycat.je");
+ // Refused as a whole here; the level itself is set on the JE loggers by the open.
+ parseLoggingLevel(loggingLevel, dn);
+ final Level level = loggingFileHandlerOn ? Level.ALL : Level.OFF;
+ envConfig.setConfigParam(FILE_LOGGING_LEVEL, level.getName());
+ }
+
+ private static Level parseLoggingLevel(String loggingLevel, DN dn) throws ConfigException
+ {
try
{
- parent.setLevel(Level.parse(loggingLevel));
+ return Level.parse(loggingLevel);
}
catch (Exception e)
{
throw new ConfigException(ERR_JEB_INVALID_LOGGING_LEVEL.get(loggingLevel, dn));
}
-
- final Level level = loggingFileHandlerOn ? Level.ALL : Level.OFF;
- envConfig.setConfigParam(FILE_LOGGING_LEVEL, level.getName());
}
/**
--
Gitblit v1.10.0