narendly commented on a change in pull request #867: Make 
ZkHelixClusterVerifier and its child classes realm-aware
URL: https://github.com/apache/helix/pull/867#discussion_r389844965
 
 

 ##########
 File path: 
helix-core/src/main/java/org/apache/helix/tools/ClusterVerifiers/ZkHelixClusterVerifier.java
 ##########
 @@ -104,15 +112,49 @@ public ZkHelixClusterVerifier(String zkAddr, String 
clusterName) {
     if (zkAddr == null || clusterName == null) {
       throw new IllegalArgumentException("requires zkAddr|clusterName");
     }
-    _zkClient = DedicatedZkClientFactory.getInstance()
-        .buildZkClient(new HelixZkClient.ZkConnectionConfig(zkAddr));
+
+    RealmAwareZkClient zkClient;
+    try {
+      // First, try to create a RealmAwareZkClient that's a DedicatedZkClient
+      RealmAwareZkClient.RealmAwareZkConnectionConfig.Builder 
connectionConfigBuilder =
+          new RealmAwareZkClient.RealmAwareZkConnectionConfig.Builder();
+      connectionConfigBuilder.setZkRealmShardingKey("/" + clusterName);
+      
connectionConfigBuilder.setRealmMode(RealmAwareZkClient.RealmMode.SINGLE_REALM);
+      zkClient = DedicatedZkClientFactory.getInstance()
+          .buildZkClient(connectionConfigBuilder.build(),
+              new RealmAwareZkClient.RealmAwareZkClientConfig());
+    } catch (IOException | InvalidRoutingDataException | IllegalStateException 
e) {
+      // Fallback option is to create a HelixZkClient that's a 
DedicatedZkClient
 
 Review comment:
   Cases where there is no proper MSDS or routing data available. Then we fall 
back to the previously-existing behavior.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to