Skip to content

Commit

Permalink
fix enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
xyuanlu committed Nov 26, 2024
1 parent d8366de commit a32de52
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,17 @@ public InstanceOperation getInstanceOperation() {
.build();
}

// if instance operation id DISABLE, we override it to ENABLE if instance is enabled
if (activeInstanceOperation.equals(InstanceConstants.InstanceOperation.DISABLE)) {
// it is not likely that instanceEnabled is unset, because when we set operation to disable,
// we always set instanceEnabled 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();
}
}

return activeInstanceOperation;
}

Expand Down

0 comments on commit a32de52

Please sign in to comment.