Skip to content
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

force eager the processing of segment metadata query on the processing executor #1172

Merged
merged 1 commit into from
Mar 12, 2015

Conversation

himanshug
Copy link
Contributor

This makes sure that, irrespective of the behavior of input query runners, query runner returned by mergeRunners returns a query runner which ensures that processing really happens inside the threadpool of processor executor service instead of jetty threads which is what was intended probably.

@@ -146,7 +147,9 @@ public SegmentMetadataQueryRunnerFactory(
@Override
public Sequence<SegmentAnalysis> call() throws Exception
{
return input.run(query, responseContext);
Copy link
Member

Choose a reason for hiding this comment

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

for other query types, ChainedExecutionQueryRunner takes care this by materializing the result, can we use that here also ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nishantmonu51 ChainedExecutionQueryRunner seems to be doing same. see here
https://github.com/druid-io/druid/blob/master/processing/src/main/java/io/druid/query/ChainedExecutionQueryRunner.java#L130

pls let me know if you're suggesting something different?

Copy link
Member

Choose a reason for hiding this comment

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

i meant instead of duplicating the code for materializing the result at multiple places, can we reuse the ChainedExecutionQueryRunner here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nishantmonu51 that might be a good idea, I will see if we can use ChainedExecutionQueryRunner here as well.

@drcrallen
Copy link
Contributor

Why is eager processing needed for segment metadata queries?

@drcrallen
Copy link
Contributor

wait nvmnd, I'm reading the original commit message clearer now.. query runners

@drcrallen
Copy link
Contributor

A larger question is, why is the jetty thread doing the materialization here but not elsewhere? (I haven't looked much into this codeline before)

@himanshug
Copy link
Contributor Author

@drcrallen most of them seems to be using ChainedExecutionQueryRunner which does the eager materialization.
GroupByQueryRunnerFactory does a input.run(..).accumulate(..) which would do the materialization.

@drcrallen
Copy link
Contributor

@himanshug Thanks, in that case I agree with @nishantmonu51 that we should try to keep the methodology consistent for materialization (i.e. use ChainedExecutionQueryRunner) if possible.

…g threadpool by using ChainedExecutionQueryRunner in SegmentMetadataQueryRunnerFactory.mergeRunners(..)
@himanshug
Copy link
Contributor Author

@drcrallen @nishantmonu51 switched to using chained query execution runner

@drcrallen
Copy link
Contributor

Holy crap that's much cleaner.

@himanshug
Copy link
Contributor Author

closeing/reopening to restart the failed build.

@himanshug himanshug closed this Mar 12, 2015
@himanshug himanshug reopened this Mar 12, 2015
@xvrl
Copy link
Member

xvrl commented Mar 12, 2015

+1

xvrl added a commit that referenced this pull request Mar 12, 2015
force eager the processing of segment metadata query on the processing executor
@xvrl xvrl merged commit 127b6fd into apache:master Mar 12, 2015
@xvrl xvrl modified the milestone: 0.7.1 Mar 13, 2015
@himanshug himanshug deleted the segment_metadata_eager branch May 16, 2015 22:42
@nishantmonu51
Copy link
Member

this is causing ITTwitterQueryTest in integration-tests to fail with ClassCastException while fetching bySegmentResults on historical nodes with ClassCastException.

@nishantmonu51
Copy link
Member

@himanshug it fails when we issue the SegmentMetadataQuery by setting {"bySegment" : true} in context with exception -
java.lang.ClassCastException: io.druid.query.Result cannot be cast to io.druid.query.metadata.metadata.SegmentAnalysis
at io.druid.query.metadata.SegmentMetadataQueryQueryToolChest$4.compare(SegmentMetadataQueryQueryToolChest.java:222) ~[druid-processing-0.7.3-SNAPSHOT.jar:0.7.3-SNAPSHOT]
at com.google.common.collect.NullsFirstOrdering.compare(NullsFirstOrdering.java:44) ~[guava-16.0.1.jar:?]
at com.metamx.common.guava.MergeIterator$1.compare(MergeIterator.java:46) ~[java-util-0.27.0.jar:?]
at com.metamx.common.guava.MergeIterator$1.compare(MergeIterator.java:42) ~[java-util-0.27.0.jar:?]
at java.util.PriorityQueue.siftUpUsingComparator(PriorityQueue.java:649) ~[?:1.7.0_80]

can you have a look at the changes again ?

@himanshug
Copy link
Contributor Author

@nishantmonu51 this code was added before 0.7.1.1, did we run integration tests back then and they passed or did we not run the tests at that time or is this a nwe test? just trying to understand what changed.

@nishantmonu51
Copy link
Member

probably dint ran integration tests then, reverting the changes in this PR makes the test pass.

@himanshug
Copy link
Contributor Author

I am checking

@himanshug
Copy link
Contributor Author

caught up into something else, will look at it in 1-2 hrs. let me know if it is blocking u guys or something

@himanshug
Copy link
Contributor Author

@nishantmonu51 turns out switching to use ChainedExecutionQueryRunner doesn't seem to be working well for SegmentMetadata queries :(
It works for TopN bcoz result type of TopN queries is "Result" which is same as BySegmentQueryRunner, same does not hold true for GroupBy queries and that also did not use ChainedExecutionQueryRunner
Reverting the use of ChainedExecutionQueryRunner here fixes the issue.

xvrl added a commit that referenced this pull request May 22, 2015
seoeun25 pushed a commit to seoeun25/incubator-druid that referenced this pull request Jan 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants