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/05 07:21:02 UTC

[GitHub] [helix] narendly opened a new pull request #867: Make ZkHelixClusterVerifier and its child classes realm-aware

narendly opened a new pull request #867: Make ZkHelixClusterVerifier and its child classes realm-aware
URL: https://github.com/apache/helix/pull/867
 
 
   ### Issues
   
   - [x] My PR addresses the following Helix issues and references them in the PR description:
   
   Fixes #866 
   
   ### Description
   
   - [x] Here are some details about my PR, including screenshots of any UI changes:
   
   Changelist:
   1. Make sure constructors accept RealmAwareZkClient
   2. Add Builders in each child class of ZkHelixClusterVerifier so that ZkClient configs are configurable and uses realm-aware ZkClient APIs
   
   ### Tests
   
   - [x] The following tests are written for this issue:
   
   Covered by existing tests
   
   - [ ] The following is the result of the "mvn test" command on the appropriate module:
   
   (Copy & paste the result of "mvn test")
   
   ### Commits
   
   - [x] My commits all reference appropriate Apache Helix GitHub issues in their subject lines. In addition, my commits follow the guidelines from "[How to write a good git commit message](http://chris.beams.io/posts/git-commit/)":
     1. Subject is separated from body by a blank line
     1. Subject is limited to 50 characters (not including Jira issue reference)
     1. Subject does not end with a period
     1. Subject uses the imperative mood ("add", not "adding")
     1. Body wraps at 72 characters
     1. Body explains "what" and "why", not "how"
   
   
   ### Code Quality
   - [x] My diff has been formatted using helix-style.xml 
   (helix-style-intellij.xml if IntelliJ IDE is used)
   
   
   

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


[GitHub] [helix] jiajunwang commented on a change in pull request #867: Make ZkHelixClusterVerifier and its child classes realm-aware

Posted by GitBox <gi...@apache.org>.
jiajunwang 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_r388724968
 
 

 ##########
 File path: helix-core/src/main/java/org/apache/helix/tools/ClusterVerifiers/BestPossibleExternalViewVerifier.java
 ##########
 @@ -94,29 +93,43 @@ public BestPossibleExternalViewVerifier(HelixZkClient zkClient, String clusterNa
     _dataProvider = new ResourceControllerDataProvider();
   }
 
