This is an automated email from the ASF dual-hosted git repository.
jiangtian 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 466c0d91326 fix trim (#14130)
466c0d91326 is described below
commit 466c0d91326694d42bfb2c21a000fc6fede53fda
Author: Yukim1 <[email protected]>
AuthorDate: Wed Nov 20 09:06:03 2024 +0800
fix trim (#14130)
* fix trim
* fix some problem
---
.../org/apache/iotdb/db/conf/IoTDBDescriptor.java | 62 ++++++++++-----
.../db/conf/rest/IoTDBRestServiceDescriptor.java | 88 +++++++++++++++++-----
2 files changed, 112 insertions(+), 38 deletions(-)
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 d38688b0979..5411556ca64 100755
---
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
@@ -586,16 +586,23 @@ public class IoTDBDescriptor {
int subtaskNum =
Integer.parseInt(
- properties.getProperty(
- "sub_compaction_thread_count",
Integer.toString(conf.getSubCompactionTaskNum())));
+ Optional.ofNullable(
+ properties.getProperty(
+ "sub_compaction_thread_count",
+ Integer.toString(conf.getSubCompactionTaskNum())))
+ .map(String::trim)
+ .orElse(Integer.toString(conf.getSubCompactionTaskNum())));
subtaskNum = subtaskNum <= 0 ? 1 : subtaskNum;
conf.setSubCompactionTaskNum(subtaskNum);
int compactionScheduleThreadNum =
Integer.parseInt(
- properties.getProperty(
- "compaction_schedule_thread_num",
- Integer.toString(conf.getCompactionScheduleThreadNum())));
+ Optional.ofNullable(
+ properties.getProperty(
+ "compaction_schedule_thread_num",
+
Integer.toString(conf.getCompactionScheduleThreadNum())))
+ .map(String::trim)
+
.orElse(Integer.toString(conf.getCompactionScheduleThreadNum())));
compactionScheduleThreadNum =
compactionScheduleThreadNum <= 0 ? 1 : compactionScheduleThreadNum;
conf.setCompactionScheduleThreadNum(compactionScheduleThreadNum);
@@ -1993,10 +2000,15 @@ public class IoTDBDescriptor {
int compactionMaxAlignedSeriesNumInOneBatch =
conf.getCompactionMaxAlignedSeriesNumInOneBatch();
int newCompactionMaxAlignedSeriesNumInOneBatch =
Integer.parseInt(
- properties.getProperty(
- "compaction_max_aligned_series_num_in_one_batch",
- ConfigurationFileUtils.getConfigurationDefaultValue(
- "compaction_max_aligned_series_num_in_one_batch")));
+ Optional.ofNullable(
+ properties.getProperty(
+ "compaction_max_aligned_series_num_in_one_batch",
+ ConfigurationFileUtils.getConfigurationDefaultValue(
+ "compaction_max_aligned_series_num_in_one_batch")))
+ .map(String::trim)
+ .orElse(
+ ConfigurationFileUtils.getConfigurationDefaultValue(
+ "compaction_max_aligned_series_num_in_one_batch")));
conf.setCompactionMaxAlignedSeriesNumInOneBatch(
newCompactionMaxAlignedSeriesNumInOneBatch > 0
? newCompactionMaxAlignedSeriesNumInOneBatch
@@ -2011,9 +2023,15 @@ public class IoTDBDescriptor {
throws IOException {
int newConfigCompactionThreadCount =
Integer.parseInt(
- properties.getProperty(
- "compaction_thread_count",
-
ConfigurationFileUtils.getConfigurationDefaultValue("compaction_thread_count")));
+ Optional.ofNullable(
+ properties.getProperty(
+ "compaction_thread_count",
+ ConfigurationFileUtils.getConfigurationDefaultValue(
+ "compaction_thread_count")))
+ .map(String::trim)
+ .orElse(
+ ConfigurationFileUtils.getConfigurationDefaultValue(
+ "compaction_thread_count")));
if (newConfigCompactionThreadCount <= 0) {
LOGGER.error("compaction_thread_count must greater than 0");
return false;
@@ -2039,10 +2057,15 @@ public class IoTDBDescriptor {
throws IOException {
int newConfigSubtaskNum =
Integer.parseInt(
- properties.getProperty(
- "sub_compaction_thread_count",
- ConfigurationFileUtils.getConfigurationDefaultValue(
- "sub_compaction_thread_count")));
+ Optional.ofNullable(
+ properties.getProperty(
+ "sub_compaction_thread_count",
+ ConfigurationFileUtils.getConfigurationDefaultValue(
+ "sub_compaction_thread_count")))
+ .map(String::trim)
+ .orElse(
+ ConfigurationFileUtils.getConfigurationDefaultValue(
+ "sub_compaction_thread_count")));
if (newConfigSubtaskNum <= 0) {
LOGGER.error("sub_compaction_thread_count must greater than 0");
return false;
@@ -3442,8 +3465,11 @@ public class IoTDBDescriptor {
.toArray(String[]::new));
conf.setIotConsensusV2DeletionFileDir(
- properties.getProperty(
- "iot_consensus_v2_deletion_file_dir",
conf.getIotConsensusV2DeletionFileDir()));
+ Optional.ofNullable(
+ properties.getProperty(
+ "iot_consensus_v2_deletion_file_dir",
conf.getIotConsensusV2DeletionFileDir()))
+ .map(String::trim)
+ .orElse(conf.getIotConsensusV2DeletionFileDir()));
}
private void loadCQProps(Properties properties) {
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/rest/IoTDBRestServiceDescriptor.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/rest/IoTDBRestServiceDescriptor.java
index 48725ef1839..6e5526769b5 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/rest/IoTDBRestServiceDescriptor.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/rest/IoTDBRestServiceDescriptor.java
@@ -33,6 +33,7 @@ import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
+import java.util.Optional;
import java.util.Properties;
public class IoTDBRestServiceDescriptor {
@@ -80,45 +81,92 @@ public class IoTDBRestServiceDescriptor {
private void loadProps(Properties properties) {
conf.setEnableRestService(
Boolean.parseBoolean(
- properties.getProperty(
- "enable_rest_service",
Boolean.toString(conf.isEnableRestService()))));
+ Optional.ofNullable(
+ properties.getProperty(
+ "enable_rest_service",
Boolean.toString(conf.isEnableRestService())))
+ .map(String::trim)
+ .orElse(Boolean.toString(conf.isEnableRestService()))));
conf.setRestServicePort(
Integer.parseInt(
- properties.getProperty(
- "rest_service_port",
Integer.toString(conf.getRestServicePort()))));
+ Optional.ofNullable(
+ properties.getProperty(
+ "rest_service_port",
Integer.toString(conf.getRestServicePort())))
+ .map(String::trim)
+ .orElse(Integer.toString(conf.getRestServicePort()))));
conf.setRestQueryDefaultRowSizeLimit(
Integer.parseInt(
- properties.getProperty(
- "rest_query_default_row_size_limit",
- Integer.toString(conf.getRestQueryDefaultRowSizeLimit()))));
+ Optional.ofNullable(
+ properties.getProperty(
+ "rest_query_default_row_size_limit",
+
Integer.toString(conf.getRestQueryDefaultRowSizeLimit())))
+ .map(String::trim)
+
.orElse(Integer.toString(conf.getRestQueryDefaultRowSizeLimit()))));
conf.setEnableSwagger(
Boolean.parseBoolean(
- properties.getProperty("enable_swagger",
Boolean.toString(conf.isEnableSwagger()))));
+ Optional.ofNullable(
+ properties.getProperty(
+ "enable_swagger",
Boolean.toString(conf.isEnableSwagger())))
+ .map(String::trim)
+ .orElse(Boolean.toString(conf.isEnableSwagger()))));
conf.setEnableHttps(
Boolean.parseBoolean(
- properties.getProperty("enable_https",
Boolean.toString(conf.isEnableHttps()))));
+ Optional.ofNullable(
+ properties.getProperty("enable_https",
Boolean.toString(conf.isEnableHttps())))
+ .map(String::trim)
+ .orElse(Boolean.toString(conf.isEnableHttps()))));
conf.setClientAuth(
Boolean.parseBoolean(
- properties.getProperty("client_auth",
Boolean.toString(conf.isClientAuth()))));
- conf.setKeyStorePath(properties.getProperty("key_store_path",
conf.getKeyStorePath()));
- conf.setKeyStorePwd(properties.getProperty("key_store_pwd",
conf.getKeyStorePwd()));
- conf.setTrustStorePath(properties.getProperty("trust_store_path",
conf.getTrustStorePath()));
- conf.setTrustStorePwd(properties.getProperty("trust_store_pwd",
conf.getTrustStorePwd()));
+ Optional.ofNullable(
+ properties.getProperty("client_auth",
Boolean.toString(conf.isClientAuth())))
+ .map(String::trim)
+ .orElse(Boolean.toString(conf.isClientAuth()))));
+ conf.setKeyStorePath(
+ Optional.ofNullable(properties.getProperty("key_store_path",
conf.getKeyStorePath()))
+ .map(String::trim)
+ .orElse(conf.getKeyStorePath()));
+ conf.setKeyStorePwd(
+ Optional.ofNullable(properties.getProperty("key_store_pwd",
conf.getKeyStorePwd()))
+ .map(String::trim)
+ .orElse(conf.getKeyStorePwd()));
+ conf.setTrustStorePath(
+ Optional.ofNullable(properties.getProperty("trust_store_path",
conf.getTrustStorePath()))
+ .map(String::trim)
+ .orElse(conf.getTrustStorePath()));
+ conf.setTrustStorePwd(
+ Optional.ofNullable(properties.getProperty("trust_store_pwd",
conf.getTrustStorePwd()))
+ .map(String::trim)
+ .orElse(conf.getTrustStorePwd()));
conf.setIdleTimeoutInSeconds(
Integer.parseInt(
- properties.getProperty(
- "idle_timeout_in_seconds",
Integer.toString(conf.getIdleTimeoutInSeconds()))));
+ Optional.ofNullable(
+ properties.getProperty(
+ "idle_timeout_in_seconds",
+ Integer.toString(conf.getIdleTimeoutInSeconds())))
+ .map(String::trim)
+ .orElse(Integer.toString(conf.getIdleTimeoutInSeconds()))));
conf.setCacheExpireInSeconds(
Integer.parseInt(
- properties.getProperty(
- "cache_expire_in_seconds",
Integer.toString(conf.getCacheExpireInSeconds()))));
+ Optional.ofNullable(
+ properties.getProperty(
+ "cache_expire_in_seconds",
+ Integer.toString(conf.getCacheExpireInSeconds())))
+ .map(String::trim)
+ .orElse(Integer.toString(conf.getCacheExpireInSeconds()))));
conf.setCacheInitNum(
Integer.parseInt(
- properties.getProperty("cache_init_num",
Integer.toString(conf.getCacheInitNum()))));
+ Optional.ofNullable(
+ properties.getProperty(
+ "cache_init_num",
Integer.toString(conf.getCacheInitNum())))
+ .map(String::trim)
+ .orElse(Integer.toString(conf.getCacheInitNum()))));
conf.setCacheMaxNum(
Integer.parseInt(
- properties.getProperty("cache_max_num",
Integer.toString(conf.getCacheMaxNum()))));
+ Optional.ofNullable(
+ properties.getProperty(
+ "cache_max_num",
Integer.toString(conf.getCacheMaxNum())))
+ .map(String::trim)
+ .orElse(Integer.toString(conf.getCacheMaxNum()))));
}
/**