This is an automated email from the ASF dual-hosted git repository. yongzao pushed a commit to branch config-file in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 268df99e78773593ce76e8bc5fe8ca662ed2542c Author: YongzaoDan <[email protected]> AuthorDate: Tue Oct 17 13:36:35 2023 +0800 Finish --- .../confignode/conf/ConfigNodeDescriptor.java | 15 ++++++----- .../confignode/conf/SystemPropertiesUtils.java | 12 +++++++++ .../org/apache/iotdb/db/conf/IoTDBDescriptor.java | 30 ++++++++++++++++------ .../iotdb/commons/conf/CommonDescriptor.java | 11 +++----- 4 files changed, 46 insertions(+), 22 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 c3cde6d07b2..3fc8a75da34 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 @@ -106,11 +106,14 @@ public class ConfigNodeDescriptor { commonProperties.load(inputStream); } catch (FileNotFoundException e) { - LOGGER.warn("Fail to find config file {}", url, e); + LOGGER.error("Fail to find config file {}, reject ConfigNode startup.", url, e); + System.exit(-1); } catch (IOException e) { - LOGGER.warn("Cannot load config file, use default configuration", e); + LOGGER.error("Cannot load config file, reject ConfigNode startup.", e); + System.exit(-1); } catch (Exception e) { - LOGGER.warn("Incorrect format in config file, use default configuration", e); + LOGGER.error("Incorrect format in config file, reject ConfigNode startup.", e); + System.exit(-1); } } else { LOGGER.warn( @@ -127,7 +130,8 @@ public class ConfigNodeDescriptor { commonProperties.putAll(properties); loadProperties(commonProperties); } catch (IOException | BadNodeUrlException e) { - LOGGER.warn("Couldn't load ConfigNode conf file, use default config", e); + LOGGER.error("Couldn't load ConfigNode conf file, reject ConfigNode startup.", e); + System.exit(-1); } finally { conf.updatePath(); commonDescriptor @@ -268,8 +272,7 @@ public class ConfigNodeDescriptor { "region_group_allocate_policy", conf.getRegionGroupAllocatePolicy().name()) .trim())); } catch (IllegalArgumentException e) { - LOGGER.warn( - "The configured region allocate strategy does not exist, use the default: GREEDY!"); + throw new IOException(e); } conf.setCnRpcAdvancedCompressionEnable( 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 0f7b9e4f85f..7e0f9de1f88 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 @@ -57,6 +57,7 @@ public class SystemPropertiesUtils { private static final String CN_INTERNAL_ADDRESS = "cn_internal_address"; private static final String CN_INTERNAL_PORT = "cn_internal_port"; private static final String CN_CONSENSUS_PORT = "cn_consensus_port"; + private static final String TIMESTAMP_PRECISION = "timestamp_precision"; private static final String CN_CONSENSUS_PROTOCOL = "config_node_consensus_protocol_class"; private static final String DATA_CONSENSUS_PROTOCOL = "data_region_consensus_protocol_class"; private static final String SCHEMA_CONSENSUS_PROTOCOL = "schema_region_consensus_protocol_class"; @@ -127,6 +128,17 @@ public class SystemPropertiesUtils { } } + if (systemProperties.getProperty(TIMESTAMP_PRECISION, null) == null) { + needReWrite = true; + } else { + String timestampPrecision = systemProperties.getProperty(TIMESTAMP_PRECISION); + if (!timestampPrecision.equals(COMMON_CONFIG.getTimestampPrecision())) { + LOGGER.warn( + format, TIMESTAMP_PRECISION, COMMON_CONFIG.getTimestampPrecision(), timestampPrecision); + COMMON_CONFIG.setTimestampPrecision(timestampPrecision); + } + } + // Consensus protocol configuration String configNodeConsensusProtocolClass = systemProperties.getProperty(CN_CONSENSUS_PROTOCOL, null); 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 7850bf6b103..2d8c0256e78 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 @@ -90,7 +90,15 @@ public class IoTDBDescriptor { for (IPropertiesLoader loader : propertiesLoaderServiceLoader) { logger.info("Will reload properties from {} ", loader.getClass().getName()); Properties properties = loader.loadProperties(); - loadProperties(properties); + try { + loadProperties(properties); + } catch (Exception e) { + logger.error( + "Failed to reload properties from {}, reject DataNode startup.", + loader.getClass().getName(), + e); + System.exit(-1); + } conf.setCustomizedProperties(loader.getCustomizedProperties()); TSFileDescriptor.getInstance().overwriteConfigByCustomSettings(properties); TSFileDescriptor.getInstance() @@ -163,11 +171,14 @@ public class IoTDBDescriptor { logger.info("Start to read config file {}", url); commonProperties.load(inputStream); } catch (FileNotFoundException e) { - logger.warn("Fail to find config file {}", url, e); + logger.error("Fail to find config file {}, reject DataNode startup.", url, e); + System.exit(-1); } catch (IOException e) { - logger.warn("Cannot load config file, use default configuration", e); + logger.error("Cannot load config file, reject DataNode startup.", e); + System.exit(-1); } catch (Exception e) { - logger.warn("Incorrect format in config file, use default configuration", e); + logger.error("Incorrect format in config file, reject DataNode startup.", e); + System.exit(-1); } } else { logger.warn( @@ -183,11 +194,14 @@ public class IoTDBDescriptor { commonProperties.putAll(properties); loadProperties(commonProperties); } catch (FileNotFoundException e) { - logger.warn("Fail to find config file {}", url, e); + logger.error("Fail to find config file {}, reject DataNode startup.", url, e); + System.exit(-1); } catch (IOException e) { - logger.warn("Cannot load config file, use default configuration", e); + logger.error("Cannot load config file, reject DataNode startup.", e); + System.exit(-1); } catch (Exception e) { - logger.warn("Incorrect format in config file, use default configuration", e); + logger.error("Incorrect format in config file, reject DataNode startup.", e); + System.exit(-1); } finally { // update all data seriesPath conf.updatePath(); @@ -205,7 +219,7 @@ public class IoTDBDescriptor { } } - public void loadProperties(Properties properties) { + public void loadProperties(Properties properties) throws BadNodeUrlException { conf.setClusterSchemaLimitLevel( properties .getProperty("cluster_schema_limit_level", conf.getClusterSchemaLimitLevel()) 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 7ea9f561d0a..d18adf71027 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 @@ -62,7 +62,7 @@ public class CommonDescriptor { config.setProcedureWalFolder(systemDir + File.separator + "procedure"); } - public void loadCommonProps(Properties properties) { + public void loadCommonProps(Properties properties) throws BadNodeUrlException { config.setAuthorizerProvider( properties.getProperty("authorizer_provider_class", config.getAuthorizerProvider()).trim()); // if using org.apache.iotdb.db.auth.authorizer.OpenIdAuthorizer, openID_url is needed. @@ -216,13 +216,8 @@ public class CommonDescriptor { NodeUrlUtils.convertTEndPointUrl(config.getTargetMLNodeEndPoint())); loadPipeProps(properties); - try { - config.setTargetMLNodeEndPoint(NodeUrlUtils.parseTEndPointUrl(endPointUrl)); - } catch (BadNodeUrlException e) { - LOGGER.warn( - "Illegal target MLNode endpoint url format in config file: {}, use default configuration.", - endPointUrl); - } + + config.setTargetMLNodeEndPoint(NodeUrlUtils.parseTEndPointUrl(endPointUrl)); config.setSchemaEngineMode( properties.getProperty("schema_engine_mode", String.valueOf(config.getSchemaEngineMode())));
