Optimized string matching for RoleBasedActionPrivileges#5988
Open
nibix wants to merge 7 commits intoopensearch-project:mainfrom
Open
Optimized string matching for RoleBasedActionPrivileges#5988nibix wants to merge 7 commits intoopensearch-project:mainfrom
nibix wants to merge 7 commits intoopensearch-project:mainfrom
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #5988 +/- ##
==========================================
+ Coverage 73.81% 73.85% +0.04%
==========================================
Files 439 440 +1
Lines 27122 27218 +96
Branches 4025 4038 +13
==========================================
+ Hits 20020 20102 +82
- Misses 5194 5205 +11
- Partials 1908 1911 +3
🚀 New features to boost your workflow:
|
807c500 to
031ab78
Compare
Collaborator
Author
|
There seem to be test issues, taking back to draft |
nibix
commented
Mar 13, 2026
| PutMappingAction.NAME, | ||
| AutoPutMappingAction.NAME, | ||
| AnalyzeAction.NAME, | ||
| AutoCreateAction.NAME, |
Collaborator
Author
There was a problem hiding this comment.
As an additional optimization, I have removed a few action names from the list of actions for which the denormalized data structures are created.
Reasoning:
- AutoCreate, AutoPut are likely never used because they work on non-existing indices. However the denormalized data structures by principle can only be created for existing indices
- Analyze, PutMapping: This is maybe too seldomly used to justify the overhead
Signed-off-by: Nils Bandener <nils.bandener@eliatra.com>
Signed-off-by: Nils Bandener <nils.bandener@eliatra.com>
deb8d8d to
8bc5d1b
Compare
Signed-off-by: Nils Bandener <nils.bandener@eliatra.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #5998
This PR provides two optimizations:
RoleBasedActionPrivilegesandAbstractRuleBasedPrivilegesinto a new classCompiledRoles. This will guarantee that each index pattern and static DLS query is only compiled once even if it is later used in different components (e.g. stateful vs non-stateful classes or index privileges vs DLS) and for different indices.IndexPatternclass is extended to provide optimized matching for prefix type index patterns (likeindex_*) and for exact index patterns (likeindex_a). For prefix type index patterns, we leverage the fact that the cluster state contains aTreeSetof all indices, aliases and data streams. Performing a prefix pattern match is then only a O(log n) operation, while it was an O(n) operation before.These optimizations reduces the runtime of stateful index privileges in one micro benchmark test case by a factor of about 0.46.
Before:
After:
Testing
Check List
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.