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


##########
helix-core/src/main/java/org/apache/helix/model/InstanceConfig.java:
##########
@@ -656,6 +656,17 @@ public InstanceOperation getInstanceOperation() {
           .build();
     }
 
+    // if instance operation is DISABLE, we override it to ENABLE if 
HELIX_ENABLED set to true
+    if (activeInstanceOperation.getOperation() == 
InstanceConstants.InstanceOperation.DISABLE) {
+      // it is not likely that HELIX_ENABLED is unset, because when we set 
operation to disable,
+      // we always set HELIX_ENABLED to false
+      // If instance is enabled by old version helix (not having instance 
operation), the instance config
+      // will have HELIX_ENABLED set to true. In this case, we should override 
the instance operation to ENABLE
+      if 
("true".equals(_record.getSimpleField(InstanceConfigProperty.HELIX_ENABLED.name())))
 {
+        return new 
InstanceOperation.Builder().setOperation(InstanceConstants.InstanceOperation.ENABLE).build();

Review Comment:
   good point. But it is a bit hard to write back. We do not have access to ZK 
client or data accessor here. It adds too much complexity. As long as all 
new/old reader honor the `HELIX_ENABLED ` then I think we are good.



-- 
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: reviews-unsubscr...@helix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@helix.apache.org
For additional commands, e-mail: reviews-h...@helix.apache.org

Reply via email to