Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
edit typo in comment
Browse files Browse the repository at this point in the history
xyuanlu committed Dec 3, 2024
1 parent e338f3d commit bdfab05
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -656,7 +656,7 @@ public InstanceOperation getInstanceOperation() {
.build();
}

// if instance operation id DISABLE, we override it to ENABLE if instance is enabled
// 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
Original file line number Diff line number Diff line change
@@ -71,13 +71,14 @@ public void testSetInstanceEnableWithReason() {
.get(InstanceConfig.InstanceConfigProperty.HELIX_DISABLED_REASON.toString()), reasonCode);
Assert.assertEquals(instanceConfig.getInstanceDisabledReason(), reasonCode);
Assert.assertEquals(instanceConfig.getInstanceDisabledType(),
InstanceConstants.InstanceDisabledType.USER_OPERATION.toString());}
InstanceConstants.InstanceDisabledType.USER_OPERATION.toString());
}

@Test
public void testEnabledInstanceBackwardCompatibility() {
// if instance is disabled by instanceOperation, and enabled by HELIX_ENABLED, the instance should be enabled
InstanceConfig instanceConfig = new InstanceConfig.Builder().setInstanceOperation(InstanceConstants.InstanceOperation.DISABLE)
.build("id");
InstanceConfig instanceConfig =
new InstanceConfig.Builder().setInstanceOperation(InstanceConstants.InstanceOperation.DISABLE).build("id");
Assert.assertFalse(instanceConfig.getInstanceEnabled());
// assume an old version client enabled the instance by setting HELIX_ENABLED to true
instanceConfig.getRecord().setSimpleField(InstanceConfig.InstanceConfigProperty.HELIX_ENABLED.name(), "true");

0 comments on commit bdfab05

Please sign in to comment.