This is an automated email from the ASF dual-hosted git repository.

tanxinyu 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 a460acb28f0 Hot parameters recover (#12814)
a460acb28f0 is described below

commit a460acb28f0eb600bf5067ca0728a57e128c98fb
Author: YuFengLiu <[email protected]>
AuthorDate: Thu Jun 27 23:43:41 2024 +0800

    Hot parameters recover (#12814)
---
 .../confignode/conf/ConfigNodeDescriptor.java      |   3 -
 .../org/apache/iotdb/db/conf/IoTDBDescriptor.java  | 288 ++++++++++++---------
 .../conf/iotdb-system.properties.template          |  19 +-
 .../iotdb/commons/conf/CommonDescriptor.java       |  11 +-
 .../iotdb/commons/conf/ConfigurationFileUtils.java |  53 +++-
 5 files changed, 237 insertions(+), 137 deletions(-)

diff --git 
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/conf/ConfigNodeDescriptor.java
 
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/conf/ConfigNodeDescriptor.java
index 89123789eaf..9ca9c26b76c 100644
--- 
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/conf/ConfigNodeDescriptor.java
+++ 
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/conf/ConfigNodeDescriptor.java
@@ -175,9 +175,6 @@ public class ConfigNodeDescriptor {
     }
     if (seedConfigNode != null) {
       
conf.setSeedConfigNode(NodeUrlUtils.parseTEndPointUrls(seedConfigNode.trim()).get(0));
-    } else {
-      throw new IOException(
-          "The parameter cn_seed_config_node is not set, this ConfigNode will 
not join in any cluster.");
     }
 
     conf.setSeriesSlotNum(
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
index 9190bc97348..3b3387339de 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
@@ -1035,55 +1035,62 @@ public class IoTDBDescriptor {
     loadPipeConsensusProps(properties);
   }
 
-  private void reloadConsensusProps(Properties properties) {
+  private void reloadConsensusProps(Properties properties) throws IOException {
     loadIoTConsensusProps(properties);
     loadPipeConsensusProps(properties);
     DataRegionConsensusImpl.reloadConsensusConfig();
   }
 
-  private void loadIoTConsensusProps(Properties properties) {
+  private void loadIoTConsensusProps(Properties properties) throws IOException 
{
     conf.setMaxLogEntriesNumPerBatch(
         Integer.parseInt(
             properties
                 .getProperty(
                     "data_region_iot_max_log_entries_num_per_batch",
-                    String.valueOf(conf.getMaxLogEntriesNumPerBatch()))
+                    ConfigurationFileUtils.getConfigurationDefaultValue(
+                        "data_region_iot_max_log_entries_num_per_batch"))
                 .trim()));
     conf.setMaxSizePerBatch(
         Integer.parseInt(
             properties
                 .getProperty(
-                    "data_region_iot_max_size_per_batch", 
String.valueOf(conf.getMaxSizePerBatch()))
+                    "data_region_iot_max_size_per_batch",
+                    ConfigurationFileUtils.getConfigurationDefaultValue(
+                        "data_region_iot_max_size_per_batch"))
                 .trim()));
     conf.setMaxPendingBatchesNum(
         Integer.parseInt(
             properties
                 .getProperty(
                     "data_region_iot_max_pending_batches_num",
-                    String.valueOf(conf.getMaxPendingBatchesNum()))
+                    ConfigurationFileUtils.getConfigurationDefaultValue(
+                        "data_region_iot_max_pending_batches_num"))
                 .trim()));
     conf.setMaxMemoryRatioForQueue(
         Double.parseDouble(
             properties
                 .getProperty(
                     "data_region_iot_max_memory_ratio_for_queue",
-                    String.valueOf(conf.getMaxMemoryRatioForQueue()))
+                    ConfigurationFileUtils.getConfigurationDefaultValue(
+                        "data_region_iot_max_memory_ratio_for_queue"))
                 .trim()));
     conf.setRegionMigrationSpeedLimitBytesPerSecond(
         Long.parseLong(
             properties
                 .getProperty(
                     "region_migration_speed_limit_bytes_per_second",
-                    
String.valueOf(conf.getRegionMigrationSpeedLimitBytesPerSecond()))
+                    ConfigurationFileUtils.getConfigurationDefaultValue(
+                        "region_migration_speed_limit_bytes_per_second"))
                 .trim()));
   }
 
-  private void loadPipeConsensusProps(Properties properties) {
+  private void loadPipeConsensusProps(Properties properties) throws 
IOException {
     conf.setPipeConsensusPipelineSize(
         Integer.parseInt(
             properties.getProperty(
                 "fast_iot_consensus_pipeline_size",
-                Integer.toString(conf.getPipeConsensusPipelineSize()))));
+                ConfigurationFileUtils.getConfigurationDefaultValue(
+                    "fast_iot_consensus_pipeline_size"))));
     if (conf.getPipeConsensusPipelineSize() <= 0) {
       conf.setPipeConsensusPipelineSize(5);
     }
@@ -1100,7 +1107,7 @@ public class IoTDBDescriptor {
                 "author_cache_expire_time", 
String.valueOf(conf.getAuthorCacheExpireTime()))));
   }
 
