You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by vi...@apache.org on 2021/06/25 00:55:16 UTC

[hudi] branch master updated: [HUDI-2062] Catch FileNotFoundException in WriteProfiles #getCommitMetadata Safely (#3138)

This is an automated email from the ASF dual-hosted git repository.

vinoyang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hudi.git


The following commit(s) were added to refs/heads/master by this push:
     new 218f2a6  [HUDI-2062] Catch FileNotFoundException in WriteProfiles #getCommitMetadata Safely (#3138)
218f2a6 is described below

commit 218f2a6df8a41279d904a76b594d22f4d66d17c2
Author: yuzhaojing <32...@users.noreply.github.com>
AuthorDate: Fri Jun 25 08:54:59 2021 +0800

    [HUDI-2062] Catch FileNotFoundException in WriteProfiles #getCommitMetadata Safely (#3138)
    
    Co-authored-by: 喻兆靖 <yu...@bilibili.com>
---
 .../org/apache/hudi/sink/partitioner/profile/WriteProfiles.java  | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/hudi-flink/src/main/java/org/apache/hudi/sink/partitioner/profile/WriteProfiles.java b/hudi-flink/src/main/java/org/apache/hudi/sink/partitioner/profile/WriteProfiles.java
index 20bc46d..d62b208 100644
--- a/hudi-flink/src/main/java/org/apache/hudi/sink/partitioner/profile/WriteProfiles.java
+++ b/hudi-flink/src/main/java/org/apache/hudi/sink/partitioner/profile/WriteProfiles.java
@@ -150,14 +150,17 @@ public class WriteProfiles {
       Path basePath,
       HoodieInstant instant,
       HoodieTimeline timeline) {
-    byte[] data = timeline.getInstantDetails(instant).get();
     try {
+      byte[] data = timeline.getInstantDetails(instant).get();
       return Option.of(HoodieCommitMetadata.fromBytes(data, HoodieCommitMetadata.class));
-    } catch (IOException e) {
+    } catch (FileNotFoundException fe) {
       // make this fail safe.
+      LOG.warn("Instant {} was deleted by the cleaner, ignore", instant.getTimestamp());
+      return Option.empty();
+    } catch (IOException e) {
       LOG.error("Get write metadata for table {} with instant {} and path: {} error",
           tableName, instant.getTimestamp(), basePath);
-      return Option.empty();
+      throw new HoodieException(e);
     }
   }