Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate compaction target file with tier level #12597

Merged
Changes from 1 commit
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 @@ -75,6 +75,7 @@ public static String generateNewTsFilePathWithMkdir(
version,
innerSpaceCompactionCount,
crossSpaceCompactionCount,
0,
TsFileConstant.TSFILE_SUFFIX);
}

Expand All @@ -87,10 +88,12 @@ public static String generateNewTsFilePathWithMkdir(
long version,
int innerSpaceCompactionCount,
int crossSpaceCompactionCount,
int tierLevel,
String customSuffix)
throws DiskSpaceInsufficientException {
String tsFileDir =
generateTsFileDir(sequence, logicalStorageGroup, virtualStorageGroup, timePartitionId);
generateTsFileDir(
sequence, logicalStorageGroup, virtualStorageGroup, timePartitionId, tierLevel);
fsFactory.getFile(tsFileDir).mkdirs();
return tsFileDir
+ File.separator
Expand All @@ -102,10 +105,11 @@ public static String generateTsFileDir(
boolean sequence,
String logicalStorageGroup,
String virtualStorageGroup,
long timePartitionId)
long timePartitionId,
int tierLevel)
throws DiskSpaceInsufficientException {
TierManager tierManager = TierManager.getInstance();
String baseDir = tierManager.getNextFolderForTsFile(0, sequence);
String baseDir = tierManager.getNextFolderForTsFile(tierLevel, sequence);
return baseDir
+ File.separator
+ logicalStorageGroup
Expand Down Expand Up @@ -241,6 +245,7 @@ public static List<TsFileResource> getCrossCompactionTargetFileResources(
tsFileName.version,
tsFileName.innerCompactionCnt,
tsFileName.crossCompactionCnt,
resource.getTierLevel(),
IoTDBConstant.CROSS_COMPACTION_TMP_FILE_SUFFIX)),
TsFileResourceStatus.COMPACTING));
}
Expand All @@ -265,6 +270,7 @@ public static TsFileResource getInnerCompactionTargetFileResource(
long maxVersion = Long.MIN_VALUE;
long maxInnerMergeCount = Long.MIN_VALUE;
long maxCrossMergeCount = Long.MIN_VALUE;
int maxTierLevel = Integer.MIN_VALUE;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use 0 is better.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

for (TsFileResource resource : tsFileResources) {
TsFileName tsFileName = getTsFileName(resource.getTsFile().getName());
minTime = Math.min(tsFileName.time, minTime);
Expand All @@ -273,6 +279,7 @@ public static TsFileResource getInnerCompactionTargetFileResource(
maxVersion = Math.max(tsFileName.version, maxVersion);
maxInnerMergeCount = Math.max(tsFileName.innerCompactionCnt, maxInnerMergeCount);
maxCrossMergeCount = Math.max(tsFileName.crossCompactionCnt, maxCrossMergeCount);
maxTierLevel = Math.max(resource.getTierLevel(), maxTierLevel);
}
// set target resource to COMPACTING until the end of this task
TsFileResource resource =
Expand All @@ -288,6 +295,7 @@ public static TsFileResource getInnerCompactionTargetFileResource(
minVersion,
(int) maxInnerMergeCount + 1,
(int) maxCrossMergeCount,
maxTierLevel,
IoTDBConstant.INNER_COMPACTION_TMP_FILE_SUFFIX)),
TsFileResourceStatus.COMPACTING)
: new TsFileResource(
Expand All @@ -301,6 +309,7 @@ public static TsFileResource getInnerCompactionTargetFileResource(
maxVersion,
(int) maxInnerMergeCount + 1,
(int) maxCrossMergeCount,
maxTierLevel,
IoTDBConstant.INNER_COMPACTION_TMP_FILE_SUFFIX)),
TsFileResourceStatus.COMPACTING);
resource.setSeq(sequence);
Expand Down
Loading