Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,14 @@ private void upgradePropertiesFile() throws IOException {
System.exit(-1);
}

// virtual storage group num can only set to 1 when upgrading from old version
if (!virtualStorageGroupNum.equals("1")) {
logger.error(
"virtual storage group num cannot set to {} when upgrading from old version, "
+ "please set to 1 and restart",
virtualStorageGroupNum);
System.exit(-1);
}
try (FileOutputStream tmpFOS = new FileOutputStream(tmpPropertiesFile.toString())) {
properties.setProperty(PARTITION_INTERVAL_STRING, String.valueOf(partitionInterval));
properties.setProperty(TSFILE_FILE_SYSTEM_STRING, tsfileFileSystem);
Expand Down Expand Up @@ -428,6 +436,16 @@ private void moveFileToUpgradeFolder(List<String> folders) {
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;
Expand All @@ -446,7 +464,8 @@ private void moveFileToUpgradeFolder(List<String> folders) {
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()) {
Expand All @@ -471,6 +490,13 @@ private void moveFileToUpgradeFolder(List<String> folders) {
}
}
}
if (partitionDir.listFiles().length == 0) {
try {
Files.delete(partitionDir.toPath());
} catch (IOException e) {
logger.error("Delete {} failed", partitionDir);
}
}
}
}
}
Expand Down