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 e3d2a2ae613 [IOTDB-6151] Move datanode system.properties safer (#11415)
e3d2a2ae613 is described below

commit e3d2a2ae613684e9179a6cc7829e8203d1938d42
Author: Li Yu Heng <[email protected]>
AuthorDate: Mon Oct 30 18:36:12 2023 +0800

    [IOTDB-6151] Move datanode system.properties safer (#11415)
---
 .../src/main/java/org/apache/iotdb/db/conf/IoTDBStartCheck.java  | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

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 053bfe68c3b..287b966645e 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
@@ -234,11 +234,16 @@ public class IoTDBStartCheck {
    * During a restart, it is necessary to check if the file exists in the old 
location. If it does,
    * move the file to the new location.
    *
-   * @throws IOException
+   * @throws IOException If copy fail or delete fail
    */
   public void checkOldSystemConfig() throws IOException {
     if (oldPropertiesFile.exists()) {
-      FileUtils.moveFile(oldPropertiesFile, propertiesFile);
+      FileUtils.copyFile(oldPropertiesFile, propertiesFile);
+      FileUtils.delete(oldPropertiesFile);
+      logger.info(
+          "system.properties file has been moved successfully: {} -> {}",
+          oldPropertiesFile.getAbsolutePath(),
+          propertiesFile.getAbsolutePath());
     }
   }
 

Reply via email to