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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]