-  private void loadWALProps(Properties properties) {
+  private void loadWALProps(Properties properties) throws IOException {
     conf.setWalMode(
         WALMode.valueOf((properties.getProperty("wal_mode", 
conf.getWalMode().toString()))));
 
@@ -1131,7 +1138,8 @@ public class IoTDBDescriptor {
     loadWALHotModifiedProps(properties);
   }
 
-  private void loadCompactionHotModifiedProps(Properties properties) throws 
InterruptedException {
+  private void loadCompactionHotModifiedProps(Properties properties)
+      throws InterruptedException, IOException {
     boolean compactionTaskConfigHotModified = 
loadCompactionTaskHotModifiedProps(properties);
     if (compactionTaskConfigHotModified) {
       CompactionTaskManager.getInstance().incrCompactionConfigVersion();
@@ -1141,7 +1149,8 @@ public class IoTDBDescriptor {
         Integer.parseInt(
             properties.getProperty(
                 "compaction_schedule_thread_num",
-                Integer.toString(conf.getCompactionScheduleThreadNum())));
+                ConfigurationFileUtils.getConfigurationDefaultValue(
+                    "compaction_schedule_thread_num")));
     compactionScheduleThreadNum =
         compactionScheduleThreadNum <= 0 ? 1 : compactionScheduleThreadNum;
     conf.setCompactionScheduleThreadNum(compactionScheduleThreadNum);
@@ -1164,7 +1173,7 @@ public class IoTDBDescriptor {
         .setWriteMergeRate(conf.getCompactionWriteThroughputMbPerSec());
   }
 
-  private boolean loadCompactionTaskHotModifiedProps(Properties properties) {
+  private boolean loadCompactionTaskHotModifiedProps(Properties properties) 
throws IOException {
     boolean configModified = false;
     // update merge_write_throughput_mb_per_sec
     int compactionWriteThroughput = 
conf.getCompactionWriteThroughputMbPerSec();
@@ -1172,7 +1181,8 @@ public class IoTDBDescriptor {
         Integer.parseInt(
             properties.getProperty(
                 "compaction_write_throughput_mb_per_sec",
-                
Integer.toString(conf.getCompactionWriteThroughputMbPerSec()))));
+                ConfigurationFileUtils.getConfigurationDefaultValue(
+                    "compaction_write_throughput_mb_per_sec"))));
     configModified |= compactionWriteThroughput != 
conf.getCompactionWriteThroughputMbPerSec();
 
     // update compaction_read_operation_per_sec
@@ -1181,7 +1191,8 @@ public class IoTDBDescriptor {
         Integer.parseInt(
             properties.getProperty(
                 "compaction_read_operation_per_sec",
-                Integer.toString(conf.getCompactionReadOperationPerSec()))));
+                ConfigurationFileUtils.getConfigurationDefaultValue(
+                    "compaction_read_operation_per_sec"))));
     configModified |= compactionReadOperation != 
conf.getCompactionReadOperationPerSec();
 
     // update compaction_read_throughput_mb_per_sec
@@ -1190,7 +1201,8 @@ public class IoTDBDescriptor {
         Integer.parseInt(
             properties.getProperty(
                 "compaction_read_throughput_mb_per_sec",
-                
Integer.toString(conf.getCompactionReadThroughputMbPerSec()))));
+                ConfigurationFileUtils.getConfigurationDefaultValue(
+                    "compaction_read_throughput_mb_per_sec"))));
     configModified |= compactionReadThroughput != 
conf.getCompactionReadThroughputMbPerSec();
 
     // update max_inner_compaction_candidate_file_num
@@ -1199,7 +1211,8 @@ public class IoTDBDescriptor {
         Integer.parseInt(
             properties.getProperty(
                 "max_inner_compaction_candidate_file_num",
-                Integer.toString(conf.getFileLimitPerInnerTask()))));
+                ConfigurationFileUtils.getConfigurationDefaultValue(
+                    "max_inner_compaction_candidate_file_num"))));
     configModified |= maxInnerCompactionCandidateFileNum != 
conf.getFileLimitPerInnerTask();
 
     // update target_compaction_file_size
@@ -1207,7 +1220,9 @@ public class IoTDBDescriptor {
     conf.setTargetCompactionFileSize(
         Long.parseLong(
             properties.getProperty(
-                "target_compaction_file_size", 
Long.toString(conf.getTargetCompactionFileSize()))));
+                "target_compaction_file_size",
+                ConfigurationFileUtils.getConfigurationDefaultValue(
+                    "target_compaction_file_size"))));
     configModified |= targetCompactionFilesize != 
conf.getTargetCompactionFileSize();
 
     // update max_cross_compaction_candidate_file_num
@@ -1216,7 +1231,8 @@ public class IoTDBDescriptor {
         Integer.parseInt(
             properties.getProperty(
                 "max_cross_compaction_candidate_file_num",
-                Integer.toString(conf.getFileLimitPerCrossTask()))));
+                ConfigurationFileUtils.getConfigurationDefaultValue(
+                    "max_cross_compaction_candidate_file_num"))));
     configModified |= maxCrossCompactionCandidateFileNum != 
conf.getFileLimitPerCrossTask();
 
     // update max_cross_compaction_candidate_file_size
@@ -1225,7 +1241,8 @@ public class IoTDBDescriptor {
         Long.parseLong(
             properties.getProperty(
                 "max_cross_compaction_candidate_file_size",
-                
Long.toString(conf.getMaxCrossCompactionCandidateFileSize()))));
+                ConfigurationFileUtils.getConfigurationDefaultValue(
+                    "max_cross_compaction_candidate_file_size"))));
     configModified |=
         maxCrossCompactionCandidateFileSize != 
conf.getMaxCrossCompactionCandidateFileSize();
 
@@ -1235,7 +1252,8 @@ public class IoTDBDescriptor {
         Integer.parseInt(
             properties.getProperty(
                 "min_cross_compaction_unseq_file_level",
-                
Integer.toString(conf.getMinCrossCompactionUnseqFileLevel()))));
+                ConfigurationFileUtils.getConfigurationDefaultValue(
+                    "min_cross_compaction_unseq_file_level"))));
     configModified |=
         minCrossCompactionCandidateFileNum != 
conf.getMinCrossCompactionUnseqFileLevel();
 
@@ -1246,7 +1264,8 @@ public class IoTDBDescriptor {
         Double.parseDouble(
             properties.getProperty(
                 "inner_compaction_task_selection_disk_redundancy",
-                
Double.toString(conf.getInnerCompactionTaskSelectionDiskRedundancy()))));
+                ConfigurationFileUtils.getConfigurationDefaultValue(
+                    "inner_compaction_task_selection_disk_redundancy"))));
     configModified |=
         (Math.abs(
                 innerCompactionTaskSelectionDiskRedundancy
@@ -1260,7 +1279,8 @@ public class IoTDBDescriptor {
         Long.parseLong(
             properties.getProperty(
                 "inner_compaction_task_selection_mods_file_threshold",
-                
Long.toString(conf.getInnerCompactionTaskSelectionModsFileThreshold()))));
+                ConfigurationFileUtils.getConfigurationDefaultValue(
+                    "inner_compaction_task_selection_mods_file_threshold"))));
     configModified |=
         innerCompactionTaskSelectionModsFileThreshold
             != conf.getInnerCompactionTaskSelectionModsFileThreshold();
