zpinto commented on code in PR #2598:
URL: https://github.com/apache/helix/pull/2598#discussion_r1298056771
##########
helix-core/src/main/java/org/apache/helix/model/InstanceConfig.java:
##########
@@ -331,10 +344,15 @@ public long getInstanceEnabledTime() {
}
public void setInstanceOperation(InstanceConstants.InstanceOperation
operation) {
- // TODO: also setInstanceEnabled after sanity check.
+ if (operation != InstanceConstants.InstanceOperation.DISABLE
+ && operation != InstanceConstants.InstanceOperation.ENABLE &&
!getInstanceEnabled()) {
+ throw new HelixException(
+ "setting non enable/disable operation (e.g. evacuate, swap) to helix
disabled instance is not allowed");
+ } else {
+ setInstanceEnabledHelper(operation ==
InstanceConstants.InstanceOperation.ENABLE);
Review Comment:
This will set HELIX_ENABLED to false for
`InstanceConstants.InstanceOperation.EVACUATE` and other operation types when
HELIX_ENABLED is true. This should only be called if operation is `ENABLE` or
`DISABLE` because HELIX_ENABLED should stay true when we persist `EVACUATE` or
other operation.
--
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]