-  public static class Builder {
-    private String _clusterName;
+  private BestPossibleExternalViewVerifier(BestPossibleExternalViewVerifier.Builder builder) {
+    super(builder);
+    _errStates = builder._errStates;
+    _resources = builder._resources;
+    _expectLiveInstances = builder._expectLiveInstances;
 
 Review comment:
   Shall we copy the list in case the builder would be used to create more objects?
   Same for the super class. But it is not shown here so I haven't reviewed it.

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


[GitHub] [helix] narendly commented on a change in pull request #867: Make ZkHelixClusterVerifier and its child classes realm-aware

Posted by GitBox <gi...@apache.org>.
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_r389841711
 
 

 ##########
 File path: helix-core/src/main/java/org/apache/helix/manager/zk/ZkBaseDataAccessor.java
 ##########
 @@ -102,14 +103,14 @@ public AccessResult() {
 
   private static Logger LOG = LoggerFactory.getLogger(ZkBaseDataAccessor.class);
 
-  private final HelixZkClient _zkClient;
-  // true if ZkBaseDataAccessor was instantiated with a HelixZkClient, false otherwise
+  private final RealmAwareZkClient _zkClient;
+  // true if ZkBaseDataAccessor was instantiated with a RealmAwareZkClient, false otherwise
   // This is used for close() to determine how ZkBaseDataAccessor should close the underlying
   // ZkClient
   private final boolean _usesExternalZkClient;
 
   @Deprecated
 
 Review comment:
   To minimize the code change in our code, yes.

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


[GitHub] [helix] narendly commented on a change in pull request #867: Make ZkHelixClusterVerifier and its child classes realm-aware

Posted by GitBox <gi...@apache.org>.
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_r391376121
 
 

 ##########
 File path: helix-core/src/main/java/org/apache/helix/tools/ClusterVerifiers/BestPossibleExternalViewVerifier.java
 ##########
 @@ -84,7 +84,8 @@ public BestPossibleExternalViewVerifier(String zkAddr, String clusterName, Set<S
     _dataProvider = new ResourceControllerDataProvider();
   }
 
-  public BestPossibleExternalViewVerifier(HelixZkClient zkClient, String clusterName,
+  @Deprecated
 
 Review comment:
   Added more javadoc.

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


[GitHub] [helix] pkuwm commented on a change in pull request #867: Make ZkHelixClusterVerifier and its child classes realm-aware

Posted by GitBox <gi...@apache.org>.
pkuwm 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_r391241927
 
 

 ##########
 File path: helix-core/src/main/java/org/apache/helix/tools/ClusterVerifiers/BestPossibleExternalViewVerifier.java
 ##########
 @@ -94,29 +95,47 @@ public BestPossibleExternalViewVerifier(HelixZkClient zkClient, String clusterNa
     _dataProvider = new ResourceControllerDataProvider();
   }
 
-  public static class Builder {
-    private String _clusterName;
+  private BestPossibleExternalViewVerifier(Builder builder) {
+    super(builder);
+    // Deep copy data from Builder
 
 Review comment:
   It seems the original constructors don't do deep copy. Is there a reason we do deep copy here? Maybe to prevent it from any concurrent modification exception as seen in prod or tests?

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


[GitHub] [helix] narendly commented on a change in pull request #867: Make ZkHelixClusterVerifier and its child classes realm-aware

Posted by GitBox <gi...@apache.org>.
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_r391376188
 
 

 ##########
 File path: helix-core/src/main/java/org/apache/helix/tools/ClusterVerifiers/BestPossibleExternalViewVerifier.java
 ##########
 @@ -94,29 +95,47 @@ public BestPossibleExternalViewVerifier(HelixZkClient zkClient, String clusterNa
     _dataProvider = new ResourceControllerDataProvider();
   }
 
-  public static class Builder {
-    private String _clusterName;
+  private BestPossibleExternalViewVerifier(Builder builder) {
+    super(builder);
+    // Deep copy data from Builder
 
 Review comment:
   This is because users can re-use a builder object to create multiple instances.

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


[GitHub] [helix] jiajunwang commented on a change in pull request #867: Make ZkHelixClusterVerifier and its child classes realm-aware

Posted by GitBox <gi...@apache.org>.
jiajunwang 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_r388725599
 
 

 ##########
 File path: helix-core/src/main/java/org/apache/helix/tools/ClusterVerifiers/BestPossibleExternalViewVerifier.java
 ##########
 @@ -94,29 +93,43 @@ public BestPossibleExternalViewVerifier(HelixZkClient zkClient, String clusterNa
     _dataProvider = new ResourceControllerDataProvider();
   }
 
-  public static class Builder {
-    private String _clusterName;
+  private BestPossibleExternalViewVerifier(BestPossibleExternalViewVerifier.Builder builder) {
+    super(builder);
+    _errStates = builder._errStates;
+    _resources = builder._resources;
+    _expectLiveInstances = builder._expectLiveInstances;
+    _dataProvider = new ResourceControllerDataProvider();
+  }
+
+  public static class Builder extends ZkHelixClusterVerifier.Builder {
+    private final String _clusterName;
     private Map<String, Map<String, String>> _errStates;
     private Set<String> _resources;
     private Set<String> _expectLiveInstances;
-    private String _zkAddr;
-    private HelixZkClient _zkClient;
+    private RealmAwareZkClient _zkClient;
 
     public Builder(String clusterName) {
       _clusterName = clusterName;
     }
 
     public BestPossibleExternalViewVerifier build() {
-      if (_clusterName == null || (_zkAddr == null && _zkClient == null)) {
+      if (_clusterName == null || (_zkAddress == null && _zkClient == null)) {
         throw new IllegalArgumentException("Cluster name or zookeeper info is missing!");
       }
 
       if (_zkClient != null) {
         return new BestPossibleExternalViewVerifier(_zkClient, _clusterName, _resources, _errStates,
 
 Review comment:
   Is it possible that we merge this constructor logic into BestPossibleExternalViewVerifier(Builder); So we don't need to maintain both logics.

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


[GitHub] [helix] narendly commented on a change in pull request #867: Make ZkHelixClusterVerifier and its child classes realm-aware

Posted by GitBox <gi...@apache.org>.
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_r391377198
 
 

 ##########
 File path: helix-core/src/main/java/org/apache/helix/tools/ClusterVerifiers/BestPossibleExternalViewVerifier.java
 ##########
 @@ -94,29 +93,43 @@ public BestPossibleExternalViewVerifier(HelixZkClient zkClient, String clusterNa
     _dataProvider = new ResourceControllerDataProvider();
   }
 
-  public static class Builder {
-    private String _clusterName;
+  private BestPossibleExternalViewVerifier(BestPossibleExternalViewVerifier.Builder builder) {
+    super(builder);
+    _errStates = builder._errStates;
+    _resources = builder._resources;
+    _expectLiveInstances = builder._expectLiveInstances;
+    _dataProvider = new ResourceControllerDataProvider();
+  }
+
+  public static class Builder extends ZkHelixClusterVerifier.Builder {
+    private final String _clusterName;
     private Map<String, Map<String, String>> _errStates;
     private Set<String> _resources;
     private Set<String> _expectLiveInstances;
-    private String _zkAddr;
-    private HelixZkClient _zkClient;
+    private RealmAwareZkClient _zkClient;
 
     public Builder(String clusterName) {
       _clusterName = clusterName;
     }
 
     public BestPossibleExternalViewVerifier build() {
-      if (_clusterName == null || (_zkAddr == null && _zkClient == null)) {
+      if (_clusterName == null || (_zkAddress == null && _zkClient == null)) {
         throw new IllegalArgumentException("Cluster name or zookeeper info is missing!");
       }
 
       if (_zkClient != null) {
         return new BestPossibleExternalViewVerifier(_zkClient, _clusterName, _resources, _errStates,
 
 Review comment:
   I tried to move it to validate(), but this is left here to keep this backward-compatible with the existing builder logic. So we need it here..

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


[GitHub] [helix] narendly merged pull request #867: Make ZkHelixClusterVerifier and its child classes realm-aware

Posted by GitBox <gi...@apache.org>.
narendly merged pull request #867: Make ZkHelixClusterVerifier and its child classes realm-aware
URL: https://github.com/apache/helix/pull/867
 
 
   

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


[GitHub] [helix] narendly commented on a change in pull request #867: Make ZkHelixClusterVerifier and its child classes realm-aware

Posted by GitBox <gi...@apache.org>.
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_r389842131
 
 

 ##########
 File path: helix-core/src/main/java/org/apache/helix/tools/ClusterVerifiers/BestPossibleExternalViewVerifier.java
 ##########
 @@ -84,7 +83,7 @@ public BestPossibleExternalViewVerifier(String zkAddr, String clusterName, Set<S
     _dataProvider = new ResourceControllerDataProvider();
   }
 
-  public BestPossibleExternalViewVerifier(HelixZkClient zkClient, String clusterName,
+  public BestPossibleExternalViewVerifier(RealmAwareZkClient zkClient, String clusterName,
 
 Review comment:
   Yes. We should.

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


[GitHub] [helix] jiajunwang commented on a change in pull request #867: Make ZkHelixClusterVerifier and its child classes realm-aware

Posted by GitBox <gi...@apache.org>.
jiajunwang 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_r388725401
 
 

 ##########
 File path: helix-core/src/main/java/org/apache/helix/tools/ClusterVerifiers/BestPossibleExternalViewVerifier.java
 ##########
 @@ -84,7 +83,7 @@ public BestPossibleExternalViewVerifier(String zkAddr, String clusterName, Set<S
     _dataProvider = new ResourceControllerDataProvider();
   }
 
-  public BestPossibleExternalViewVerifier(HelixZkClient zkClient, String clusterName,
+  public BestPossibleExternalViewVerifier(RealmAwareZkClient zkClient, String clusterName,
 
 Review comment:
   Since we have the builder, shall we deprecated all the other constructors?

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


[GitHub] [helix] narendly commented on a change in pull request #867: Make ZkHelixClusterVerifier and its child classes realm-aware

Posted by GitBox <gi...@apache.org>.
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_r389843405
 
 

 ##########
 File path: helix-core/src/main/java/org/apache/helix/tools/ClusterVerifiers/BestPossibleExternalViewVerifier.java
 ##########
 @@ -94,29 +93,43 @@ public BestPossibleExternalViewVerifier(HelixZkClient zkClient, String clusterNa
     _dataProvider = new ResourceControllerDataProvider();
   }
 
-  public static class Builder {
-    private String _clusterName;
+  private BestPossibleExternalViewVerifier(BestPossibleExternalViewVerifier.Builder builder) {
+    super(builder);
+    _errStates = builder._errStates;
+    _resources = builder._resources;
+    _expectLiveInstances = builder._expectLiveInstances;
+    _dataProvider = new ResourceControllerDataProvider();
+  }
+
+  public static class Builder extends ZkHelixClusterVerifier.Builder {
+    private final String _clusterName;
     private Map<String, Map<String, String>> _errStates;
     private Set<String> _resources;
     private Set<String> _expectLiveInstances;
-    private String _zkAddr;
-    private HelixZkClient _zkClient;
+    private RealmAwareZkClient _zkClient;
 
     public Builder(String clusterName) {
       _clusterName = clusterName;
     }
 
     public BestPossibleExternalViewVerifier build() {
-      if (_clusterName == null || (_zkAddr == null && _zkClient == null)) {
+      if (_clusterName == null || (_zkAddress == null && _zkClient == null)) {
         throw new IllegalArgumentException("Cluster name or zookeeper info is missing!");
       }
 
       if (_zkClient != null) {
         return new BestPossibleExternalViewVerifier(_zkClient, _clusterName, _resources, _errStates,
 
 Review comment:
   This should actually all go in validate(). Let me see if I could move it.

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


[GitHub] [helix] dasahcc commented on a change in pull request #867: Make ZkHelixClusterVerifier and its child classes realm-aware

Posted by GitBox <gi...@apache.org>.
dasahcc 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_r389053366
 
 

 ##########
 File path: helix-core/src/main/java/org/apache/helix/manager/zk/ZkBaseDataAccessor.java
 ##########
 @@ -102,14 +103,14 @@ public AccessResult() {
 
   private static Logger LOG = LoggerFactory.getLogger(ZkBaseDataAccessor.class);
 
-  private final HelixZkClient _zkClient;
-  // true if ZkBaseDataAccessor was instantiated with a HelixZkClient, false otherwise
+  private final RealmAwareZkClient _zkClient;
+  // true if ZkBaseDataAccessor was instantiated with a RealmAwareZkClient, false otherwise
   // This is used for close() to determine how ZkBaseDataAccessor should close the underlying
   // ZkClient
   private final boolean _usesExternalZkClient;
 
   @Deprecated
 
 Review comment:
   Is this necessary to change the deprecated method?

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


[GitHub] [helix] narendly commented on a change in pull request #867: Make ZkHelixClusterVerifier and its child classes realm-aware

Posted by GitBox <gi...@apache.org>.
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:
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


[GitHub] [helix] jiajunwang commented on a change in pull request #867: Make ZkHelixClusterVerifier and its child classes realm-aware

Posted by GitBox <gi...@apache.org>.
jiajunwang 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_r388726785
 
 

 ##########
 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:
   Question, In which case we need to handle this fallback logic? It is expected in some condition or just for safe?

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


[GitHub] [helix] jiajunwang commented on a change in pull request #867: Make ZkHelixClusterVerifier and its child classes realm-aware

Posted by GitBox <gi...@apache.org>.
jiajunwang 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_r388726042
 
 

 ##########
 File path: helix-core/src/main/java/org/apache/helix/tools/ClusterVerifiers/ClusterLiveNodesVerifier.java
 ##########
 @@ -24,18 +24,24 @@
 import java.util.List;
 import java.util.Set;
 
-import org.apache.helix.zookeeper.api.client.HelixZkClient;
+import org.apache.helix.zookeeper.api.client.RealmAwareZkClient;
+
 
 public class ClusterLiveNodesVerifier extends ZkHelixClusterVerifier {
 
   final Set<String> _expectLiveNodes;
 
-  public ClusterLiveNodesVerifier(HelixZkClient zkclient, String clusterName,
+  public ClusterLiveNodesVerifier(RealmAwareZkClient zkclient, String clusterName,
 
 Review comment:
   Same here, shall we replace the existing constructor with the builder constructor?

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


[GitHub] [helix] pkuwm commented on a change in pull request #867: Make ZkHelixClusterVerifier and its child classes realm-aware

Posted by GitBox <gi...@apache.org>.
pkuwm 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_r391240319
 
 

 ##########
 File path: helix-core/src/main/java/org/apache/helix/tools/ClusterVerifiers/BestPossibleExternalViewVerifier.java
 ##########
 @@ -84,7 +84,8 @@ public BestPossibleExternalViewVerifier(String zkAddr, String clusterName, Set<S
     _dataProvider = new ResourceControllerDataProvider();
   }
 
-  public BestPossibleExternalViewVerifier(HelixZkClient zkClient, String clusterName,
+  @Deprecated
 
 Review comment:
   Nit: Maybe can we add javadoc for why it is deprecated and what is recommended to use?

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


[GitHub] [helix] narendly commented on issue #867: Make ZkHelixClusterVerifier and its child classes realm-aware

Posted by GitBox <gi...@apache.org>.
narendly commented on issue #867: Make ZkHelixClusterVerifier and its child classes realm-aware
URL: https://github.com/apache/helix/pull/867#issuecomment-597983320
 
 
   This PR is ready to be merged, approved by @dasahcc 
   
   
   Changelist:
   Make sure constructors accept RealmAwareZkClient
   Add Builders in each child class of ZkHelixClusterVerifier so that ZkClient configs are configurable and uses realm-aware ZkClient APIs

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


[GitHub] [helix] narendly commented on a change in pull request #867: Make ZkHelixClusterVerifier and its child classes realm-aware

Posted by GitBox <gi...@apache.org>.
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_r389842491
 
 

 ##########
 File path: helix-core/src/main/java/org/apache/helix/tools/ClusterVerifiers/BestPossibleExternalViewVerifier.java
 ##########
 @@ -94,29 +93,43 @@ public BestPossibleExternalViewVerifier(HelixZkClient zkClient, String clusterNa
     _dataProvider = new ResourceControllerDataProvider();
   }
 
-  public static class Builder {
-    private String _clusterName;
+  private BestPossibleExternalViewVerifier(BestPossibleExternalViewVerifier.Builder builder) {
+    super(builder);
+    _errStates = builder._errStates;
+    _resources = builder._resources;
+    _expectLiveInstances = builder._expectLiveInstances;
 
 Review comment:
   Good point. I'll address this.

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


[GitHub] [helix] narendly commented on a change in pull request #867: Make ZkHelixClusterVerifier and its child classes realm-aware

Posted by GitBox <gi...@apache.org>.
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_r389843671
 
 

 ##########
 File path: helix-core/src/main/java/org/apache/helix/tools/ClusterVerifiers/ClusterLiveNodesVerifier.java
 ##########
 @@ -24,18 +24,24 @@
 import java.util.List;
 import java.util.Set;
 
-import org.apache.helix.zookeeper.api.client.HelixZkClient;
+import org.apache.helix.zookeeper.api.client.RealmAwareZkClient;
+
 
 public class ClusterLiveNodesVerifier extends ZkHelixClusterVerifier {
 
   final Set<String> _expectLiveNodes;
 
-  public ClusterLiveNodesVerifier(HelixZkClient zkclient, String clusterName,
+  public ClusterLiveNodesVerifier(RealmAwareZkClient zkclient, String clusterName,
 
 Review comment:
   Will deprecate.

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