@@ -1268,11 +1288,13 @@ public class IoTDBDescriptor {
     return configModified;
   }
 
-  private boolean loadCompactionThreadCountHotModifiedProps(Properties 
properties) {
+  private boolean loadCompactionThreadCountHotModifiedProps(Properties 
properties)
+      throws IOException {
     int newConfigCompactionThreadCount =
         Integer.parseInt(
             properties.getProperty(
-                "compaction_thread_count", 
Integer.toString(conf.getCompactionThreadCount())));
+                "compaction_thread_count",
+                
ConfigurationFileUtils.getConfigurationDefaultValue("compaction_thread_count")));
     if (newConfigCompactionThreadCount <= 0) {
       LOGGER.error("compaction_thread_count must greater than 0");
       return false;
@@ -1283,15 +1305,19 @@ public class IoTDBDescriptor {
     conf.setCompactionThreadCount(
         Integer.parseInt(
             properties.getProperty(
-                "compaction_thread_count", 
Integer.toString(conf.getCompactionThreadCount()))));
+                "compaction_thread_count",
+                
ConfigurationFileUtils.getConfigurationDefaultValue("compaction_thread_count"))));
     return true;
   }
 
-  private boolean loadCompactionSubTaskCountHotModifiedProps(Properties 
properties) {
+  private boolean loadCompactionSubTaskCountHotModifiedProps(Properties 
properties)
+      throws IOException {
     int newConfigSubtaskNum =
         Integer.parseInt(
             properties.getProperty(
-                "sub_compaction_thread_count", 
Integer.toString(conf.getSubCompactionTaskNum())));
+                "sub_compaction_thread_count",
+                ConfigurationFileUtils.getConfigurationDefaultValue(
+                    "sub_compaction_thread_count")));
     if (newConfigSubtaskNum <= 0) {
       LOGGER.error("sub_compaction_thread_count must greater than 0");
       return false;
@@ -1303,7 +1329,7 @@ public class IoTDBDescriptor {
     return true;
   }
 
-  private void loadCompactionIsEnabledHotModifiedProps(Properties properties) {
+  private void loadCompactionIsEnabledHotModifiedProps(Properties properties) 
throws IOException {
     boolean isCompactionEnabled =
         conf.isEnableSeqSpaceCompaction()
             || conf.isEnableUnseqSpaceCompaction()
@@ -1312,17 +1338,20 @@ public class IoTDBDescriptor {
         Boolean.parseBoolean(
             properties.getProperty(
                 "enable_cross_space_compaction",
-                Boolean.toString(conf.isEnableCrossSpaceCompaction())));
+                ConfigurationFileUtils.getConfigurationDefaultValue(
+                    "enable_cross_space_compaction")));
     boolean newConfigEnableSeqSpaceCompaction =
         Boolean.parseBoolean(
             properties.getProperty(
                 "enable_seq_space_compaction",
-                Boolean.toString(conf.isEnableSeqSpaceCompaction())));
+                ConfigurationFileUtils.getConfigurationDefaultValue(
+                    "enable_seq_space_compaction")));
     boolean newConfigEnableUnseqSpaceCompaction =
         Boolean.parseBoolean(
             properties.getProperty(
                 "enable_unseq_space_compaction",
-                Boolean.toString(conf.isEnableUnseqSpaceCompaction())));
+                ConfigurationFileUtils.getConfigurationDefaultValue(
+                    "enable_unseq_space_compaction")));
     boolean compactionEnabledInNewConfig =
         newConfigEnableCrossSpaceCompaction
             || newConfigEnableSeqSpaceCompaction
@@ -1338,12 +1367,13 @@ public class IoTDBDescriptor {
     conf.setEnableUnseqSpaceCompaction(newConfigEnableUnseqSpaceCompaction);
   }
 
-  private void loadWALHotModifiedProps(Properties properties) {
+  private void loadWALHotModifiedProps(Properties properties) throws 
IOException {
     long walAsyncModeFsyncDelayInMs =
         Long.parseLong(
             properties.getProperty(
                 "wal_async_mode_fsync_delay_in_ms",
-                Long.toString(conf.getWalAsyncModeFsyncDelayInMs())));
+                ConfigurationFileUtils.getConfigurationDefaultValue(
+                    "wal_async_mode_fsync_delay_in_ms")));
     if (walAsyncModeFsyncDelayInMs > 0) {
       conf.setWalAsyncModeFsyncDelayInMs(walAsyncModeFsyncDelayInMs);
     }
@@ -1352,7 +1382,8 @@ public class IoTDBDescriptor {
         Long.parseLong(
             properties.getProperty(
                 "wal_sync_mode_fsync_delay_in_ms",
-                Long.toString(conf.getWalSyncModeFsyncDelayInMs())));
+                ConfigurationFileUtils.getConfigurationDefaultValue(
+                    "wal_sync_mode_fsync_delay_in_ms")));
     if (walSyncModeFsyncDelayInMs > 0) {
       conf.setWalSyncModeFsyncDelayInMs(walSyncModeFsyncDelayInMs);
     }
@@ -1361,7 +1392,8 @@ public class IoTDBDescriptor {
         Long.parseLong(
             properties.getProperty(
                 "wal_file_size_threshold_in_byte",
-                Long.toString(conf.getWalFileSizeThresholdInByte())));
+                ConfigurationFileUtils.getConfigurationDefaultValue(
+                    "wal_file_size_threshold_in_byte")));
     if (walFileSizeThreshold > 0) {
       conf.setWalFileSizeThresholdInByte(walFileSizeThreshold);
     }
