1
0

[HUDI-2062] Catch FileNotFoundException in WriteProfiles #getCommitMetadata Safely (#3138)

Co-authored-by: 喻兆靖 <yuzhaojing@bilibili.com>
This commit is contained in:
yuzhaojing
2021-06-25 08:54:59 +08:00
committed by GitHub
parent b32855545b
commit 218f2a6df8

View File

@@ -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);
}
}