From 218f2a6df8a41279d904a76b594d22f4d66d17c2 Mon Sep 17 00:00:00 2001 From: yuzhaojing <32435329+yuzhaojing@users.noreply.github.com> Date: Fri, 25 Jun 2021 08:54:59 +0800 Subject: [PATCH] [HUDI-2062] Catch FileNotFoundException in WriteProfiles #getCommitMetadata Safely (#3138) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 喻兆靖 --- .../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 20bc46d67..d62b2086a 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); } }