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/22 13:45:23 UTC

[incubator-iotdb] branch fix_upgrade_0.10 created (now 6a31c43)

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

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


      at 6a31c43  fix updating mlog many times

This branch includes the following new commits:

     new 6a31c43  fix updating mlog many times

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 updating mlog many times

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

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

commit 6a31c43050a4901adc62c53ab208715094395e64
Author: HTHou <hh...@outlook.com>
AuthorDate: Wed Jul 22 21:44:43 2020 +0800

    fix updating mlog many times
---
 .../main/java/org/apache/iotdb/db/conf/IoTDBConfigCheck.java  | 11 +++++++++++
 .../main/java/org/apache/iotdb/db/metadata/MLogWriter.java    | 10 +---------
 2 files changed, 12 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 d7c3a63..1c8b49c 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
@@ -187,6 +187,17 @@ public class IoTDBConfigCheck {
       checkUnClosedTsFileV1();
       MLogWriter.upgradeMLog(SCHEMA_DIR, MetadataConstant.METADATA_LOG);
       upgradePropertiesFile();
+      // upgrade mlog finished, delete old mlog file
+      File mlogFile = SystemFileFactory.INSTANCE.getFile(SCHEMA_DIR + File.separator
+          + MetadataConstant.METADATA_LOG);
+      File tmpMLogFile = SystemFileFactory.INSTANCE.getFile(mlogFile.getAbsolutePath()
+          + ".tmp");
+      
+      if (!mlogFile.delete()) {
+        throw new IOException("Deleting " + mlogFile + "failed.");
+      }
+      // rename tmpLogFile to mlog
+      FSFactoryProducer.getFSFactory().moveFile(tmpMLogFile, mlogFile);
     }
     checkProperties();
   }
diff --git a/server/src/main/java/org/apache/iotdb/db/metadata/MLogWriter.java b/server/src/main/java/org/apache/iotdb/db/metadata/MLogWriter.java
index 72ee54b..63948f3 100644
--- a/server/src/main/java/org/apache/iotdb/db/metadata/MLogWriter.java
+++ b/server/src/main/java/org/apache/iotdb/db/metadata/MLogWriter.java
@@ -161,14 +161,6 @@ public class MLogWriter {
         
       }
     }
-
-    // upgrade finished, delete old mlog file
-    if (!logFile.delete()) {
-      throw new IOException("Deleting " + logFile + "failed.");
-    }
-    
-    // rename tmpLogFile to mlog
-    FSFactoryProducer.getFSFactory().moveFile(tmpLogFile, logFile);
   }
-  
+
 }