You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2020/07/13 09:53:55 UTC

[incubator-iotdb] branch rel/0.10 updated: fix tmpProperties

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

qiaojialin pushed a commit to branch rel/0.10
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git


The following commit(s) were added to refs/heads/rel/0.10 by this push:
     new 53dacaf  fix tmpProperties
53dacaf is described below

commit 53dacaf2b7bb01de0f65bdfddf687e12402ded35
Author: HTHou <hh...@outlook.com>
AuthorDate: Mon Jul 13 16:18:05 2020 +0800

    fix tmpProperties
---
 .../org/apache/iotdb/db/conf/IoTDBConfigCheck.java    | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfigCheck.java b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfigCheck.java
index 807c5e2..c40fb43 100644
--- a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfigCheck.java
+++ b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfigCheck.java
@@ -144,7 +144,8 @@ public class IoTDBConfigCheck {
   public void checkConfig() throws IOException {
     propertiesFile = SystemFileFactory.INSTANCE
             .getFile(IoTDBConfigCheck.SCHEMA_DIR + File.separator + PROPERTIES_FILE_NAME);
-    tmpPropertiesFile = new File(propertiesFile.getAbsoluteFile() + ".tmp");
+    tmpPropertiesFile = SystemFileFactory.INSTANCE
+        .getFile(IoTDBConfigCheck.SCHEMA_DIR + File.separator + PROPERTIES_FILE_NAME + ".tmp");
 
     // system init first time, no need to check, write system.properties and return
     if (!propertiesFile.exists() && !tmpPropertiesFile.exists()) {
@@ -171,21 +172,21 @@ public class IoTDBConfigCheck {
       return;
     } else if (propertiesFile.exists() && tmpPropertiesFile.exists()) {
       // both files exist, remove tmp file
-      FileUtils.forceDeleteOnExit(tmpPropertiesFile);
+      FileUtils.forceDelete(tmpPropertiesFile);
       logger.info("remove {}", tmpPropertiesFile);
     }
 
     // no tmp file, read properties from system.properties
     try (FileInputStream inputStream = new FileInputStream(propertiesFile)) {
       properties.load(new InputStreamReader(inputStream, TSFileConfig.STRING_CHARSET));
-      // need to upgrade from 0.9 to 0.10
-      if (!properties.containsKey(IOTDB_VERSION_STRING)) {
-        checkUnClosedTsFileV1();
-        MLogWriter.upgradeMLog(SCHEMA_DIR, MetadataConstant.METADATA_LOG);
-        upgradePropertiesFile();
-      }
-      checkProperties();
     }
+    // need to upgrade from 0.9 to 0.10
+    if (!properties.containsKey(IOTDB_VERSION_STRING)) {
+      checkUnClosedTsFileV1();
+      MLogWriter.upgradeMLog(SCHEMA_DIR, MetadataConstant.METADATA_LOG);
+      upgradePropertiesFile();
+    }
+    checkProperties();
   }
 
   /**