clintropolis commented on a change in pull request #9407: query laning and load
shedding
URL: https://github.com/apache/druid/pull/9407#discussion_r388761228
##########
File path:
sql/src/test/java/org/apache/druid/sql/calcite/util/SpecificSegmentsQuerySegmentWalker.java
##########
@@ -388,13 +410,33 @@ public SegmentDescriptor getDescriptor()
toolChest
);
+
// Wrap baseRunner in a runner that rewrites the QuerySegmentSpec to
mention the specific segments.
// This mimics what CachingClusteredClient on the Broker does, and is
required for certain queries (like Scan)
// to function properly.
- return (theQuery, responseContext) -> baseRunner.run(
- theQuery.withQuery(Queries.withSpecificSegments(theQuery.getQuery(),
ImmutableList.copyOf(specs))),
- responseContext
- );
+ return (theQuery, responseContext) -> {
+ if (scheduler != null) {
+ Set<SegmentServerSelector> segments = new HashSet<>();
+ specs.forEach(spec -> segments.add(new SegmentServerSelector(null,
spec)));
+ return scheduler.run(
+ scheduler.laneQuery(theQuery, segments),
+ new LazySequence<>(
+ () -> baseRunner.run(
+ theQuery.withQuery(Queries.withSpecificSegments(
+ theQuery.getQuery(),
+ ImmutableList.copyOf(specs)
+ )),
+ responseContext
+ )
+ )
+ );
Review comment:
If you mean which tests use this block, then it is the
[SqlResourceTest](https://github.com/apache/druid/pull/9407/files#diff-5a3523f6924e529221fa60db2bb56f05R125)
which create this thing with a scheduler.
No laning strategy is currently using the set of `SegmentServerSelector` to
make decisions at this time, I just went ahead and wired it up because we do
have the set of `SegmentDescriptors` available here, in anticipation of some
future usage. With the `ServerSelector` part of that set to `null` though, we
would probably want to either have a mock or artifical set of servers to
pretend to serve the test segments, so it might still need some future work?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]