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 2021/05/10 14:37:52 UTC
[iotdb] 01/01: Fix upgrade tool cannot load old tsfile if time
partition enabled in 0.11
This is an automated email from the ASF dual-hosted git repository.
haonan pushed a commit to branch partition_upgrade_bug
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 741284de7027c95c5fe55b25b526faeb4880d1ba
Author: HTHou <hh...@outlook.com>
AuthorDate: Mon May 10 22:37:05 2021 +0800
Fix upgrade tool cannot load old tsfile if time partition enabled in 0.11
---
.../org/apache/iotdb/db/conf/IoTDBConfigCheck.java | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
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 d7ce4e5..f505ba6 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
@@ -428,6 +428,16 @@ public class IoTDBConfigCheck {
if (!storageGroup.isDirectory()) {
continue;
}
+ // create virtual storage group folder 0
+ File virtualStorageGroupDir = fsFactory.getFile(storageGroup, "0");
+ if (virtualStorageGroupDir.mkdirs()) {
+ logger.info(
+ "virtual storage directory {} doesn't exist, create it",
+ virtualStorageGroupDir.getPath());
+ } else if (!virtualStorageGroupDir.exists()) {
+ logger.error(
+ "Create virtual storage directory {} failed", virtualStorageGroupDir.getPath());
+ }
for (File partitionDir : storageGroup.listFiles()) {
if (!partitionDir.isDirectory()) {
continue;
@@ -446,7 +456,8 @@ public class IoTDBConfigCheck {
if (oldTsfileArray.length + oldResourceFileArray.length + oldModificationFileArray.length
!= 0) {
// create upgrade directory if not exist
- File upgradeFolder = fsFactory.getFile(partitionDir, IoTDBConstant.UPGRADE_FOLDER_NAME);
+ File upgradeFolder =
+ fsFactory.getFile(virtualStorageGroupDir, IoTDBConstant.UPGRADE_FOLDER_NAME);
if (upgradeFolder.mkdirs()) {
logger.info("Upgrade Directory {} doesn't exist, create it", upgradeFolder.getPath());
} else if (!upgradeFolder.exists()) {
@@ -471,6 +482,13 @@ public class IoTDBConfigCheck {
}
}
}
+ if (partitionDir.listFiles().length == 0) {
+ try {
+ Files.delete(partitionDir.toPath());
+ } catch (IOException e) {
+ logger.error("Delete {} failed", partitionDir);
+ }
+ }
}
}
}