You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2021/08/25 23:06:05 UTC

[GitHub] [hudi] satishkotha commented on a change in pull request #3536: [HUDI-2354] Fix TimelineServer error because of replacecommit archive

satishkotha commented on a change in pull request #3536:
URL: https://github.com/apache/hudi/pull/3536#discussion_r696171192



##########
File path: hudi-common/src/main/java/org/apache/hudi/common/table/view/AbstractTableFileSystemView.java
##########
@@ -212,7 +212,15 @@ private void resetFileGroupsReplaced(HoodieTimeline timeline) {
     hoodieTimer.startTimer();
     // for each REPLACE instant, get map of (partitionPath -> deleteFileGroup)
     HoodieTimeline replacedTimeline = timeline.getCompletedReplaceTimeline();
-    Stream<Map.Entry<HoodieFileGroupId, HoodieInstant>> resultStream = replacedTimeline.getInstants().flatMap(instant -> {
+    Stream<Map.Entry<HoodieFileGroupId, HoodieInstant>> resultStream = replacedTimeline.getInstants().filter(instant -> {
+      try {
+        // Replace instant could be deleted by archive in timeline
+        // So that we need to check if the replace commit files were existed.
+        return metaClient.getFs().exists(new Path(metaClient.getMetaPath(), instant.getFileName()));

Review comment:
       there is still a race condition right?
   1) we check file exists
   2) archival deltes file
   3) filesystem view tries to read the file and throws error.
   
   instead of this maybe we can surround  below line with try { HoodieReplaceCommitMetadata.fromBytes(metaClient.getActiveTimeline().getInstantDetails(instant).get(),
               HoodieReplaceCommitMetadata.class);
   } catch (FileNotFoundException e) {
   // ignore because replacecommit may have been deleted by archival?
   }




-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org