@@ -1370,7 +1402,8 @@ public class IoTDBDescriptor {
         Double.parseDouble(
             properties.getProperty(
                 "wal_min_effective_info_ratio",
-                Double.toString(conf.getWalMinEffectiveInfoRatio())));
+                ConfigurationFileUtils.getConfigurationDefaultValue(
+                    "wal_min_effective_info_ratio")));
     if (walMinEffectiveInfoRatio > 0) {
       conf.setWalMinEffectiveInfoRatio(walMinEffectiveInfoRatio);
     }
@@ -1379,7 +1412,8 @@ public class IoTDBDescriptor {
         Long.parseLong(
             properties.getProperty(
                 "wal_memtable_snapshot_threshold_in_byte",
-                Long.toString(conf.getWalMemTableSnapshotThreshold())));
+                ConfigurationFileUtils.getConfigurationDefaultValue(
+                    "wal_memtable_snapshot_threshold_in_byte")));
     if (walMemTableSnapshotThreshold > 0) {
       conf.setWalMemTableSnapshotThreshold(walMemTableSnapshotThreshold);
     }
@@ -1388,7 +1422,8 @@ public class IoTDBDescriptor {
         Integer.parseInt(
             properties.getProperty(
                 "max_wal_memtable_snapshot_num",
-                Integer.toString(conf.getMaxWalMemTableSnapshotNum())));
+                ConfigurationFileUtils.getConfigurationDefaultValue(
+                    "max_wal_memtable_snapshot_num")));
     if (maxWalMemTableSnapshotNum > 0) {
       conf.setMaxWalMemTableSnapshotNum(maxWalMemTableSnapshotNum);
     }
@@ -1397,7 +1432,8 @@ public class IoTDBDescriptor {
         Long.parseLong(
             properties.getProperty(
                 "delete_wal_files_period_in_ms",
-                Long.toString(conf.getDeleteWalFilesPeriodInMs())));
+                ConfigurationFileUtils.getConfigurationDefaultValue(
+                    "delete_wal_files_period_in_ms")));
     if (deleteWalFilesPeriod > 0) {
       conf.setDeleteWalFilesPeriodInMs(deleteWalFilesPeriod);
     }
@@ -1406,7 +1442,8 @@ public class IoTDBDescriptor {
         Long.parseLong(
             properties.getProperty(
                 "iot_consensus_throttle_threshold_in_byte",
-                Long.toString(getThrottleThresholdWithDirs())));
+                ConfigurationFileUtils.getConfigurationDefaultValue(
+                    "iot_consensus_throttle_threshold_in_byte")));
     if (throttleDownThresholdInByte > 0) {
       conf.setThrottleThreshold(throttleDownThresholdInByte);
     }
@@ -1415,7 +1452,8 @@ public class IoTDBDescriptor {
         Long.parseLong(
             properties.getProperty(
                 "iot_consensus_cache_window_time_in_ms",
-                Long.toString(conf.getCacheWindowTimeInMs())));
+                ConfigurationFileUtils.getConfigurationDefaultValue(
+                    "iot_consensus_cache_window_time_in_ms")));
     if (cacheWindowInMs > 0) {
       conf.setCacheWindowTimeInMs(cacheWindowInMs);
     }
@@ -1448,69 +1486,80 @@ public class IoTDBDescriptor {
     return Math.max(Math.min(newThrottleThreshold, MAX_THROTTLE_THRESHOLD), 
MIN_THROTTLE_THRESHOLD);
   }
 
-  private void loadAutoCreateSchemaProps(Properties properties) {
+  private void loadAutoCreateSchemaProps(Properties properties) throws 
IOException {
     conf.setAutoCreateSchemaEnabled(
         Boolean.parseBoolean(
             properties.getProperty(
                 "enable_auto_create_schema",
-                Boolean.toString(conf.isAutoCreateSchemaEnabled()).trim())));
+                
ConfigurationFileUtils.getConfigurationDefaultValue("enable_auto_create_schema"))));
     conf.setBooleanStringInferType(
         TSDataType.valueOf(
             properties.getProperty(
-                "boolean_string_infer_type", 
conf.getBooleanStringInferType().toString())));
+                "boolean_string_infer_type",
+                
ConfigurationFileUtils.getConfigurationDefaultValue("boolean_string_infer_type"))));
     conf.setIntegerStringInferType(
         TSDataType.valueOf(
             properties.getProperty(
-                "integer_string_infer_type", 
conf.getIntegerStringInferType().toString())));
+                "integer_string_infer_type",
+                
ConfigurationFileUtils.getConfigurationDefaultValue("integer_string_infer_type"))));
     conf.setFloatingStringInferType(
         TSDataType.valueOf(
             properties.getProperty(
-                "floating_string_infer_type", 
conf.getFloatingStringInferType().toString())));
+                "floating_string_infer_type",
+                ConfigurationFileUtils.getConfigurationDefaultValue(
+                    "floating_string_infer_type"))));
     conf.setNanStringInferType(
         TSDataType.valueOf(
             properties.getProperty(
-                "nan_string_infer_type", 
conf.getNanStringInferType().toString())));
+                "nan_string_infer_type",
+                
ConfigurationFileUtils.getConfigurationDefaultValue("nan_string_infer_type"))));
     conf.setDefaultStorageGroupLevel(
         Integer.parseInt(
             properties.getProperty(
                 "default_storage_group_level",
-                Integer.toString(conf.getDefaultStorageGroupLevel()))));
+                ConfigurationFileUtils.getConfigurationDefaultValue(
+                    "default_storage_group_level"))));
     conf.setDefaultBooleanEncoding(
         properties.getProperty(
-            "default_boolean_encoding", 
conf.getDefaultBooleanEncoding().toString()));
+            "default_boolean_encoding",
+            
ConfigurationFileUtils.getConfigurationDefaultValue("default_boolean_encoding")));
     conf.setDefaultInt32Encoding(
         properties.getProperty(
-            "default_int32_encoding", 
conf.getDefaultInt32Encoding().toString()));
+            "default_int32_encoding",
+            
ConfigurationFileUtils.getConfigurationDefaultValue("default_int32_encoding")));
     conf.setDefaultInt64Encoding(
         properties.getProperty(
-            "default_int64_encoding", 
conf.getDefaultInt64Encoding().toString()));
+            "default_int64_encoding",
+            
ConfigurationFileUtils.getConfigurationDefaultValue("default_int64_encoding")));
     conf.setDefaultFloatEncoding(
         properties.getProperty(
-            "default_float_encoding", 
conf.getDefaultFloatEncoding().toString()));
+            "default_float_encoding",
+            
ConfigurationFileUtils.getConfigurationDefaultValue("default_float_encoding")));
     conf.setDefaultDoubleEncoding(
         properties.getProperty(
-            "default_double_encoding", 
conf.getDefaultDoubleEncoding().toString()));
+            "default_double_encoding",
+            
ConfigurationFileUtils.getConfigurationDefaultValue("default_double_encoding")));
     conf.setDefaultTextEncoding(
-        properties.getProperty("default_text_encoding", 
conf.getDefaultTextEncoding().toString()));
+        properties.getProperty(
+            "default_text_encoding",
+            
ConfigurationFileUtils.getConfigurationDefaultValue("default_text_encoding")));
   }
 
