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/23 01:21:28 UTC
[incubator-iotdb] branch rel/0.10 updated: fix updating mlog many
times
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 b156b7d fix updating mlog many times
b156b7d is described below
commit b156b7db9a9b557579ce24cc59f0a723ece9ddef
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);
}
-
+
}