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:19:47 UTC

[incubator-iotdb] branch fix_tmpProperties_0_10 created (now 25b6642)

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

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


      at 25b6642  fix tmpProperties

This branch includes the following new commits:

     new 25b6642  fix tmpProperties

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[incubator-iotdb] 01/01: fix tmpProperties

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 25b6642b0262e2a95d86cd58112ae4e3f0f49eee
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();
   }
 
   /**