-
Notifications
You must be signed in to change notification settings - Fork 74
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
Use pluginSubject for system index interaction and remove usages of stashContext #714
base: main
Are you sure you want to change the base?
Use pluginSubject for system index interaction and remove usages of stashContext #714
Conversation
…tashContext Signed-off-by: Craig Perkins <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #714 +/- ##
============================================
- Coverage 37.67% 36.63% -1.05%
+ Complexity 135 133 -2
============================================
Files 22 23 +1
Lines 1189 1212 +23
Branches 109 109
============================================
- Hits 448 444 -4
- Misses 704 731 +27
Partials 37 37 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Craig Perkins <[email protected]>
final IndexRequest request = new IndexRequest(LOCK_INDEX_NAME).id(tempLock.getLockId()) | ||
.source(tempLock.toXContent(XContentFactory.jsonBuilder(), ToXContent.EMPTY_PARAMS)) | ||
.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE) |
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.
Not sure why this is necessary here just yet.
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.
This is needed to resolve a race condition discovered in GetLockMultiNodeRestIT.testGetLockRestAPI. This test will create and release a lock 10 times in a loop. Without adding this RefreshPolicy, when the security plugin is installed it can fail to find the lock the was just created. By setting this RefreshPolicy to IMMEDIATE, we can guarantee that this newly created document is available for search (including GET actions)
Description
This PR removes direct usages of ThreadContext.stashContext and implements a new extension point in core (IdentityAwarePlugin) which assigns this plugin a subject to use for the purposes of executing transport actions outside of the authenticated user context.
With this subject, job-scheduler is permitted to access its own system indices without having to use
ThreadContext.stashContext
explicitly.Related Issues
Resolves opensearch-project/opensearch-plugins#238
Check List
--signoff
.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.