This is an automated email from the ASF dual-hosted git repository.
jackietien pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 274fc9ed443 Use the correct value in showConfiguration to override the
value read from the configuration file (#16681)
274fc9ed443 is described below
commit 274fc9ed4431b70ac3cbb1b5ca55a0b9374d9e6e
Author: shuwenwei <[email protected]>
AuthorDate: Fri Oct 31 14:13:19 2025 +0800
Use the correct value in showConfiguration to override the value read from
the configuration file (#16681)
---
.../confignode/conf/SystemPropertiesUtils.java | 2 +
.../org/apache/iotdb/db/conf/IoTDBStartCheck.java | 4 ++
.../java/org/apache/iotdb/db/service/DataNode.java | 4 ++
.../iotdb/commons/conf/ConfigurationFileUtils.java | 62 +++++++++++++++++++++-
.../commons/file/SystemPropertiesHandler.java | 2 +
5 files changed, 73 insertions(+), 1 deletion(-)
diff --git
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/conf/SystemPropertiesUtils.java
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/conf/SystemPropertiesUtils.java
index 3b2b51d42fd..529f15d06cd 100644
---
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/conf/SystemPropertiesUtils.java
+++
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/conf/SystemPropertiesUtils.java
@@ -22,6 +22,7 @@ package org.apache.iotdb.confignode.conf;
import org.apache.iotdb.common.rpc.thrift.TConfigNodeLocation;
import org.apache.iotdb.commons.conf.CommonConfig;
import org.apache.iotdb.commons.conf.CommonDescriptor;
+import org.apache.iotdb.commons.conf.ConfigurationFileUtils;
import org.apache.iotdb.commons.conf.IoTDBConstant;
import org.apache.iotdb.commons.exception.BadNodeUrlException;
import org.apache.iotdb.commons.file.SystemPropertiesHandler;
@@ -87,6 +88,7 @@ public class SystemPropertiesUtils {
*/
public static void checkSystemProperties() throws IOException {
Properties systemProperties = systemPropertiesHandler.read();
+ ConfigurationFileUtils.updateAppliedProperties(systemProperties, false);
final String format =
"[SystemProperties] The parameter \"{}\" can't be modified after first
startup."
+ " Your configuration: {} will be forced update to: {}";
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBStartCheck.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBStartCheck.java
index 3c1746a72cc..e2aa1950af6 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBStartCheck.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBStartCheck.java
@@ -415,4 +415,8 @@ public class IoTDBStartCheck {
}
}
}
+
+ public Properties getProperties() {
+ return properties;
+ }
}
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/DataNode.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/DataNode.java
index cebf7dab9f3..c4b08f8f05a 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/DataNode.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/DataNode.java
@@ -35,6 +35,7 @@ import org.apache.iotdb.commons.auth.entity.PrivilegeType;
import org.apache.iotdb.commons.client.exception.ClientManagerException;
import org.apache.iotdb.commons.concurrent.IoTDBDefaultThreadExceptionHandler;
import org.apache.iotdb.commons.conf.CommonDescriptor;
+import org.apache.iotdb.commons.conf.ConfigurationFileUtils;
import org.apache.iotdb.commons.conf.IoTDBConstant;
import org.apache.iotdb.commons.consensus.ConsensusGroupId;
import org.apache.iotdb.commons.consensus.DataRegionId;
@@ -270,6 +271,8 @@ public class DataNode extends ServerCommandLine implements
DataNodeMBean {
// Serialize mutable system properties
IoTDBStartCheck.getInstance().serializeMutableSystemPropertiesIfNecessary();
+ ConfigurationFileUtils.updateAppliedProperties(
+ IoTDBStartCheck.getInstance().getProperties(), false);
logger.info("IoTDB configuration: {}", config.getConfigMessage());
logger.info("Congratulations, IoTDB DataNode is set up successfully.
Now, enjoy yourself!");
@@ -439,6 +442,7 @@ public class DataNode extends ServerCommandLine implements
DataNodeMBean {
throw new StartupException(e.getMessage());
}
+ ConfigurationFileUtils.updateAppliedPropertiesFromCN(configurationResp);
// init
initTimestampPrecision();
long endTime = System.currentTimeMillis();
diff --git
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/ConfigurationFileUtils.java
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/ConfigurationFileUtils.java
index b0591d07dd2..08865658269 100644
---
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/ConfigurationFileUtils.java
+++
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/ConfigurationFileUtils.java
@@ -20,6 +20,7 @@
package org.apache.iotdb.commons.conf;
import org.apache.iotdb.commons.auth.entity.PrivilegeType;
+import org.apache.iotdb.confignode.rpc.thrift.TSystemConfigurationResp;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -91,7 +92,7 @@ public class ConfigurationFileUtils {
hidedParameters.add("trust_store_pwd");
}
- public static void updateAppliedProperties(TrimProperties properties,
boolean isHotReloading) {
+ public static void updateAppliedProperties(Properties properties, boolean
isHotReloading) {
try {
loadConfigurationDefaultValueFromTemplate();
} catch (IOException e) {
@@ -114,6 +115,65 @@ public class ConfigurationFileUtils {
}
}
+ public static void updateAppliedPropertiesFromCN(TSystemConfigurationResp
resp) {
+ if (resp.getGlobalConfig().isSetTimestampPrecision()) {
+ lastAppliedProperties.put(
+ "timestamp_precision",
resp.getGlobalConfig().getTimestampPrecision());
+ }
+ if (resp.getGlobalConfig().isSetTimePartitionInterval()) {
+ lastAppliedProperties.put(
+ "time_partition_interval",
+ String.valueOf(resp.getGlobalConfig().getTimePartitionInterval()));
+ }
+ if (resp.getGlobalConfig().isSetTimePartitionOrigin()) {
+ lastAppliedProperties.put(
+ "time_partition_origin",
String.valueOf(resp.getGlobalConfig().getTimePartitionOrigin()));
+ }
+ if (resp.getGlobalConfig().isSetSchemaEngineMode()) {
+ lastAppliedProperties.put("schema_engine_mode",
resp.getGlobalConfig().getSchemaEngineMode());
+ }
+ if (resp.getGlobalConfig().isSetTagAttributeTotalSize()) {
+ lastAppliedProperties.put(
+ "tag_attribute_total_size",
+ String.valueOf(resp.getGlobalConfig().getTagAttributeTotalSize()));
+ }
+ if (resp.getGlobalConfig().isSetSeriesPartitionExecutorClass()) {
+ lastAppliedProperties.put(
+ "series_partition_executor_class",
+ resp.getGlobalConfig().getSeriesPartitionExecutorClass());
+ }
+ if (resp.getGlobalConfig().isSetSeriesPartitionSlotNum()) {
+ lastAppliedProperties.put(
+ "series_slot_num",
String.valueOf(resp.getGlobalConfig().getSeriesPartitionSlotNum()));
+ }
+ if (resp.getGlobalConfig().isSetDataRegionConsensusProtocolClass()) {
+ lastAppliedProperties.put(
+ "data_region_consensus_protocol_class",
+ resp.getGlobalConfig().getDataRegionConsensusProtocolClass());
+ }
+ if (resp.getGlobalConfig().isSetSchemaRegionConsensusProtocolClass()) {
+ lastAppliedProperties.put(
+ "schema_region_consensus_protocol_class",
+ resp.getGlobalConfig().getSchemaRegionConsensusProtocolClass());
+ }
+ if (resp.getGlobalConfig().isSetReadConsistencyLevel()) {
+ lastAppliedProperties.put(
+ "read_consistency_level",
resp.getGlobalConfig().getReadConsistencyLevel());
+ }
+ if (resp.getGlobalConfig().isSetDiskSpaceWarningThreshold()) {
+ lastAppliedProperties.put(
+ "disk_space_warning_threshold",
+
String.valueOf(resp.getGlobalConfig().getDiskSpaceWarningThreshold()));
+ }
+ }
+
+ // This method may not be used in the current version directly, but should
not be removed to
+ // reduce conflicts
+ @SuppressWarnings("unused")
+ public static void updateAppliedProperties(String key, String value) {
+ lastAppliedProperties.put(key, value);
+ }
+
public static Map<String, String> getAppliedProperties() {
return lastAppliedProperties;
}
diff --git
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/file/SystemPropertiesHandler.java
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/file/SystemPropertiesHandler.java
index 5264f4735f6..dfbb2104cfb 100644
---
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/file/SystemPropertiesHandler.java
+++
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/file/SystemPropertiesHandler.java
@@ -19,6 +19,7 @@
package org.apache.iotdb.commons.file;
+import org.apache.iotdb.commons.conf.ConfigurationFileUtils;
import org.apache.iotdb.commons.conf.IoTDBConstant;
import org.apache.ratis.util.AutoCloseableLock;
@@ -80,6 +81,7 @@ public abstract class SystemPropertiesHandler {
}
public void overwrite(Properties properties) throws IOException {
+ ConfigurationFileUtils.updateAppliedProperties(properties, false);
try (AutoCloseableLock ignore =
AutoCloseableLock.acquire(lock.writeLock())) {
if (!formalFile.exists()) {
writeWithoutLock(properties, formalFile);