JTaky commented on code in PR #24563:
URL: https://github.com/apache/flink/pull/24563#discussion_r1541075870


##########
flink-runtime/src/main/java/org/apache/flink/runtime/util/ZooKeeperUtils.java:
##########
@@ -246,6 +249,38 @@ public static CuratorFrameworkWithUnhandledErrorListener 
startCuratorFramework(
                         .ensembleTracker(ensembleTracking)
                         .aclProvider(aclProvider);
 
+        if 
(configuration.contains(HighAvailabilityOptions.ZOOKEEPER_CLIENT_AUTHORIZATION))
 {
+            Map<String, String> authMap =
+                    
configuration.get(HighAvailabilityOptions.ZOOKEEPER_CLIENT_AUTHORIZATION);
+            List<AuthInfo> authInfos =
+                    authMap.entrySet().stream()
+                            .map(
+                                    entry ->
+                                            new AuthInfo(
+                                                    entry.getKey(),
+                                                    entry.getValue()
+                                                            .getBytes(
+                                                                    
ConfigConstants
+                                                                            
.DEFAULT_CHARSET)))
+                            .collect(Collectors.toList());
+            curatorFrameworkBuilder.authorization(authInfos);
+        }
+
+        if 
(configuration.contains(HighAvailabilityOptions.ZOOKEEPER_MAX_CLOSE_WAIT_MS)) {
+            curatorFrameworkBuilder.maxCloseWaitMs(
+                    (int)
+                            configuration
+                                    
.get(HighAvailabilityOptions.ZOOKEEPER_MAX_CLOSE_WAIT_MS)
+                                    .toMillis());

Review Comment:
   I am hesitant to throw an Exception here, but probably it can help somebody 
who will put wrong duration value, e.g. days? (MaxInteger in ms is more than 
500 hours)
   ```            
   if (maxCloseWait < Integer.MIN_VALUE || maxCloseWait > Integer.MAX_VALUE) {
                   throw new 
IllegalConfigurationException(HighAvailabilityOptions.ZOOKEEPER_MAX_CLOSE_WAIT.key()
 + " in ms is not an integer - " + maxCloseWait);
               }```
   
   As an alternative we could imagine to put a WARN and silently limit the 
value to the MaxInteger. While it is always a bad practice to make something 
implicit.



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