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 2022/05/16 04:59:54 UTC

[GitHub] [helix] xyuanlu opened a new pull request, #2099: Allow using passed in connection config when reading cloud config

xyuanlu opened a new pull request, #2099:
URL: https://github.com/apache/helix/pull/2099

   ### Issues
   
   - [X] My PR addresses the following Helix issues and references them in the PR description:
   
   #2098
   
   
   ### Description
   
   - [X] Here are some details about my PR, including screenshots of any UI changes:
   
   Helix is reading MultiZK config from jvm only when initiating ZkHelixManager. Helix should also read from user passed in connectionConfig.
   
   ### Tests
   
   - [X] The following tests are written for this issue:
   
   TestMultiZkConectionConfig
   
   - The following is the result of the "mvn test" command on the appropriate module:
   
   (If CI test fails due to known issue, please specify the issue and test PR locally. Then copy & paste the result of "mvn test" to here.)
   
   ### Changes that Break Backward Compatibility (Optional)
   
   - My PR contains changes that break backward compatibility or previous assumptions for certain methods or API. They include:
   
   (Consider including all behavior changes for public methods or API. Also include these changes in merge description so that other developers are aware of these changes. This allows them to make relevant code changes in feature branches accounting for the new method/API behavior.)
   
   ### Documentation (Optional)
   
   - In case of new functionality, my PR adds documentation in the following wiki page:
   
   (Link the GitHub wiki you added)
   
   ### Commits
   
   - 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
   
   - 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.

To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [helix] xyuanlu commented on a diff in pull request #2099: Allow using passed in connection config when reading cloud config

Posted by GitBox <gi...@apache.org>.
xyuanlu commented on code in PR #2099:
URL: https://github.com/apache/helix/pull/2099#discussion_r884073573


##########
helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixManager.java:
##########
@@ -282,7 +282,8 @@ public ZKHelixManager(String clusterName, String instanceName, InstanceType inst
     // read cloud config from ZK and set cloudConfig in HelixManagerProperty
     _helixManagerProperty = helixManagerProperty;
     _helixManagerProperty.getHelixCloudProperty().populateFieldsWithCloudConfig(
-        HelixPropertyFactory.getCloudConfig(_zkAddress, _clusterName));
+        HelixPropertyFactory.getCloudConfig(_zkAddress, _clusterName,
+            helixManagerProperty.getZkConnectionConfig()));

Review Comment:
   helixManagerProperty.getZkConnectionConfig() returns an object of `RealmAwareZkConnectionConfig`.
   I our current Helix use case, the user is defining the multiZkRouting endpoint in the `RealmAwareZkConnectionConfig`. However, the original `getCloudConfig` create a zkClient only using the multiZkRouting in java env variable. When user pass in the config but not set it in env variable, we will fail to create zkClient even when user passed in correct config. 



-- 
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: reviews-unsubscribe@helix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [helix] junkaixue merged pull request #2099: Allow using passed in connection config when reading cloud config

Posted by GitBox <gi...@apache.org>.
junkaixue merged PR #2099:
URL: https://github.com/apache/helix/pull/2099


-- 
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: reviews-unsubscribe@helix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [helix] NealSun96 commented on a diff in pull request #2099: Allow using passed in connection config when reading cloud config

Posted by GitBox <gi...@apache.org>.
NealSun96 commented on code in PR #2099:
URL: https://github.com/apache/helix/pull/2099#discussion_r885955631


##########
helix-core/src/test/java/org/apache/helix/integration/manager/ClusterControllerManager.java:
##########
@@ -37,6 +38,10 @@ public ClusterControllerManager(String zkAddr, String clusterName, String contro
     super(zkAddr, clusterName, controllerName, InstanceType.CONTROLLER);
   }
 
