Skip to content

Disable caching on brokers for groupBy v2#3950

Merged
fjy merged 3 commits intoapache:masterfrom
jihoonson:disable-cache-for-groupby-v2
Feb 21, 2017
Merged

Disable caching on brokers for groupBy v2#3950
fjy merged 3 commits intoapache:masterfrom
jihoonson:disable-cache-for-groupby-v2

Conversation

@jihoonson
Copy link
Copy Markdown
Contributor

@jihoonson jihoonson commented Feb 17, 2017

This PR fixes #3820.


This change is Reviewable

@fjy
Copy link
Copy Markdown
Contributor

fjy commented Feb 17, 2017

👍

this.backgroundExecutorService = MoreExecutors.listeningDecorator(backgroundExecutorService);

if (cacheConfig.isQueryCacheable(Query.GROUP_BY)) {
log.warn("Caching for groupBys is enabled, but they won't be cached if they are executed with the strategy v2!");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you also clarify that they won't be cached on druid brokers also an advise to enable caching on data nodes for V2 strategy would be helpful.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about this wording:

"Even though groupBy caching is enabled, v2 groupBys will not be cached. Consider disabling cache on your broker and enabling it on your data nodes to enable v2 groupBy caching."

@nishantmonu51 nishantmonu51 added this to the 0.10.0 milestone Feb 17, 2017
@nishantmonu51
Copy link
Copy Markdown
Member

@jihoonson: left a minor comment about log message, LGTM otherwise.

Copy link
Copy Markdown
Contributor

@gianm gianm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some suggested restructuring -- looks good in general though

this.backgroundExecutorService = MoreExecutors.listeningDecorator(backgroundExecutorService);

if (cacheConfig.isQueryCacheable(Query.GROUP_BY)) {
log.warn("Caching for groupBys is enabled, but they won't be cached if they are executed with the strategy v2!");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about this wording:

"Even though groupBy caching is enabled, v2 groupBys will not be cached. Consider disabling cache on your broker and enabling it on your data nodes to enable v2 groupBy caching."

* The {@code willMergeRunners} parameter can be used for distinguishing the caller is a broker or a data node.
*
* @param query the query to be cached
* @param willMergeRunners indicates that {@link QueryRunnerFactory#mergeRunners(ExecutorService, Iterable)} will be
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For clarification add, "will be called on the cached by-segment results"

@Override
public boolean isCacheable(GroupByQuery query, boolean willMergeRunners)
{
return willMergeRunners || !strategySelector.useStrategyV2(query);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, this should be part of the strategy, since that's the point of the strategies. So the code could be:

return strategySelector.strategize(query).isCacheable(willMergeRunners);

Along with an "isCacheable" method added to the strategies.

@jihoonson
Copy link
Copy Markdown
Contributor Author

@nishantmonu51 and @gianm thanks for your review. I addressed comments.

Copy link
Copy Markdown
Contributor

@gianm gianm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

groupBy v2: Results not fully merged when caching is enabled on the broker

4 participants