-
Notifications
You must be signed in to change notification settings - Fork 113
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
indexer: introduce LookupCtx #3043
Merged
Merged
Conversation
This file contains 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
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> lint Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> add changelog Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
butonic
commented
Jul 7, 2022
Comment on lines
-169
to
+176
for _, field := range queryFields { | ||
for _, idx := range fields.IndicesByField[strcase.ToCamel(field.Name)] { | ||
res, err := idx.Lookup(field.Value) | ||
for fieldName, queryFields := range groupFieldsByName(queryFields) { | ||
idxes := fields.IndicesByField[strcase.ToCamel(fieldName)] | ||
values := make([]string, 0, len(queryFields)) | ||
for _, f := range queryFields { | ||
values = append(values, f.Value) | ||
} | ||
for _, idx := range idxes { | ||
res, err := idx.LookupCtx(context.Background(), values...) |
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.
here we no longer make one Lookup call per queryField but instead aggregate by field name and then use the new LookupCtx to fetch all results at once.
I introduced the context because we want to be able to pass the trace context into the index as well ...
butonic
requested review from
a team,
labkode,
ishank011 and
glpatcern
as code owners
July 7, 2022 15:04
C0rby
suggested changes
Jul 7, 2022
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
C0rby
reviewed
Jul 7, 2022
Co-authored-by: David Christofas <dchristofas@posteo.de>
C0rby
approved these changes
Jul 8, 2022
butonic
force-pushed
the
lookupctx
branch
2 times, most recently
from
July 8, 2022 13:39
14fe7d2
to
b183d96
Compare
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
kobergj
pushed a commit
to kobergj/reva
that referenced
this pull request
Jul 11, 2022
* indexer: introduce LookupCtx Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> lint Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> add changelog Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * use sets instead af arrays Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * Update pkg/storage/utils/indexer/index/autoincrement.go Co-authored-by: David Christofas <dchristofas@posteo.de> * fix logic Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * ignore result order Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> Co-authored-by: David Christofas <dchristofas@posteo.de>
36 tasks
Merged
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.
The index interface now has a new LookupCtx that can look up multiple values so we can more efficiently look up multiple shares by id. It also takes a context so we can pass on the trace context to the CS3 backend