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



##########
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:
       Discussed offline. This validation here means that we won't support a 
customer to use zone based topology and "auto join" function (no auto 
registration) at the same time. Participant will terminate in this case. This 
is different from current requirement, but logically correct.




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