danny0405 commented on code in PR #9209:
URL: https://github.com/apache/hudi/pull/9209#discussion_r1393515340


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/timeline/HoodieTimelineArchiver.java:
##########
@@ -164,230 +101,32 @@ public boolean archiveIfRequired(HoodieEngineContext 
context, boolean acquireLoc
         // there is no owner or instant time per se for archival.
         txnManager.beginTransaction(Option.empty(), Option.empty());
       }
-      List<HoodieInstant> instantsToArchive = 
getInstantsToArchive().collect(Collectors.toList());
-      verifyLastMergeArchiveFilesIfNecessary(context);
+      // Sort again because the cleaning and rollback instants could break the 
sequence.
+      List<ActiveAction> instantsToArchive = 
getInstantsToArchive().sorted().collect(Collectors.toList());
       boolean success = true;
       if (!instantsToArchive.isEmpty()) {
-        this.writer = openWriter();
         LOG.info("Archiving instants " + instantsToArchive);
-        archive(context, instantsToArchive);
+        Consumer<Exception> exceptionHandler = e -> {
+          if (this.config.isFailOnTimelineArchivingEnabled()) {
+            throw new HoodieException(e);
+          }
+        };
+        this.timelineWriter.write(instantsToArchive, Option.of(action -> 
deleteAnyLeftOverMarkers(context, action)), Option.of(exceptionHandler));
         LOG.info("Deleting archived instants " + instantsToArchive);
         success = deleteArchivedInstants(instantsToArchive, context);

Review Comment:
   we should, but currently the redundants left by failed deletion does not 
affect the correctness, the completion time would be still loaded correctly if 
an instant locates both avtive and archived timeline.
   
   We need to thing through the design though, it is arduous to maintain the 
whole multiple handling as atomic.



-- 
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]

Reply via email to