You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@helix.apache.org by GitBox <gi...@apache.org> on 2020/03/14 00:31:28 UTC

[GitHub] [helix] narendly commented on a change in pull request #896: Make ZkUtil realm-aware

narendly commented on a change in pull request #896: Make ZkUtil realm-aware
URL: https://github.com/apache/helix/pull/896#discussion_r392537407
 
 

 ##########
 File path: helix-core/src/main/java/org/apache/helix/manager/zk/ZKUtil.java
 ##########
 @@ -601,16 +607,30 @@ public static String toHexSessionId(long sessionId) {
   }
 
   /**
-   * Returns a dedicated ZkClient.
+   * Returns a dedicated ZkClient. A federatedZkClient will be used on multi-zk mode.
+   * WARNING: ephemeral operations will not be supported on multi-zk mode!
    * @return
    */
-  private static HelixZkClient getHelixZkClient(String zkAddr) {
-    if (zkAddr == null || zkAddr.isEmpty()) {
-      throw new HelixException("ZK Address given is either null or empty!");
+  private static RealmAwareZkClient getHelixZkClient(String zkAddr) {
+    if (Boolean.getBoolean(SystemPropertyKeys.MULTI_ZK_ENABLED)) {
+      try {
+        // Create realm-aware ZkClient.
+        RealmAwareZkClient.RealmAwareZkConnectionConfig connectionConfig =
+            new RealmAwareZkClient.RealmAwareZkConnectionConfig.Builder().build();
+        RealmAwareZkClient.RealmAwareZkClientConfig clientConfig =
+            new RealmAwareZkClient.RealmAwareZkClientConfig();
+        return new FederatedZkClient(connectionConfig, clientConfig);
+      } catch (IllegalArgumentException | IOException | InvalidRoutingDataException e) {
+        throw new HelixException("Not able to connect on realm-aware mode", e);
+      }
+    } else {
 
 Review comment:
   Removed the else clause

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org