1996fanrui commented on code in PR #23987:
URL: https://github.com/apache/flink/pull/23987#discussion_r1438177364


##########
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java:
##########
@@ -1040,8 +1041,9 @@ public void configure(ReadableConfig configuration, 
ClassLoader classLoader) {
         configuration
                 .getOptional(StateChangelogOptions.ENABLE_STATE_CHANGE_LOG)
                 .ifPresent(this::enableChangelogStateBackend);
-        Optional.ofNullable(loadStateBackend(configuration, classLoader))
-                .ifPresent(this::setStateBackend);
+        configuration
+                .getOptional(StateBackendOptions.STATE_BACKEND)
+                .ifPresent(conf -> 
setStateBackend(loadStateBackend(configuration, classLoader)));

Review Comment:
   Thanks a lot to @Zakelly for the review!
   
   First of all, I don't think this code changes any original logic IIUC.
   
   > I'm not sure if it is right to setStateBackend here when user does not 
explicitly config one
   
   This PR set a default value for `StateBackendOptions.STATE_BACKEND`, do you 
mean the `ifPresent` will  be must called if we set the default value?
   
   If your question is this, please do not be worry. I use 
`configuration.getOptional` instead of `configuration.get`.  The `getOptional` 
doesn't consider the default value. 
   
   Please correct me if my understanding is wrong, thanks~



-- 
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]

Reply via email to