zhangyue19921010 commented on a change in pull request #4078:
URL: https://github.com/apache/hudi/pull/4078#discussion_r770425205
##########
File path:
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/HoodieTimelineArchiveLog.java
##########
@@ -140,6 +146,48 @@ public boolean archiveIfRequired(HoodieEngineContext
context) throws IOException
}
}
+ private void trimArchiveFilesIfNecessary(HoodieEngineContext context) throws
IOException {
+ Stream<HoodieLogFile> allLogFiles =
FSUtils.getAllLogFiles(metaClient.getFs(),
+ archiveFilePath.getParent(),
+ archiveFilePath.getName(),
+ HoodieArchivedLogFile.ARCHIVE_EXTENSION,
+ "");
+ List<HoodieLogFile> sortedLogFilesList =
allLogFiles.sorted(HoodieLogFile.getReverseLogFileComparator()).collect(Collectors.toList());
+ if (!sortedLogFilesList.isEmpty()) {
+ List<String> skipped =
sortedLogFilesList.stream().skip(maxArchiveFilesToKeep).map(HoodieLogFile::getPath).map(Path::toString).collect(Collectors.toList());
+ if (!skipped.isEmpty()) {
+ LOG.info("Deleting archive files : " + skipped);
+ context.setJobStatus(this.getClass().getSimpleName(), "Delete archive
files");
+ Map<String, Boolean> result = deleteFilesParallelize(metaClient,
skipped, context, true);
Review comment:
Changed.
##########
File path:
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/HoodieTimelineArchiveLog.java
##########
@@ -140,6 +146,48 @@ public boolean archiveIfRequired(HoodieEngineContext
context) throws IOException
}
}
+ private void trimArchiveFilesIfNecessary(HoodieEngineContext context) throws
IOException {
+ Stream<HoodieLogFile> allLogFiles =
FSUtils.getAllLogFiles(metaClient.getFs(),
+ archiveFilePath.getParent(),
+ archiveFilePath.getName(),
+ HoodieArchivedLogFile.ARCHIVE_EXTENSION,
+ "");
+ List<HoodieLogFile> sortedLogFilesList =
allLogFiles.sorted(HoodieLogFile.getReverseLogFileComparator()).collect(Collectors.toList());
+ if (!sortedLogFilesList.isEmpty()) {
+ List<String> skipped =
sortedLogFilesList.stream().skip(maxArchiveFilesToKeep).map(HoodieLogFile::getPath).map(Path::toString).collect(Collectors.toList());
Review comment:
Changed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]