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 2022/02/17 07:08:19 UTC

[iotdb] branch master updated: [IOTDB-2522] Check WAL files before upgrading 0.12 to 0.13 (#5066)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new f4ecf3a  [IOTDB-2522] Check WAL files before upgrading 0.12 to 0.13 (#5066)
f4ecf3a is described below

commit f4ecf3a5b711a9985076946f3e10202404546c5a
Author: Alan Choo <43...@users.noreply.github.com>
AuthorDate: Thu Feb 17 15:07:38 2022 +0800

    [IOTDB-2522] Check WAL files before upgrading 0.12 to 0.13 (#5066)
---
 .../java/org/apache/iotdb/db/conf/IoTDBConfigCheck.java | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 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 787209a..6c88952 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
@@ -220,9 +220,11 @@ public class IoTDBConfigCheck {
               + " Please upgrade to v0.10 first");
       System.exit(-1);
     }
-    // check whether upgrading from v0.10 or v0.11 to v0.12
+    // check whether upgrading from old versions
     String versionString = properties.getProperty(IOTDB_VERSION_STRING);
-    if (versionString.startsWith("0.10") || versionString.startsWith("0.11")) {
+    if (versionString.startsWith("0.12")) {
+      checkWALNotExists();
+    } else if (versionString.startsWith("0.10") || versionString.startsWith("0.11")) {
       logger.info(
           "Upgrading IoTDB from {} to {}, checking files...", versionString, IoTDBConstant.VERSION);
       checkUnClosedTsFileV2();
@@ -355,17 +357,20 @@ public class IoTDBConfigCheck {
 
   /** ensure all TsFiles are closed when starting 0.12 */
   private void checkUnClosedTsFileV2() {
+    checkWALNotExists();
+    checkUnClosedTsFileV2InFolders(DirectoryManager.getInstance().getAllSequenceFileFolders());
+    checkUnClosedTsFileV2InFolders(DirectoryManager.getInstance().getAllUnSequenceFileFolders());
+  }
+
+  private void checkWALNotExists() {
     if (SystemFileFactory.INSTANCE.getFile(WAL_DIR).isDirectory()
         && SystemFileFactory.INSTANCE.getFile(WAL_DIR).list().length != 0) {
       logger.error(
-          "WAL detected, please stop insertion, then run 'flush' "
-              + "on IoTDB {} before upgrading to {}",
+          "WAL detected, please stop insertion and run 'SET SYSTEM TO READONLY', then run 'flush' on IoTDB {} before upgrading to {}.",
           properties.getProperty(IOTDB_VERSION_STRING),
           IoTDBConstant.VERSION);
       System.exit(-1);
     }
-    checkUnClosedTsFileV2InFolders(DirectoryManager.getInstance().getAllSequenceFileFolders());
-    checkUnClosedTsFileV2InFolders(DirectoryManager.getInstance().getAllUnSequenceFileFolders());
   }
 
   private void checkUnClosedTsFileV2InFolders(List<String> folders) {