-  private void loadTsFileProps(Properties properties) {
+  private void loadTsFileProps(Properties properties) throws IOException {
     TSFileDescriptor.getInstance()
         .getConfig()
         .setGroupSizeInByte(
             Integer.parseInt(
                 properties.getProperty(
                     "group_size_in_byte",
-                    Integer.toString(
-                        
TSFileDescriptor.getInstance().getConfig().getGroupSizeInByte()))));
+                    
ConfigurationFileUtils.getConfigurationDefaultValue("group_size_in_byte"))));
     TSFileDescriptor.getInstance()
         .getConfig()
         .setPageSizeInByte(
             Integer.parseInt(
                 properties.getProperty(
                     "page_size_in_byte",
-                    Integer.toString(
-                        
TSFileDescriptor.getInstance().getConfig().getPageSizeInByte()))));
+                    
ConfigurationFileUtils.getConfigurationDefaultValue("page_size_in_byte"))));
     if (TSFileDescriptor.getInstance().getConfig().getPageSizeInByte()
         > TSFileDescriptor.getInstance().getConfig().getGroupSizeInByte()) {
       LOGGER.warn("page_size is greater than group size, will set it as the 
same with group size");
@@ -1524,59 +1573,34 @@ public class IoTDBDescriptor {
             Integer.parseInt(
                 properties.getProperty(
                     "max_number_of_points_in_page",
-                    Integer.toString(
-                        
TSFileDescriptor.getInstance().getConfig().getMaxNumberOfPointsInPage()))));
-    TSFileDescriptor.getInstance()
-        .getConfig()
-        .setMaxStringLength(
-            Integer.parseInt(
-                properties.getProperty(
-                    "max_string_length",
-                    Integer.toString(
-                        
TSFileDescriptor.getInstance().getConfig().getMaxStringLength()))));
-    TSFileDescriptor.getInstance()
-        .getConfig()
-        .setBloomFilterErrorRate(
-            Double.parseDouble(
-                properties.getProperty(
-                    "bloom_filter_error_rate",
-                    Double.toString(
-                        
TSFileDescriptor.getInstance().getConfig().getBloomFilterErrorRate()))));
+                    ConfigurationFileUtils.getConfigurationDefaultValue(
+                        "max_number_of_points_in_page"))));
     TSFileDescriptor.getInstance()
         .getConfig()
         .setFloatPrecision(
             Integer.parseInt(
                 properties.getProperty(
                     "float_precision",
-                    Integer.toString(
-                        
TSFileDescriptor.getInstance().getConfig().getFloatPrecision()))));
+                    
ConfigurationFileUtils.getConfigurationDefaultValue("float_precision"))));
     TSFileDescriptor.getInstance()
         .getConfig()
         .setValueEncoder(
             properties.getProperty(
-                "value_encoder", 
TSFileDescriptor.getInstance().getConfig().getValueEncoder()));
+                "value_encoder",
+                
ConfigurationFileUtils.getConfigurationDefaultValue("value_encoder")));
     TSFileDescriptor.getInstance()
         .getConfig()
         .setCompressor(
             properties.getProperty(
-                "compressor",
-                
TSFileDescriptor.getInstance().getConfig().getCompressor().toString()));
-    TSFileDescriptor.getInstance()
-        .getConfig()
-        .setMaxDegreeOfIndexNode(
-            Integer.parseInt(
-                properties.getProperty(
-                    "max_degree_of_index_node",
-                    Integer.toString(
-                        
TSFileDescriptor.getInstance().getConfig().getMaxDegreeOfIndexNode()))));
+                "compressor", 
ConfigurationFileUtils.getConfigurationDefaultValue("compressor")));
     TSFileDescriptor.getInstance()
         .getConfig()
         .setMaxTsBlockSizeInBytes(
             Integer.parseInt(
                 properties.getProperty(
                     "max_tsblock_size_in_bytes",
-                    Integer.toString(
-                        
TSFileDescriptor.getInstance().getConfig().getMaxTsBlockSizeInBytes()))));
+                    ConfigurationFileUtils.getConfigurationDefaultValue(
+                        "max_tsblock_size_in_bytes"))));
 
     // min(default_size, maxBytesForQuery)
     TSFileDescriptor.getInstance()
@@ -1593,8 +1617,8 @@ public class IoTDBDescriptor {
             Integer.parseInt(
                 properties.getProperty(
                     "max_tsblock_line_number",
-                    Integer.toString(
-                        
TSFileDescriptor.getInstance().getConfig().getMaxTsBlockLineNumber()))));
+                    ConfigurationFileUtils.getConfigurationDefaultValue(
+                        "max_tsblock_line_number"))));
   }
 
   // Mqtt related
@@ -1635,19 +1659,21 @@ public class IoTDBDescriptor {
   }
 
   // timed flush memtable
