This is an automated email from the ASF dual-hosted git repository. chaow pushed a commit to branch fix_fileNotFound in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 0f9122831289888d8152e5a0c0aff688a12d401d Author: chaow <[email protected]> AuthorDate: Wed Dec 16 10:42:13 2020 +0800 fix file not found when restart --- .../main/java/org/apache/iotdb/db/metadata/logfile/MLogWriter.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/src/main/java/org/apache/iotdb/db/metadata/logfile/MLogWriter.java b/server/src/main/java/org/apache/iotdb/db/metadata/logfile/MLogWriter.java index 9fea132..79525ca 100644 --- a/server/src/main/java/org/apache/iotdb/db/metadata/logfile/MLogWriter.java +++ b/server/src/main/java/org/apache/iotdb/db/metadata/logfile/MLogWriter.java @@ -252,6 +252,9 @@ public class MLogWriter implements AutoCloseable { logger.error("failed to upgrade cmd {}.", cmd, e); } } + + // rename .bin.tmp to .bin + FSFactoryProducer.getFSFactory().moveFile(tmpLogFile, logFile); } } else if (!logFile.exists() && !tmpLogFile.exists()) { // if both .bin and .bin.tmp do not exist, nothing to do @@ -284,9 +287,6 @@ public class MLogWriter implements AutoCloseable { throw new IOException(String.format(DELETE_FAILED_FORMAT, tmpOldLogFile, e.getMessage())); } } - - // rename .bin.tmp to .bin - FSFactoryProducer.getFSFactory().moveFile(tmpLogFile, logFile); } public static void upgradeMLog() throws IOException {
