-
Notifications
You must be signed in to change notification settings - Fork 2.5k
[HUDI-3634] Could read empty or partial HoodieCommitMetaData in downstream if using HDFS #5048
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
b03f1f3
bfedf3e
64cdc45
74f6fcf
63d017a
31c2e0a
3f4bfbd
c0cece1
178249f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -664,9 +664,21 @@ private void createFileInMetaPath(String filename, Option<byte[]> content, boole | |
| */ | ||
| private void createImmutableFileInPath(Path fullPath, Option<byte[]> content) { | ||
| FSDataOutputStream fsout = null; | ||
| Path tmpPath = null; | ||
| try { | ||
| fsout = metaClient.getFs().create(fullPath, false); | ||
| if (content.isPresent()) { | ||
| if (!content.isPresent()) { | ||
| fsout = metaClient.getFs().create(fullPath, false); | ||
| } | ||
|
|
||
| if (content.isPresent() && metaClient.getTableConfig().allowTempCommit()) { | ||
| Path parent = fullPath.getParent(); | ||
| tmpPath = new Path(parent, fullPath.getName() + ".tmp"); | ||
| fsout = metaClient.getFs().create(tmpPath, false); | ||
| fsout.write(content.get()); | ||
| } | ||
|
|
||
| if (content.isPresent() && !metaClient.getTableConfig().allowTempCommit()) { | ||
| fsout = metaClient.getFs().create(fullPath, false); | ||
| fsout.write(content.get()); | ||
| } | ||
| } catch (IOException e) { | ||
|
|
@@ -676,6 +688,9 @@ private void createImmutableFileInPath(Path fullPath, Option<byte[]> content) { | |
| if (null != fsout) { | ||
| fsout.close(); | ||
| } | ||
| if (null != tmpPath) { | ||
| metaClient.getFs().rename(tmpPath, fullPath); | ||
|
||
| } | ||
| } catch (IOException e) { | ||
| throw new HoodieIOException("Failed to close file " + fullPath, e); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's extract ".tmp" to a constant.