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 64cdbe20e76a..a91a8d7f7fc0 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 @@ -216,8 +216,6 @@ public void checkSystemConfig() throws ConfigurationException, IOException { properties = systemPropertiesHandler.read(); if (systemPropertiesHandler.isFirstStart()) { - // overwrite system.properties when first start - generateOrOverwriteSystemPropertiesFile(); if (config.getDataRegionConsensusProtocolClass().equals(ConsensusFactory.IOT_CONSENSUS) && config.getWalMode().equals(WALMode.DISABLE)) { throw new ConfigurationException( 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 c057c3392e57..f6fef6846c0b 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 @@ -194,9 +194,11 @@ protected void doAddNode() { isFirstStart = prepareDataNode(); if (isFirstStart) { + logger.info("DataNode is starting for the first time..."); ConfigNodeInfo.getInstance() .updateConfigNodeList(Collections.singletonList(config.getSeedConfigNode())); } else { + logger.info("DataNode is restarting..."); // Load registered ConfigNodes from system.properties ConfigNodeInfo.getInstance().loadConfigNodeList(); } 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 61bcbb49b0cb..552d408f9fc1 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 @@ -20,6 +20,7 @@ package org.apache.iotdb.commons.file; import org.apache.ratis.util.AutoCloseableLock; +import org.apache.ratis.util.FileUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -158,12 +159,14 @@ private void replaceFormalFile() throws IOException { "Delete formal system properties file fail: %s", formalFile.getAbsoluteFile()); throw new IOException(msg); } - if (!tmpFile.renameTo(formalFile)) { + try { + FileUtils.move(tmpFile.toPath(), formalFile.toPath()); + } catch (IOException e) { String msg = String.format( "Failed to replace formal system properties file, you may manually rename it: %s -> %s", tmpFile.getAbsolutePath(), formalFile.getAbsolutePath()); - throw new IOException(msg); + throw new IOException(msg, e); } }