xyuanlu commented on code in PR #2598:
URL: https://github.com/apache/helix/pull/2598#discussion_r1296648609


##########
helix-core/src/main/java/org/apache/helix/model/InstanceConfig.java:
##########
@@ -264,9 +264,22 @@ public boolean getInstanceEnabled() {
    * @param enabled true to enable, false to disable
    */
   public void setInstanceEnabled(boolean enabled) {
+    // set instance operation only when we need to change InstanceEnabled 
value.
+    // When enabling an instance where HELIX_ENABLED is false, we update 
INSTANCE_OPERATION to 'ENABLE'
+    // When disabling and instance where HELIX_ENABLED is false, we overwrite 
what current operation and
+    // update INSTANCE_OPERATION to 'DISABLE'.
+    String instanceOperationKey = 
InstanceConfigProperty.INSTANCE_OPERATION.toString();
+    if (enabled != getInstanceEnabled() && 
_record.getSimpleField(instanceOperationKey) != null) {
+      _record.setSimpleField(instanceOperationKey,
+          enabled ? InstanceConstants.InstanceOperation.ENABLE.toString()

Review Comment:
   Updated
   



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

Reply via email to