-  private void loadTimedService(Properties properties) {
+  private void loadTimedService(Properties properties) throws IOException {
     conf.setEnableTimedFlushSeqMemtable(
         Boolean.parseBoolean(
             properties.getProperty(
                 "enable_timed_flush_seq_memtable",
-                Boolean.toString(conf.isEnableTimedFlushSeqMemtable()))));
+                ConfigurationFileUtils.getConfigurationDefaultValue(
+                    "enable_timed_flush_seq_memtable"))));
 
     long seqMemTableFlushInterval =
         Long.parseLong(
             properties
                 .getProperty(
                     "seq_memtable_flush_interval_in_ms",
-                    Long.toString(conf.getSeqMemtableFlushInterval()))
+                    ConfigurationFileUtils.getConfigurationDefaultValue(
+                        "seq_memtable_flush_interval_in_ms"))
                 .trim());
     if (seqMemTableFlushInterval > 0) {
       conf.setSeqMemtableFlushInterval(seqMemTableFlushInterval);
@@ -1658,7 +1684,8 @@ public class IoTDBDescriptor {
             properties
                 .getProperty(
                     "seq_memtable_flush_check_interval_in_ms",
-                    Long.toString(conf.getSeqMemtableFlushCheckInterval()))
+                    ConfigurationFileUtils.getConfigurationDefaultValue(
+                        "seq_memtable_flush_check_interval_in_ms"))
                 .trim());
     if (seqMemTableFlushCheckInterval > 0) {
       conf.setSeqMemtableFlushCheckInterval(seqMemTableFlushCheckInterval);
@@ -1668,14 +1695,16 @@ public class IoTDBDescriptor {
         Boolean.parseBoolean(
             properties.getProperty(
                 "enable_timed_flush_unseq_memtable",
-                Boolean.toString(conf.isEnableTimedFlushUnseqMemtable()))));
+                ConfigurationFileUtils.getConfigurationDefaultValue(
+                    "enable_timed_flush_unseq_memtable"))));
 
     long unseqMemTableFlushInterval =
         Long.parseLong(
             properties
                 .getProperty(
                     "unseq_memtable_flush_interval_in_ms",
-                    Long.toString(conf.getUnseqMemtableFlushInterval()))
+                    ConfigurationFileUtils.getConfigurationDefaultValue(
+                        "unseq_memtable_flush_interval_in_ms"))
                 .trim());
     if (unseqMemTableFlushInterval > 0) {
       conf.setUnseqMemtableFlushInterval(unseqMemTableFlushInterval);
@@ -1686,7 +1715,8 @@ public class IoTDBDescriptor {
             properties
                 .getProperty(
                     "unseq_memtable_flush_check_interval_in_ms",
-                    Long.toString(conf.getUnseqMemtableFlushCheckInterval()))
+                    ConfigurationFileUtils.getConfigurationDefaultValue(
+                        "unseq_memtable_flush_check_interval_in_ms"))
                 .trim());
     if (unseqMemTableFlushCheckInterval > 0) {
       conf.setUnseqMemtableFlushCheckInterval(unseqMemTableFlushCheckInterval);
@@ -1702,7 +1732,8 @@ public class IoTDBDescriptor {
     return tierDataDirs;
   }
 
-  public void loadHotModifiedProps(Properties properties) throws 
QueryProcessException {
+  public synchronized void loadHotModifiedProps(Properties properties)
+      throws QueryProcessException {
     try {
       // update data dirs
       String dataDirs = properties.getProperty("dn_data_dirs", null);
@@ -1711,7 +1742,10 @@ public class IoTDBDescriptor {
       }
 
       // update dir strategy
-      String multiDirStrategyClassName = 
properties.getProperty("dn_multi_dir_strategy", null);
+      String multiDirStrategyClassName =
+          properties.getProperty(
+              "dn_multi_dir_strategy",
+              
ConfigurationFileUtils.getConfigurationDefaultValue("dn_multi_dir_strategy"));
       if (multiDirStrategyClassName != null
           && 
!multiDirStrategyClassName.equals(conf.getMultiDirStrategyClassName())) {
         conf.setMultiDirStrategyClassName(multiDirStrategyClassName);
@@ -1730,36 +1764,44 @@ public class IoTDBDescriptor {
       loadTsFileProps(properties);
       // update cluster name
       conf.setClusterName(
-          properties.getProperty(IoTDBConstant.CLUSTER_NAME, 
conf.getClusterName()));
+          properties.getProperty(
+              IoTDBConstant.CLUSTER_NAME,
+              
ConfigurationFileUtils.getConfigurationDefaultValue(IoTDBConstant.CLUSTER_NAME)));
       // update slow_query_threshold
       conf.setSlowQueryThreshold(
           Long.parseLong(
               properties.getProperty(
-                  "slow_query_threshold", 
Long.toString(conf.getSlowQueryThreshold()))));
+                  "slow_query_threshold",
+                  
ConfigurationFileUtils.getConfigurationDefaultValue("slow_query_threshold"))));
       // update select into operation max buffer size
       conf.setIntoOperationBufferSizeInByte(
           Long.parseLong(
               properties.getProperty(
                   "into_operation_buffer_size_in_byte",
-                  String.valueOf(conf.getIntoOperationBufferSizeInByte()))));
+                  ConfigurationFileUtils.getConfigurationDefaultValue(
+                      "into_operation_buffer_size_in_byte"))));
       // update insert-tablet-plan's row limit for select-into
       conf.setSelectIntoInsertTabletPlanRowLimit(
           Integer.parseInt(
               properties.getProperty(
                   "select_into_insert_tablet_plan_row_limit",
-                  
String.valueOf(conf.getSelectIntoInsertTabletPlanRowLimit()))));
+                  ConfigurationFileUtils.getConfigurationDefaultValue(
+                      "select_into_insert_tablet_plan_row_limit"))));
 
       // update enable query memory estimation for memory control
       conf.setEnableQueryMemoryEstimation(
           Boolean.parseBoolean(
               properties.getProperty(
                   "enable_query_memory_estimation",
-                  Boolean.toString(conf.isEnableQueryMemoryEstimation()))));
+                  ConfigurationFileUtils.getConfigurationDefaultValue(
+                      "enable_query_memory_estimation"))));
 
       conf.setEnableTsFileValidation(
           Boolean.parseBoolean(
               properties.getProperty(
-                  "enable_tsfile_validation", 
String.valueOf(conf.isEnableTsFileValidation()))));
+                  "enable_tsfile_validation",
+                  ConfigurationFileUtils.getConfigurationDefaultValue(
+                      "enable_tsfile_validation"))));
 
       // update wal config
       long prevDeleteWalFilesPeriodInMs = conf.getDeleteWalFilesPeriodInMs();
