XComp commented on code in PR #24563:
URL: https://github.com/apache/flink/pull/24563#discussion_r1541117995
##########
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:
You have a point there. It appears to be a quite nitty. But on the other
hand, it's also quite unlikely that a user would set such a timeout. Therefore,
an exception wouldn't hurt. :shrug:
##########
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)) {
+ long maxCloseWait =
configuration.get(HighAvailabilityOptions.ZOOKEEPER_MAX_CLOSE_WAIT).toMillis();
+ 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);
Review Comment:
```suggestion
if (maxCloseWait < 0 || maxCloseWait > Integer.MAX_VALUE) {
throw new IllegalConfigurationException(
"The value (%d ms) is out-of-range for %s. The
milliseconds timeout is expected to be between 0 and %d ms.",
maxCloseWait,
HighAvailabilityOptions.ZOOKEEPER_MAX_CLOSE_WAIT.key(),
Integer.MAX_VALUE);
}
```
nit: since tthere is a constructor for formatted strings.
##########
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)) {
+ long maxCloseWait =
configuration.get(HighAvailabilityOptions.ZOOKEEPER_MAX_CLOSE_WAIT).toMillis();
+ if (maxCloseWait < Integer.MIN_VALUE || maxCloseWait >
Integer.MAX_VALUE) {
Review Comment:
```suggestion
if (maxCloseWait < 0 || maxCloseWait > Integer.MAX_VALUE) {
```
I guess, we should stay in the positive range for the timeout, shouldn't we?
##########
docs/layouts/shortcodes/generated/high_availability_configuration.html:
##########
Review Comment:
The docs are not regenerated.
--
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]