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/06/01 00:07:16 UTC

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

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