tillrohrmann commented on a change in pull request #17053:
URL: https://github.com/apache/flink/pull/17053#discussion_r700016263
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/util/ZooKeeperUtils.java
##########
@@ -224,11 +229,30 @@ public static CuratorFramework
startCuratorFramework(Configuration configuration
curatorFrameworkBuilder.connectionStateErrorPolicy(
new SessionConnectionStateErrorPolicy());
}
+ return startCuratorFramework(curatorFrameworkBuilder);
+ }
- CuratorFramework cf = curatorFrameworkBuilder.build();
-
+ /**
+ * Starts a {@link CuratorFramework} instance and connects it to the given
ZooKeeper quorum from
+ * a builder.
+ *
+ * @param builder {@link CuratorFrameworkFactory.Builder} A builder for
curatorFramework.
+ * @return {@link CuratorFramework} instance
+ */
+ static CuratorFramework
startCuratorFramework(CuratorFrameworkFactory.Builder builder) {
+ CuratorFramework cf = builder.build();
+ UnhandledErrorListener unhandledErrorListener =
+ (message, throwable) -> {
+ LOG.error(
+ "Exiting process for unhandled error in curator
framework, "
+ + "error message: {}, exiting code: {}",
+ message,
+ ZOOKEEPER_FAILURE_EXIT_CODE,
+ throwable);
+
FlinkSecurityManager.forceProcessExit(ZOOKEEPER_FAILURE_EXIT_CODE);
Review comment:
Then we wouldn't have the problems of how to test for
`FlinkSecurityManager.forceProcessExit`.
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/util/ZooKeeperUtils.java
##########
@@ -224,11 +229,30 @@ public static CuratorFramework
startCuratorFramework(Configuration configuration
curatorFrameworkBuilder.connectionStateErrorPolicy(
new SessionConnectionStateErrorPolicy());
}
+ return startCuratorFramework(curatorFrameworkBuilder);
+ }
- CuratorFramework cf = curatorFrameworkBuilder.build();
-
+ /**
+ * Starts a {@link CuratorFramework} instance and connects it to the given
ZooKeeper quorum from
+ * a builder.
+ *
+ * @param builder {@link CuratorFrameworkFactory.Builder} A builder for
curatorFramework.
+ * @return {@link CuratorFramework} instance
+ */
+ static CuratorFramework
startCuratorFramework(CuratorFrameworkFactory.Builder builder) {
+ CuratorFramework cf = builder.build();
+ UnhandledErrorListener unhandledErrorListener =
+ (message, throwable) -> {
+ LOG.error(
+ "Exiting process for unhandled error in curator
framework, "
+ + "error message: {}, exiting code: {}",
+ message,
+ ZOOKEEPER_FAILURE_EXIT_CODE,
+ throwable);
+
FlinkSecurityManager.forceProcessExit(ZOOKEEPER_FAILURE_EXIT_CODE);
Review comment:
Maybe it is actually better if we can pass in a `FatalErrorHandler`.
That way we can integrate the failure handling with the general logic (e.g. in
the `ClusterEntrypoint` we add additional information if there was a out of
memory error).
--
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]