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

[incubator-iotdb] branch fix_tmpProperties updated: fix tmpProperties

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

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


The following commit(s) were added to refs/heads/fix_tmpProperties by this push:
     new 838b458  fix tmpProperties
838b458 is described below

commit 838b45820866883f7798c9f829d7b268414d038a
Author: HTHou <hh...@outlook.com>
AuthorDate: Mon Jul 13 16:13:28 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 d116e71..2f7e2c8 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
@@ -148,7 +148,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()) {
@@ -175,21 +176,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();
   }
 
   /**