Skip to content

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

Merged
xvrl merged 1 commit into
apache:masterfrom
himanshug:segment_metadata_eager
Mar 12, 2015
Merged

force eager the processing of segment metadata query on the processing executor#1172
xvrl merged 1 commit into
apache:masterfrom
himanshug:segment_metadata_eager

Conversation

@himanshug
Copy link
Copy Markdown
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.

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.

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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

Why is eager processing needed for segment metadata queries?

@drcrallen
Copy link
Copy Markdown
Contributor

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

@drcrallen
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

@himanshug himanshug force-pushed the segment_metadata_eager branch from 4a87374 to a2bf98f Compare March 11, 2015 17:57
…g threadpool by using ChainedExecutionQueryRunner in SegmentMetadataQueryRunnerFactory.mergeRunners(..)
@himanshug himanshug force-pushed the segment_metadata_eager branch from a2bf98f to 55ebf0c Compare March 11, 2015 17:59
@himanshug
Copy link
Copy Markdown
Contributor Author

@drcrallen @nishantmonu51 switched to using chained query execution runner

@drcrallen
Copy link
Copy Markdown
Contributor

Holy crap that's much cleaner.

@himanshug
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

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

@nishantmonu51
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

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

@himanshug
Copy link
Copy Markdown
Contributor Author

I am checking

@himanshug
Copy link
Copy Markdown
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
Copy Markdown
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.

4 participants