yihua commented on code in PR #17552:
URL: https://github.com/apache/hudi/pull/17552#discussion_r2609388405
##########
hudi-hadoop-common/src/main/java/org/apache/hudi/common/config/DFSPropertiesConfiguration.java:
##########
@@ -209,15 +222,41 @@ public TypedProperties getGlobalProperties() {
}
public static TypedProperties getGlobalProps() {
+ if (!globalPropsInitialized) {
+ synchronized (INIT_LOCK) {
+ if (!globalPropsInitialized) {
+ try {
+ GLOBAL_PROPS = loadGlobalProps();
+ globalPropsInitialized = true; // Only mark as initialized on
success
+ } catch (Exception e) {
+ LOG.warn("Failed to load global props, using empty configuration. "
+ + "Will retry on next call.", e);
+ // Do NOT set globalPropsInitialized = true here to allow retry on
next call
Review Comment:
Do we want to throw the exception here in case the props fail to load so the
caller should fail and Spark should retry?
##########
hudi-hadoop-common/src/main/java/org/apache/hudi/common/config/DFSPropertiesConfiguration.java:
##########
@@ -209,15 +222,41 @@ public TypedProperties getGlobalProperties() {
}
public static TypedProperties getGlobalProps() {
+ if (!globalPropsInitialized) {
+ synchronized (INIT_LOCK) {
+ if (!globalPropsInitialized) {
+ try {
+ GLOBAL_PROPS = loadGlobalProps();
+ globalPropsInitialized = true; // Only mark as initialized on
success
+ } catch (Exception e) {
+ LOG.warn("Failed to load global props, using empty configuration. "
+ + "Will retry on next call.", e);
+ // Do NOT set globalPropsInitialized = true here to allow retry on
next call
+ }
+ }
+ }
+ }
+ // Always return something (even if GLOBAL_PROPS is still null)
+ if (GLOBAL_PROPS == null) {
+ return new TypedProperties();
+ }
Review Comment:
If throwing, there is no need to do this.
--
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]