zhangmeng916 commented on a change in pull request #1129:
URL: https://github.com/apache/helix/pull/1129#discussion_r467644218
##########
File path:
helix-core/src/main/java/org/apache/helix/manager/zk/ParticipantManager.java
##########
@@ -187,25 +187,31 @@ private void joinCluster() {
LOG.info("auto registration is false for cluster" + _clusterName);
}
+ InstanceConfig instanceConfig;
if (!ZKUtil.isInstanceSetup(_zkclient, _clusterName, _instanceName,
_instanceType)) {
if (!autoJoin) {
throw new HelixException("Initial cluster structure is not set up for
instance: "
+ _instanceName + ", instanceType: " + _instanceType);
+ }
+ if (!autoRegistration) {
+ LOG.info(_instanceName + " is auto-joining cluster: " + _clusterName);
+ instanceConfig = HelixUtil.composeInstanceConfig(_instanceName);
} else {
- if (!autoRegistration) {
- LOG.info(_instanceName + " is auto-joining cluster: " +
_clusterName);
- _helixAdmin.addInstance(_clusterName,
HelixUtil.composeInstanceConfig(_instanceName));
- } else {
- LOG.info(_instanceName + " is auto-registering cluster: " +
_clusterName);
- CloudInstanceInformation cloudInstanceInformation =
getCloudInstanceInformation();
- String domain = cloudInstanceInformation
-
.get(CloudInstanceInformation.CloudInstanceField.FAULT_DOMAIN.name()) +
_instanceName;
-
- InstanceConfig instanceConfig =
HelixUtil.composeInstanceConfig(_instanceName);
- instanceConfig.setDomain(domain);
- _helixAdmin.addInstance(_clusterName, instanceConfig);
- }
+ LOG.info(_instanceName + " is auto-registering cluster: " +
_clusterName);
+ CloudInstanceInformation cloudInstanceInformation =
getCloudInstanceInformation();
+ String domain = cloudInstanceInformation
+
.get(CloudInstanceInformation.CloudInstanceField.FAULT_DOMAIN.name()) +
_instanceName;
+ instanceConfig = HelixUtil.composeInstanceConfig(_instanceName);
+ instanceConfig.setDomain(domain);
}
+ instanceConfig
+
.validateTopologySettingInInstanceConfig(_configAccessor.getClusterConfig(_clusterName),
Review comment:
If the autoRegistration is false, but the autoJoin is true, then the
instance config will be populated without zone information. In this case, will
the validation fail? If it fails, meaning that we don't allow customers to use
autoJoin if it's rack aware. Just make sure this is the behavior you want.
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]