YannByron commented on code in PR #7196:
URL: https://github.com/apache/hudi/pull/7196#discussion_r1032440004
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/HoodieTimelineArchiver.java:
##########
@@ -570,12 +570,24 @@ private boolean
deleteArchivedInstants(List<HoodieInstant> archivedInstants, Hoo
return success;
}
- private boolean deleteArchivedInstantFiles(HoodieEngineContext context,
boolean success, List<String> files) {
- Map<String, Boolean> resultDeleteInstantFiles =
deleteFilesParallelize(metaClient, files, context, false);
+ private boolean deleteArchivedInstants(HoodieEngineContext context,
+ HoodieTableMetaClient metaClient,
+ List<HoodieInstant> instants) {
+ if (instants.isEmpty()) {
+ return true;
+ }
- for (Map.Entry<String, Boolean> result :
resultDeleteInstantFiles.entrySet()) {
- LOG.info("Archived and deleted instant file " + result.getKey() + " : "
+ result.getValue());
- success &= result.getValue();
+ Map<HoodieInstant, Boolean> result = context.mapToPair(
+ instants,
+ instant -> ImmutablePair.of(
+ instant,
+ metaClient.getActiveTimeline().deleteInstantFileIfExists(instant,
false)),
+ Math.min(instants.size(), config.getArchiveDeleteParallelism()));
+
+ boolean success = true;
+ for (Map.Entry<HoodieInstant, Boolean> entry : result.entrySet()) {
+ LOG.info("Archived and deleted instant " + entry.getKey().toString() + "
: " + entry.getValue());
+ success &= entry.getValue();
Review Comment:
if throw error directly if fail to delete, no return value is required.
--
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]