beyond1920 commented on code in PR #10836:
URL: https://github.com/apache/hudi/pull/10836#discussion_r1517113136
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/index/bucket/ConsistentBucketIndexUtils.java:
##########
@@ -210,7 +210,15 @@ private static void createCommitMarker(HoodieTable table,
Path fileStatus, Path
if (fs.exists(fullPath)) {
return;
}
- FileIOUtils.createFileInPath(fs, fullPath,
Option.of(getUTF8Bytes(StringUtils.EMPTY_STRING)));
+ //prevent exception from race condition. We are ok with the file being
created in another thread, so we should
+ // check for the marker after catching the exception and we don't need to
fail if the file exists
+ try {
+ FileIOUtils.createFileInPath(fs, fullPath,
Option.of(getUTF8Bytes(StringUtils.EMPTY_STRING)));
+ } catch (HoodieIOException e) {
+ if (!fs.exists(fullPath)) {
+ throw e;
+ }
+ }
Review Comment:
@jonvex LGTM.
BTW, it's better if we could add some logger here if catch exception to help
debug unexpected behavior.
--
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]