-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Add result level caching to Brokers #5028
Merged
Merged
Changes from all commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
ba78816
Add result level caching to Brokers
7cb33cd
Minor doc changes
83ee76e
Simplify sequences
24a7595
Move etag execution
d2861b9
Merge branch 'master' of https://github.com/druid-io/druid into resul…
130ee63
Modify cacheLimit criteria
efeb2b2
Fix incorrect etag computation
08b4feb
Fix docs
3639c0a
Merge branch 'master' of https://github.com/druid-io/druid into resul…
e1d9175
Merge branch 'master' of https://github.com/druid-io/druid into resul…
c805b92
Add separate query runner for result level caching
d81d81c
Update docs
d738fbc
Merge branch 'master' of https://github.com/druid-io/druid into resul…
7e3492c
Merge branch 'master' of https://github.com/druid-io/druid into resul…
fc69327
Add post aggregated results to result level cache
0d409ea
Fix indents
04878cd
Merge branch 'master' of https://github.com/druid-io/druid into resul…
ead2dd9
Check byte size for exceeding cache limit
cb12828
Merge branch 'master' of https://github.com/druid-io/druid into resul…
8abf5ac
Fix indents
d00bb28
Fix indents
6bd296f
Merge branch 'master' of https://github.com/druid-io/druid into resul…
53e8056
Add flag for result caching
d4b823d
Remove logs
6586b5c
Merge branch 'master' of https://github.com/druid-io/druid into resul…
cb107f9
Make cache object generation synchronous
8dd436d
Merge branch 'master' of https://github.com/druid-io/druid into resul…
34d0128
Avoid saving intermediate cache results to list
07eb46d
Merge branch 'master' of https://github.com/druid-io/druid into resul…
9d05221
Merge branch 'master' of https://github.com/druid-io/druid into resul…
5a9dc8c
Merge branch 'master' of https://github.com/druid-io/druid into resul…
46da9e5
Fix changes that handle etag based response
bcddabf
Release bytestream after use
6c42e2c
Address PR comments
d51c21e
Discard resultcache stream after use
b8547bb
Merge branch 'master' of https://github.com/druid-io/druid into resul…
96bbf23
Fix docs
28a7a0e
Merge branch 'master' of https://github.com/druid-io/druid into resul…
9dec1cd
Address comments
b5b7992
Merge branch 'master' of https://github.com/druid-io/druid into resul…
edd79c0
Merge branch 'master' of https://github.com/druid-io/druid into resul…
7f2d48d
Add comment about fluent workflow issue
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,6 +50,7 @@ | |
import io.druid.query.aggregation.AggregatorFactory; | ||
import io.druid.query.aggregation.MetricManipulationFn; | ||
import io.druid.query.aggregation.MetricManipulatorFns; | ||
import io.druid.query.aggregation.PostAggregator; | ||
import io.druid.query.cache.CacheKeyBuilder; | ||
import io.druid.query.dimension.DefaultDimensionSpec; | ||
import io.druid.query.dimension.DimensionSpec; | ||
|
@@ -408,7 +409,7 @@ public TypeReference<Object> getCacheObjectClazz() | |
} | ||
|
||
@Override | ||
public Function<Row, Object> prepareForCache() | ||
public Function<Row, Object> prepareForCache(boolean isResultLevelCache) | ||
{ | ||
return new Function<Row, Object>() | ||
{ | ||
|
@@ -426,6 +427,11 @@ public Object apply(Row input) | |
for (AggregatorFactory agg : aggs) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
a few lines above is not updated wrt getPostAggregatorSpecs. Similar problems in other classes, updated in this PR. Also I noticed that somewhere this sizing was buggy before this PR already. |
||
retVal.add(event.get(agg.getName())); | ||
} | ||
if (isResultLevelCache) { | ||
for (PostAggregator postAgg : query.getPostAggregatorSpecs()) { | ||
retVal.add(event.get(postAgg.getName())); | ||
} | ||
} | ||
return retVal; | ||
} | ||
|
||
|
@@ -435,7 +441,7 @@ public Object apply(Row input) | |
} | ||
|
||
@Override | ||
public Function<Object, Row> pullFromCache() | ||
public Function<Object, Row> pullFromCache(boolean isResultLevelCache) | ||
{ | ||
return new Function<Object, Row>() | ||
{ | ||
|
@@ -460,7 +466,12 @@ public Row apply(Object input) | |
final AggregatorFactory factory = aggsIter.next(); | ||
event.put(factory.getName(), factory.deserialize(results.next())); | ||
} | ||
|
||
if (isResultLevelCache) { | ||
Iterator<PostAggregator> postItr = query.getPostAggregatorSpecs().iterator(); | ||
while (postItr.hasNext() && results.hasNext()) { | ||
event.put(postItr.next().getName(), results.next()); | ||
} | ||
} | ||
if (dimsIter.hasNext() || aggsIter.hasNext() || results.hasNext()) { | ||
throw new ISE( | ||
"Found left over objects while reading from cache!! dimsIter[%s] aggsIter[%s] results[%s]", | ||
|
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
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
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
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
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
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
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
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
Oops, something went wrong.
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.
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.
New feature should start off disabled
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.
Would it be sufficient to keep it disabled via the populateResultCache parameter?
ba78816#diff-661a9dbd25633c651845a9ecab0ddbaaR44
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.
It is confusing to have default here be
true
but the default inCacheConfig
be false. But this just follows the convention of the prior caching settings.Can you add a comment in
CacheConfig
that the defaults as stated inQueryContexts
are different due to legacy reasons, and should probably be made the same at some point in the future?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.
Added comment as suggested.