xyuanlu commented on a change in pull request #1129:
URL: https://github.com/apache/helix/pull/1129#discussion_r468237985



##########
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:
       Thanks for the update Meng. I would like to add a point. 
   I think if the autoRegistration is false, we only support Instance autoJoin 
if cluster level topology aware rebalance is set up false. If the cluster level 
topology aware is not false, then the following validation will fail (and vice 
versa). 




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

Reply via email to