-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix is Instance enabled #2972
Fix is Instance enabled #2972
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -642,8 +642,8 @@ public InstanceOperation getInstanceOperation() { | |
.build(); | ||
} | ||
|
||
// Always respect the HELIX_ENABLED being set to false when instance operation is unset | ||
// for backwards compatibility. | ||
// if instance operation is not DISABLED, we always respect the HELIX_ENABLED being set to false | ||
// when instance operation is unset for backwards compatibility. | ||
if (!_record.getBooleanField(InstanceConfigProperty.HELIX_ENABLED.name(), | ||
HELIX_ENABLED_DEFAULT_VALUE) | ||
&& (InstanceConstants.INSTANCE_DISABLED_OVERRIDABLE_OPERATIONS.contains( | ||
|
@@ -656,6 +656,17 @@ public InstanceOperation getInstanceOperation() { | |
.build(); | ||
} | ||
|
||
// if instance operation id DISABLE, we override it to ENABLE if instance is enabled | ||
if (activeInstanceOperation.getOperation().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(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shall we write it back? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it might be dangerous to write back as client may update the config while we write back. It could overwrite the current value. (Unlike the batch enable/disable one as that field is deprecated and we just need to clean it out) Since the getter will use the |
||
} | ||
} | ||
|
||
return activeInstanceOperation; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please clarify the comments? Does 'InstanceEnabled' refer to 'HELIX_ENABLED'?