Resolve the role query and the number of docs lazily#48036
Merged
jimczi merged 4 commits intoelastic:masterfrom Oct 25, 2019
Merged
Resolve the role query and the number of docs lazily#48036jimczi merged 4 commits intoelastic:masterfrom
jimczi merged 4 commits intoelastic:masterfrom
Conversation
This commit ensures that the creation of a DocumentSubsetReader does not eagerly resolve the role query and the number of docs that match. We want to delay this expensive operation in order to ensure that we really need this information when we build it. For this reason the role query and the number of docs are now resolved on demand. This commit also depends on https://issues.apache.org/jira/browse/LUCENE-9003 that will also compute the global number of docs lazily.
Collaborator
|
Pinging @elastic/es-security (:Security/Authorization) |
jpountz
suggested changes
Oct 17, 2019
| private final int numDocs; | ||
| private final DocumentSubsetBitsetCache bitsetCache; | ||
| private final Query roleQuery; | ||
| private BitSet roleQueryBits; |
Contributor
There was a problem hiding this comment.
does this one need to be volatile too?
Contributor
Author
There was a problem hiding this comment.
I thought it wouldn't be needed since we access the variable after the synchronized block ?
Contributor
There was a problem hiding this comment.
What about access from getLiveDocs?
Contributor
Author
There was a problem hiding this comment.
We discussed offline and I added a comment in the code to explain why this is not needed (happens-before):
9e98a69
jpountz
approved these changes
Oct 24, 2019
jimczi
added a commit
that referenced
this pull request
Oct 25, 2019
This commit ensures that the creation of a DocumentSubsetReader does not eagerly resolve the role query and the number of docs that match. We want to delay this expensive operation in order to ensure that we really need this information when we build it. For this reason the role query and the number of docs are now resolved on demand. This commit also depends on https://issues.apache.org/jira/browse/LUCENE-9003 that will also compute the global number of docs lazily.
This was referenced Feb 3, 2020
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.
This commit ensures that the creation of a DocumentSubsetReader does not
eagerly resolve the role query and the number of docs that match.
We want to delay this expensive operation in order to ensure that we really
need this information when we build it. For this reason the role query and the
number of docs are now resolved on demand. This commit also depends on
https://issues.apache.org/jira/browse/LUCENE-9003 that will also compute the global
number of docs lazily.