-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Do not lock on reads of XPackLicenseState #52492
Do not lock on reads of XPackLicenseState #52492
Conversation
Pinging @elastic/es-security (:Security/License) |
@jasontedor @jaymode - This back port required a number of additional changes, please someone review to spot check for errors. |
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.
LGTM
final OperationMode mode = status.mode; | ||
return mode != OperationMode.BASIC && mode != OperationMode.MISSING; | ||
}); | ||
|
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.
return currentStatus.active && isMachineLearningAllowedForOperationMode(currentStatus.mode); | ||
public boolean isMachineLearningAllowed() { | ||
return checkAgainstStatus(status -> status.active && isMachineLearningAllowedForOperationMode(status.mode)); | ||
|
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.
// Should work on all active licenses | ||
return localStatus.active; | ||
return checkAgainstStatus(status -> status.active); | ||
|
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.
mode == OperationMode.TRIAL || mode == OperationMode.BASIC; | ||
}); | ||
|
||
|
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.
mode == OperationMode.TRIAL || mode == OperationMode.BASIC; | ||
}); | ||
|
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.
@tbrooks8 I merged some change to this file in master and your one was on top it. But I haven’t backported my changes yet. The PR #52115 is ready, but my intentions was to bundle the it with a few more refactoring. Not sure if you had to solve many conflicts with your backporting. I wonder whether it would be better to have my backport go through first to maintain consistency with original work? |
@ywangd - I will wait until you merge. |
Thanks. I'll get it sorted out asap |
@tbrooks8 I have merged my backport. Thanks a lot for coordinating on this. |
@tbrooks8 Merge of #52115 caused some code conflicts for your PR. I am happy to assist in resovling them. Please let me know how I can help. Thanks. |
XPackLicenseState reads to necessary to validate a number of cluster operations. This reads occasionally occur on transport threads which should not be blocked. Currently we sychronize when reading. However, this is unecessary as only a single piece of state is updateable. This commit makes this state volatile and removes the locking.
63d87a8
to
48ee863
Compare
@ywangd I just cherry-picked from master again and it was clean this time. |
XPackLicenseState reads to necessary to validate a number of cluster
operations. This reads occasionally occur on transport threads which
should not be blocked. Currently we sychronize when reading. However,
this is unecessary as only a single piece of state is updateable. This
commit makes this state volatile and removes the locking.