@@ -1776,13 +1818,15 @@ public class IoTDBDescriptor {
           Long.parseLong(
               properties.getProperty(
                   "load_clean_up_task_execution_delay_time_seconds",
-                  
String.valueOf(conf.getLoadCleanupTaskExecutionDelayTimeSeconds()))));
+                  ConfigurationFileUtils.getConfigurationDefaultValue(
+                      "load_clean_up_task_execution_delay_time_seconds"))));
 
       conf.setLoadWriteThroughputBytesPerSecond(
           Double.parseDouble(
               properties.getProperty(
                   "load_write_throughput_bytes_per_second",
-                  
String.valueOf(conf.getLoadWriteThroughputBytesPerSecond()))));
+                  ConfigurationFileUtils.getConfigurationDefaultValue(
+                      "load_write_throughput_bytes_per_second"))));
 
       // update pipe config
       commonDescriptor
@@ -1791,17 +1835,21 @@ public class IoTDBDescriptor {
               Double.parseDouble(
                   properties.getProperty(
                       "pipe_all_sinks_rate_limit_bytes_per_second",
-                      String.valueOf(
-                          
commonDescriptor.getConfig().getPipeAllSinksRateLimitBytesPerSecond()))));
+                      ConfigurationFileUtils.getConfigurationDefaultValue(
+                          "pipe_all_sinks_rate_limit_bytes_per_second"))));
 
       // update merge_threshold_of_explain_analyze
       conf.setMergeThresholdOfExplainAnalyze(
           Integer.parseInt(
               properties.getProperty(
                   "merge_threshold_of_explain_analyze",
-                  String.valueOf(conf.getMergeThresholdOfExplainAnalyze()))));
+                  ConfigurationFileUtils.getConfigurationDefaultValue(
+                      "merge_threshold_of_explain_analyze"))));
       boolean enableWALCompression =
-          
Boolean.parseBoolean(properties.getProperty("enable_wal_compression", "false"));
+          Boolean.parseBoolean(
+              properties.getProperty(
+                  "enable_wal_compression",
+                  
ConfigurationFileUtils.getConfigurationDefaultValue("enable_wal_compression")));
       conf.setWALCompressionAlgorithm(
           enableWALCompression ? CompressionType.LZ4 : 
CompressionType.UNCOMPRESSED);
 
@@ -1815,7 +1863,7 @@ public class IoTDBDescriptor {
     }
   }
 
