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



##########
File path: 
helix-rest/src/main/java/org/apache/helix/rest/server/resources/helix/PerInstanceAccessor.java
##########
@@ -310,20 +311,34 @@ public Response 
updateInstanceConfig(@PathParam("clusterId") String clusterId,
     }
     InstanceConfig instanceConfig = new InstanceConfig(record);
     ConfigAccessor configAccessor = getConfigAccessor();
+
     try {
       switch (command) {
-      case update:
-        configAccessor.updateInstanceConfig(clusterId, instanceName, 
instanceConfig);
-        break;
-      case delete:
-        HelixConfigScope instanceScope =
-            new 
HelixConfigScopeBuilder(HelixConfigScope.ConfigScopeProperty.PARTICIPANT)
-                .forCluster(clusterId).forParticipant(instanceName).build();
-        configAccessor.remove(instanceScope, record);
-        break;
-      default:
-        return badRequest(String.format("Unsupported command: %s", command));
+        case update:
+          /*
+           * The new instanceConfig will be merged with existing one.
+           * Even if the instance is disabled, non-valid instance topology 
config will cause rebalance
+           * failure. We are doing the check whenever user updates 
InstanceConfig.
+           */
+          validateDeltaTopologySettingInInstanceConfig(clusterId, 
instanceName, configAccessor,
+              instanceConfig, command);
+          configAccessor.updateInstanceConfig(clusterId, instanceName, 
instanceConfig);
+          break;
+        case delete:
+          validateDeltaTopologySettingInInstanceConfig(clusterId, 
instanceName, configAccessor,

Review comment:
       validateDeltaTopologySettingInInstanceConfig will throw exception if the 
input is not valid. So If I understand it correctly, no need to have a if 
statement here. Maybe a comment is needed to avoid confusion? 




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