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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to