-  public void loadHotModifiedProps() throws QueryProcessException {
+  public synchronized void loadHotModifiedProps() throws QueryProcessException 
{
     URL url = getPropsUrl(CommonConfig.SYSTEM_CONFIG_NAME);
     if (url == null) {
       LOGGER.warn("Couldn't load the configuration from any of the known 
sources.");
@@ -1826,11 +1874,14 @@ public class IoTDBDescriptor {
     try (InputStream inputStream = url.openStream()) {
       LOGGER.info("Start to reload config file {}", url);
       commonProperties.load(new InputStreamReader(inputStream, 
StandardCharsets.UTF_8));
+      ConfigurationFileUtils.getConfigurationDefaultValue();
       loadHotModifiedProps(commonProperties);
     } catch (Exception e) {
       LOGGER.warn("Fail to reload config file {}", url, e);
       throw new QueryProcessException(
           String.format("Fail to reload config file %s because %s", url, 
e.getMessage()));
+    } finally {
+      ConfigurationFileUtils.releaseDefault();
     }
     reloadMetricProperties(commonProperties);
   }
@@ -2261,9 +2312,6 @@ public class IoTDBDescriptor {
         LOGGER.error(
             "ConfigNodes are set in wrong format, please set them like 
127.0.0.1:10710", e);
       }
-    } else {
-      throw new IOException(
-          "The parameter dn_seed_config_node is not set, this DataNode will 
not join in any cluster.");
     }
 
     conf.setInternalAddress(
diff --git 
a/iotdb-core/node-commons/src/assembly/resources/conf/iotdb-system.properties.template
 
b/iotdb-core/node-commons/src/assembly/resources/conf/iotdb-system.properties.template
index 22b74f66753..27f5a17d20d 100644
--- 
a/iotdb-core/node-commons/src/assembly/resources/conf/iotdb-system.properties.template
+++ 
b/iotdb-core/node-commons/src/assembly/resources/conf/iotdb-system.properties.template
@@ -24,7 +24,7 @@
 # Used for indicate cluster name and distinguish different cluster.
 # If you need to modify the cluster name, it's recommended to use 'set 
configuration "cluster_name=xxx"' sql.
 # Manually modifying configuration file is not recommended, which may cause 
node restart fail.
-# effectiveMode: restart
+# effectiveMode: hot_reload
 # Datatype: string
 cluster_name=defaultCluster
 
@@ -1410,6 +1410,7 @@ iot_consensus_cache_window_time_in_ms=-1
 
 # Enable Write Ahead Log compression.
 # Option: true, false
+# effectiveMode: hot_reload
 enable_wal_compression=false
 
 ####################
@@ -1462,7 +1463,7 @@ page_size_in_byte=65536
 max_number_of_points_in_page=10000
 
 # The threshold for pattern matching in regex
-# effectiveMode: hot_reload
+# effectiveMode: restart
 # Datatype: int
 pattern_matching_threshold=1000000
 
@@ -1773,7 +1774,7 @@ data_region_ratis_periodic_snapshot_interval=86400
 ### Fast IoTConsensus Configuration
 ####################
 # Default event buffer size for connector and receiver in pipe consensus
-# effectiveMode: restart
+# effectiveMode: hot_reload
 # DataType: int
 fast_iot_consensus_pipeline_size=5
 
@@ -1801,32 +1802,32 @@ procedure_completed_evict_ttl=800
 ####################
 
 # whether to enable the mqtt service.
-# effectiveMode: hot_reload
+# effectiveMode: restart
 # Datatype: boolean
 enable_mqtt_service=false
 
 # the mqtt service binding host.
-# effectiveMode: hot_reload
+# effectiveMode: restart
 # Datatype: String
 mqtt_host=127.0.0.1
 
 # the mqtt service binding port.
-# effectiveMode: hot_reload
+# effectiveMode: restart
 # Datatype: int
 mqtt_port=1883
 
 # the handler pool size for handing the mqtt messages.
-# effectiveMode: hot_reload
+# effectiveMode: restart
 # Datatype: int
 mqtt_handler_pool_size=1
 
 # the mqtt message payload formatter.
-# effectiveMode: hot_reload
+# effectiveMode: restart
 # Datatype: String
 mqtt_payload_formatter=json
 
 # max length of mqtt message in byte
-# effectiveMode: hot_reload
+# effectiveMode: restart
 # Datatype: int
 mqtt_max_message_size=1048576
 
diff --git 
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/CommonDescriptor.java
 
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/CommonDescriptor.java
index 135cef409b0..eb949bae87f 100644
--- 
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/CommonDescriptor.java
+++ 
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/CommonDescriptor.java
@@ -25,6 +25,7 @@ import org.apache.iotdb.commons.utils.CommonDateTimeUtils;
 import org.apache.iotdb.confignode.rpc.thrift.TGlobalConfig;
 
 import java.io.File;
+import java.io.IOException;
 import java.util.Optional;
 import java.util.Properties;
 
@@ -70,7 +71,7 @@ public class CommonDescriptor {
     config.setProcedureWalFolder(systemDir + File.separator + "procedure");
   }
 
-  public void loadCommonProps(Properties properties) {
+  public void loadCommonProps(Properties properties) throws IOException {
     config.setAuthorizerProvider(
         properties.getProperty("authorizer_provider_class", 
config.getAuthorizerProvider()).trim());
     // if using org.apache.iotdb.db.auth.authorizer.OpenIdAuthorizer, 
openID_url is needed.
@@ -633,18 +634,20 @@ public class CommonDescriptor {
                 String.valueOf(config.getSubscriptionReadFileBufferSize()))));
   }
 
-  public void loadRetryProperties(Properties properties) {
+  public void loadRetryProperties(Properties properties) throws IOException {
     config.setRemoteWriteMaxRetryDurationInMs(
         Long.parseLong(
             properties.getProperty(
                 "write_request_remote_dispatch_max_retry_duration_in_ms",
-                String.valueOf(config.getRemoteWriteMaxRetryDurationInMs()))));
+                ConfigurationFileUtils.getConfigurationDefaultValue(
+                    
"write_request_remote_dispatch_max_retry_duration_in_ms"))));
 
     config.setRetryForUnknownErrors(
         Boolean.parseBoolean(
             properties.getProperty(
                 "enable_retry_for_unknown_error",
-                String.valueOf(config.isRetryForUnknownErrors()))));
+                ConfigurationFileUtils.getConfigurationDefaultValue(
+                    "enable_retry_for_unknown_error"))));
   }
 
   public void loadGlobalConfig(TGlobalConfig globalConfig) {
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 a57d5a1d89a..cd337686a2f 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
@@ -37,6 +37,7 @@ import java.nio.file.StandardCopyOption;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -44,6 +45,8 @@ import java.util.Properties;
 import java.util.Set;
 import java.util.StringJoiner;
 import java.util.concurrent.TimeUnit;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 public class ConfigurationFileUtils {
 
@@ -71,7 +74,7 @@ public class ConfigurationFileUtils {
           .add("# specific language governing permissions and limitations")
           .add("# under the License.")
           .toString();
-  ;
+  private static Map<String, String> configuration2DefaultValue;
 
   // This is a temporary implementations
   private static final Set<String> ignoreConfigKeys =
@@ -155,6 +158,54 @@ public class ConfigurationFileUtils {
     return readConfigLines(f);
   }
 
+  public static void getConfigurationDefaultValue() throws IOException {
+    if (configuration2DefaultValue != null) {
+      return;
+    }
+    configuration2DefaultValue = new HashMap<>();
+    try (InputStream inputStream =
+            ConfigurationFileUtils.class
+                .getClassLoader()
+                .getResourceAsStream(CommonConfig.SYSTEM_CONFIG_TEMPLATE_NAME);
+        InputStreamReader isr = new InputStreamReader(inputStream);
+        BufferedReader reader = new BufferedReader(isr)) {
+      String line;
+      Pattern pattern = Pattern.compile("^[^#].*?=.*$");
+      while ((line = reader.readLine()) != null) {
+        Matcher matcher = pattern.matcher(line);
+        if (matcher.find()) {
+          String[] parts = line.split("=");
+          if (parts.length == 2) {
+            configuration2DefaultValue.put(parts[0].trim(), parts[1].trim());
+          } else if (parts.length == 1) {
+            configuration2DefaultValue.put(parts[0].trim(), null);
+          } else {
+            logger.error("Failed to parse configuration template: {}", line);
+          }
+        }
+      }
+    } catch (IOException e) {
+      logger.warn("Failed to read configuration template", e);
+      throw e;
+    }
+  }
+
+  // This function is used to get the default value for the configuration that 
enables hot
+  // modification.
+  public static String getConfigurationDefaultValue(String parameterName) 
throws IOException {
+    parameterName = parameterName.trim();
+    if (configuration2DefaultValue != null) {
+      return configuration2DefaultValue.get(parameterName);
+    } else {
+      getConfigurationDefaultValue();
+      return configuration2DefaultValue.getOrDefault(parameterName, null);
+    }
+  }
+
+  public static void releaseDefault() {
+    configuration2DefaultValue = null;
+  }
+
   public static String readConfigurationTemplateFile() throws IOException {
     StringBuilder content = new StringBuilder();
     try (InputStream inputStream =


Reply via email to