+  public ClusterControllerManager(String clusterName, HelixManagerProperty helixManagerProperty) {

Review Comment:
   Didn't notice, my bad. 



-- 
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: reviews-unsubscribe@helix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [helix] NealSun96 commented on a diff in pull request #2099: Allow using passed in connection config when reading cloud config

Posted by GitBox <gi...@apache.org>.
NealSun96 commented on code in PR #2099:
URL: https://github.com/apache/helix/pull/2099#discussion_r885970449


##########
helix-core/src/main/java/org/apache/helix/HelixPropertyFactory.java:
##########
@@ -80,20 +80,27 @@ public HelixManagerProperty getHelixManagerProperty(String zkAddress, String clu
    * @param clusterName
    * @return
    */
+
   public static CloudConfig getCloudConfig(String zkAddress, String clusterName) {
+    return getCloudConfig(zkAddress, clusterName, null);
+  }
+  public static CloudConfig getCloudConfig(String zkAddress, String clusterName,
+      RealmAwareZkClient.RealmAwareZkConnectionConfig realmAwareZkConnectionConfig) {
     CloudConfig cloudConfig;
     RealmAwareZkClient dedicatedZkClient = null;
     try {
       if (Boolean.getBoolean(SystemPropertyKeys.MULTI_ZK_ENABLED) || zkAddress == null) {
         // If the multi ZK config is enabled or zkAddress is null, use realm-aware mode with
         // DedicatedZkClient
         try {
-          RealmAwareZkClient.RealmAwareZkConnectionConfig connectionConfig =
-              new RealmAwareZkClient.RealmAwareZkConnectionConfig.Builder()
-                  .setRealmMode(RealmAwareZkClient.RealmMode.SINGLE_REALM)
-                  .setZkRealmShardingKey("/" + clusterName).build();
+          if (realmAwareZkConnectionConfig == null) {

Review Comment:
   I don't think a user should be allowed to pass in the null at all. If they don't have a config, they should use 
   ```
   getCloudConfig(String zkAddress, String clusterName)
   ```
   which would create a default for them. 
   
   If they have a config, they should then call the new function, and they are responsible for having a correct config. 



-- 
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: reviews-unsubscribe@helix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [helix] xyuanlu commented on a diff in pull request #2099: Allow using passed in connection config when reading cloud config

Posted by GitBox <gi...@apache.org>.
xyuanlu commented on code in PR #2099:
URL: https://github.com/apache/helix/pull/2099#discussion_r873980336


##########
helix-core/src/test/java/org/apache/helix/integration/manager/ClusterControllerManager.java:
##########
@@ -37,6 +38,10 @@ public ClusterControllerManager(String zkAddr, String clusterName, String contro
     super(zkAddr, clusterName, controllerName, InstanceType.CONTROLLER);
   }
 
+  public ClusterControllerManager(String clusterName, HelixManagerProperty helixManagerProperty) {

Review Comment:
   Tests in TestMultiZkConectionConfig do not have zkRouting env config set up and we are building helixManagerProperty to connect to ZK. The connection will fail when failing to read the Routing ZK.
   
   ```
       RealmAwareZkClient.RealmAwareZkConnectionConfig.Builder connectionConfigBuilder =
           new RealmAwareZkClient.RealmAwareZkConnectionConfig.Builder();
       RealmAwareZkClient.RealmAwareZkConnectionConfig validZkConnectionConfig =
           connectionConfigBuilder
               .setRoutingDataSourceEndpoint(_msdsEndpoint + "," + ZK_PREFIX + ZK_START_PORT)
               .setRoutingDataSourceType(RoutingDataReaderType.HTTP_ZK_FALLBACK.name())
               .setZkRealmShardingKey("/" + clusterName).build();
       HelixManagerProperty.Builder propertyBuilder = new HelixManagerProperty.Builder()
   ```



-- 
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: reviews-unsubscribe@helix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [helix] xyuanlu commented on pull request #2099: Allow using passed in connection config when reading cloud config

Posted by GitBox <gi...@apache.org>.
xyuanlu commented on PR #2099:
URL: https://github.com/apache/helix/pull/2099#issuecomment-1138148742

   This change is ready to be merged, approved by @desaikomal //Thanks
   commit message:
   Allow using passed in connection config when reading cloud config


-- 
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: reviews-unsubscribe@helix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [helix] xyuanlu commented on a diff in pull request #2099: Allow using passed in connection config when reading cloud config

Posted by GitBox <gi...@apache.org>.
xyuanlu commented on code in PR #2099:
URL: https://github.com/apache/helix/pull/2099#discussion_r884072595


##########
helix-core/src/main/java/org/apache/helix/HelixPropertyFactory.java:
##########
@@ -80,20 +80,27 @@ public HelixManagerProperty getHelixManagerProperty(String zkAddress, String clu
    * @param clusterName
    * @return
    */
+
   public static CloudConfig getCloudConfig(String zkAddress, String clusterName) {
+    return getCloudConfig(zkAddress, clusterName, null);
+  }
+  public static CloudConfig getCloudConfig(String zkAddress, String clusterName,
+      RealmAwareZkClient.RealmAwareZkConnectionConfig realmAwareZkConnectionConfig) {
     CloudConfig cloudConfig;
     RealmAwareZkClient dedicatedZkClient = null;
     try {
       if (Boolean.getBoolean(SystemPropertyKeys.MULTI_ZK_ENABLED) || zkAddress == null) {
         // If the multi ZK config is enabled or zkAddress is null, use realm-aware mode with
         // DedicatedZkClient
         try {
-          RealmAwareZkClient.RealmAwareZkConnectionConfig connectionConfig =
-              new RealmAwareZkClient.RealmAwareZkConnectionConfig.Builder()
-                  .setRealmMode(RealmAwareZkClient.RealmMode.SINGLE_REALM)
-                  .setZkRealmShardingKey("/" + clusterName).build();
+          if (realmAwareZkConnectionConfig == null) {

Review Comment:
   TFTR. When we add an API to allow user to pass in `RealmAwareZkConnectionConfig` and when user pass in a null obj, shouldn't we create a default one instead of using the null?



-- 
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: reviews-unsubscribe@helix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [helix] xyuanlu commented on a diff in pull request #2099: Allow using passed in connection config when reading cloud config

Posted by GitBox <gi...@apache.org>.
xyuanlu commented on code in PR #2099:
URL: https://github.com/apache/helix/pull/2099#discussion_r873975459


##########
helix-core/src/main/java/org/apache/helix/HelixPropertyFactory.java:
##########
@@ -80,20 +80,23 @@ public HelixManagerProperty getHelixManagerProperty(String zkAddress, String clu
    * @param clusterName
    * @return
    */
-  public static CloudConfig getCloudConfig(String zkAddress, String clusterName) {
+  public static CloudConfig getCloudConfig(String zkAddress, String clusterName,
+      RealmAwareZkClient.RealmAwareZkConnectionConfig realmAwareZkConnectionConfig) {

Review Comment:
   TFTR.
   It is possible, if the needed zk routing data is not provided, it will fall back to reading system config.
   in RealAwareZkClient:
   ```
   static MetadataStoreRoutingData getMetadataStoreRoutingData(
         RealmAwareZkConnectionConfig connectionConfig) throws InvalidRoutingDataException {
       String routingDataSourceEndpoint = connectionConfig.getRoutingDataSourceEndpoint();
       if (routingDataSourceEndpoint == null || routingDataSourceEndpoint.isEmpty()) {
         // If endpoint is not given explicitly, use HTTP and the endpoint set in System Properties
         return RoutingDataManager.getInstance().getMetadataStoreRoutingData();
     }
   
   where in 
     public MetadataStoreRoutingData getMetadataStoreRoutingData() throws InvalidRoutingDataException {
       if (_defaultMsdsEndpoint == null || _defaultMsdsEndpoint.isEmpty()) {
         throw new IllegalStateException(
             "HttpRoutingDataReader was unable to find a valid MSDS endpoint String in System "
                 + "Properties!");
       }
       return getMetadataStoreRoutingData(RoutingDataReaderType.HTTP, _defaultMsdsEndpoint);
     }
   
   '''



-- 
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: reviews-unsubscribe@helix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [helix] xyuanlu commented on a diff in pull request #2099: Allow using passed in connection config when reading cloud config

Posted by GitBox <gi...@apache.org>.
xyuanlu commented on code in PR #2099:
URL: https://github.com/apache/helix/pull/2099#discussion_r884073083


##########
helix-core/src/test/java/org/apache/helix/integration/manager/ClusterControllerManager.java:
##########
@@ -37,6 +38,10 @@ public ClusterControllerManager(String zkAddr, String clusterName, String contro
     super(zkAddr, clusterName, controllerName, InstanceType.CONTROLLER);
   }
 
+  public ClusterControllerManager(String clusterName, HelixManagerProperty helixManagerProperty) {

Review Comment:
   We need this note even when the class is defined test module? I don't think this class has any non-test usage,



-- 
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: reviews-unsubscribe@helix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [helix] qqu0127 commented on a diff in pull request #2099: Allow using passed in connection config when reading cloud config

Posted by GitBox <gi...@apache.org>.
qqu0127 commented on code in PR #2099:
URL: https://github.com/apache/helix/pull/2099#discussion_r879905427


##########
helix-core/src/main/java/org/apache/helix/HelixPropertyFactory.java:
##########
@@ -80,20 +80,23 @@ public HelixManagerProperty getHelixManagerProperty(String zkAddress, String clu
    * @param clusterName
    * @return
    */
-  public static CloudConfig getCloudConfig(String zkAddress, String clusterName) {
+  public static CloudConfig getCloudConfig(String zkAddress, String clusterName,
+      RealmAwareZkClient.RealmAwareZkConnectionConfig realmAwareZkConnectionConfig) {

Review Comment:
   This is a public method, could we maintain the original interface while adding a new one?



-- 
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: reviews-unsubscribe@helix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [helix] NealSun96 commented on a diff in pull request #2099: Allow using passed in connection config when reading cloud config

Posted by GitBox <gi...@apache.org>.
NealSun96 commented on code in PR #2099:
URL: https://github.com/apache/helix/pull/2099#discussion_r883888493


##########
helix-core/src/test/java/org/apache/helix/integration/manager/ClusterControllerManager.java:
##########
@@ -37,6 +38,10 @@ public ClusterControllerManager(String zkAddr, String clusterName, String contro
     super(zkAddr, clusterName, controllerName, InstanceType.CONTROLLER);
   }
 
+  public ClusterControllerManager(String clusterName, HelixManagerProperty helixManagerProperty) {

Review Comment:
   If this is for testing purpose, can we add @VisibleForTest or another similar decorator? 



##########
helix-core/src/main/java/org/apache/helix/HelixPropertyFactory.java:
##########
@@ -80,20 +80,27 @@ public HelixManagerProperty getHelixManagerProperty(String zkAddress, String clu
    * @param clusterName
    * @return
    */
+
   public static CloudConfig getCloudConfig(String zkAddress, String clusterName) {
+    return getCloudConfig(zkAddress, clusterName, null);
+  }
+  public static CloudConfig getCloudConfig(String zkAddress, String clusterName,
+      RealmAwareZkClient.RealmAwareZkConnectionConfig realmAwareZkConnectionConfig) {
     CloudConfig cloudConfig;
     RealmAwareZkClient dedicatedZkClient = null;
     try {
       if (Boolean.getBoolean(SystemPropertyKeys.MULTI_ZK_ENABLED) || zkAddress == null) {
         // If the multi ZK config is enabled or zkAddress is null, use realm-aware mode with
         // DedicatedZkClient
         try {
-          RealmAwareZkClient.RealmAwareZkConnectionConfig connectionConfig =
-              new RealmAwareZkClient.RealmAwareZkConnectionConfig.Builder()
-                  .setRealmMode(RealmAwareZkClient.RealmMode.SINGLE_REALM)
-                  .setZkRealmShardingKey("/" + clusterName).build();
+          if (realmAwareZkConnectionConfig == null) {

Review Comment:
   I'm not sure if this is the right pattern. I would do
   ```
   public static CloudConfig getCloudConfig(String zkAddress, String clusterName) {
       realmAwareZkConnectionConfig =
                   new RealmAwareZkClient.RealmAwareZkConnectionConfig.Builder()
                       .setRealmMode(RealmAwareZkClient.RealmMode.SINGLE_REALM)
                       .setZkRealmShardingKey("/" + clusterName).build();
       return getCloudConfig(zkAddress, clusterName, realmAwareZkConnectionConfig);
     }
   ```
   Instead of a null check here. 



##########
helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixManager.java:
##########
@@ -282,7 +282,8 @@ public ZKHelixManager(String clusterName, String instanceName, InstanceType inst
     // read cloud config from ZK and set cloudConfig in HelixManagerProperty
     _helixManagerProperty = helixManagerProperty;
     _helixManagerProperty.getHelixCloudProperty().populateFieldsWithCloudConfig(
-        HelixPropertyFactory.getCloudConfig(_zkAddress, _clusterName));
+        HelixPropertyFactory.getCloudConfig(_zkAddress, _clusterName,
+            helixManagerProperty.getZkConnectionConfig()));

Review Comment:
   Question: could you remind me why we make the change in the first place?  What's in `helixManagerProperty.getZkConnectionConfig()`? 



-- 
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: reviews-unsubscribe@helix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [helix] desaikomal commented on a diff in pull request #2099: Allow using passed in connection config when reading cloud config

Posted by GitBox <gi...@apache.org>.
desaikomal commented on code in PR #2099:
URL: https://github.com/apache/helix/pull/2099#discussion_r873899781


##########
helix-core/src/test/java/org/apache/helix/integration/manager/ClusterControllerManager.java:
##########
@@ -37,6 +38,10 @@ public ClusterControllerManager(String zkAddr, String clusterName, String contro
     super(zkAddr, clusterName, controllerName, InstanceType.CONTROLLER);
   }
 
+  public ClusterControllerManager(String clusterName, HelixManagerProperty helixManagerProperty) {

Review Comment:
   I see that you added methods to handle the new additional parameter, but I don't see any tests to see whether we are using the helixManagerProperty values in the form of ASSERTs etc.
   
   Is there any actual test cases to test it?



##########
helix-core/src/main/java/org/apache/helix/HelixPropertyFactory.java:
##########
@@ -80,20 +80,23 @@ public HelixManagerProperty getHelixManagerProperty(String zkAddress, String clu
    * @param clusterName
    * @return
    */
-  public static CloudConfig getCloudConfig(String zkAddress, String clusterName) {
+  public static CloudConfig getCloudConfig(String zkAddress, String clusterName,
+      RealmAwareZkClient.RealmAwareZkConnectionConfig realmAwareZkConnectionConfig) {

Review Comment:
   Is there a possibility that the supplied realmAwareZkConnectionConfig doesn't have everything populated as the default builder?



-- 
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: reviews-unsubscribe@helix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [helix] xyuanlu commented on pull request #2099: Allow using passed in connection config when reading cloud config

Posted by GitBox <gi...@apache.org>.
xyuanlu commented on PR #2099:
URL: https://github.com/apache/helix/pull/2099#issuecomment-1145076836

   This change is ready to be merged, approved by @desaikomal @NealSun96 and @qqu0127  //Thanks
   
   Final commit message:
   
   **Allow using passed in connection config when reading cloud config**
   This change allow user to pass in zooScalability config and initiate zkHelixManager using the passed in config. We only read from env variable before this change.


-- 
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: reviews-unsubscribe@helix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [helix] xyuanlu commented on a diff in pull request #2099: Allow using passed in connection config when reading cloud config

Posted by GitBox <gi...@apache.org>.
xyuanlu commented on code in PR #2099:
URL: https://github.com/apache/helix/pull/2099#discussion_r886221579


##########
helix-core/src/main/java/org/apache/helix/HelixPropertyFactory.java:
##########
@@ -80,20 +80,27 @@ public HelixManagerProperty getHelixManagerProperty(String zkAddress, String clu
    * @param clusterName
    * @return
    */
+
   public static CloudConfig getCloudConfig(String zkAddress, String clusterName) {
+    return getCloudConfig(zkAddress, clusterName, null);
+  }
+  public static CloudConfig getCloudConfig(String zkAddress, String clusterName,
+      RealmAwareZkClient.RealmAwareZkConnectionConfig realmAwareZkConnectionConfig) {
     CloudConfig cloudConfig;
     RealmAwareZkClient dedicatedZkClient = null;
     try {
       if (Boolean.getBoolean(SystemPropertyKeys.MULTI_ZK_ENABLED) || zkAddress == null) {
         // If the multi ZK config is enabled or zkAddress is null, use realm-aware mode with
         // DedicatedZkClient
         try {
-          RealmAwareZkClient.RealmAwareZkConnectionConfig connectionConfig =
-              new RealmAwareZkClient.RealmAwareZkConnectionConfig.Builder()
-                  .setRealmMode(RealmAwareZkClient.RealmMode.SINGLE_REALM)
-                  .setZkRealmShardingKey("/" + clusterName).build();
+          if (realmAwareZkConnectionConfig == null) {

Review Comment:
   From our offline discussion, we only need to create a default RealmAwareZkConnectionConfig when it is in multi ZK mode. Do it this way will initiate a  RealmAwareZkConnectionConfig object regardless we are in multiZk or not.
   Let's keep the current approach.



##########
helix-core/src/main/java/org/apache/helix/HelixPropertyFactory.java:
##########
@@ -80,20 +80,27 @@ public HelixManagerProperty getHelixManagerProperty(String zkAddress, String clu
    * @param clusterName
    * @return
    */
+
   public static CloudConfig getCloudConfig(String zkAddress, String clusterName) {
+    return getCloudConfig(zkAddress, clusterName, null);
+  }
+  public static CloudConfig getCloudConfig(String zkAddress, String clusterName,
+      RealmAwareZkClient.RealmAwareZkConnectionConfig realmAwareZkConnectionConfig) {
     CloudConfig cloudConfig;
     RealmAwareZkClient dedicatedZkClient = null;
     try {
       if (Boolean.getBoolean(SystemPropertyKeys.MULTI_ZK_ENABLED) || zkAddress == null) {
         // If the multi ZK config is enabled or zkAddress is null, use realm-aware mode with
         // DedicatedZkClient
         try {
-          RealmAwareZkClient.RealmAwareZkConnectionConfig connectionConfig =
-              new RealmAwareZkClient.RealmAwareZkConnectionConfig.Builder()
-                  .setRealmMode(RealmAwareZkClient.RealmMode.SINGLE_REALM)
-                  .setZkRealmShardingKey("/" + clusterName).build();
+          if (realmAwareZkConnectionConfig == null) {

Review Comment:
   From our offline discussion, we only need to create a default RealmAwareZkConnectionConfig when it is in multi ZK mode. Do it this way will initiate a  RealmAwareZkConnectionConfig object regardless we are in multiZk or not.
   Let's keep the current approach.



-- 
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: reviews-unsubscribe@helix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [helix] xyuanlu commented on a diff in pull request #2099: Allow using passed in connection config when reading cloud config

Posted by GitBox <gi...@apache.org>.
xyuanlu commented on code in PR #2099:
URL: https://github.com/apache/helix/pull/2099#discussion_r880847277


##########
helix-core/src/main/java/org/apache/helix/HelixPropertyFactory.java:
##########
@@ -80,20 +80,23 @@ public HelixManagerProperty getHelixManagerProperty(String zkAddress, String clu
    * @param clusterName
    * @return
    */
-  public static CloudConfig getCloudConfig(String zkAddress, String clusterName) {
+  public static CloudConfig getCloudConfig(String zkAddress, String clusterName,
+      RealmAwareZkClient.RealmAwareZkConnectionConfig realmAwareZkConnectionConfig) {

Review Comment:
   Good point. Updated.



-- 
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: reviews-unsubscribe@helix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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