Dart: Async queries to realtime servers.#18241
Merged
abhishekagarwal87 merged 4 commits intoapache:masterfrom Jul 16, 2025
Merged
Dart: Async queries to realtime servers.#18241abhishekagarwal87 merged 4 commits intoapache:masterfrom
abhishekagarwal87 merged 4 commits intoapache:masterfrom
Conversation
Prior to this patch, queries from MSQ workers to data servers would be initiated in the processing pool, and would block the processing pool until results started coming in. This patch addresses it with the strategy: 1) Update DataServerClient to return a future that resolves when the response starts being written. 2) Split DataServerQueryHandler into DartDataServerQueryHandler and IndexerDataServerQueryHandler. The Dart version doesn't do retries and doesn't follow segments to other data servers. It just returns the async future from DataServerClient. The Indexer (tasks) version retains the prior logic and isn't really async. I didn't attempt to asyncify its retry logic in this patch. 3) Add ReturnOrAwait.awaitAllFutures, which allows processors to wait for a future to resolve. 4) Update ScanQueryFrameProcessor and GroupByPreShuffleFrameProcessor to give up the processing thread when waiting for a data server query to come back. Additionally, to simplify DataServerClient, cancellations are now issued without using a scheduled executor. There should be no need for this, because the service client is async.
clintropolis
approved these changes
Jul 16, 2025
Member
clintropolis
left a comment
There was a problem hiding this comment.
lgtm 👍 (I didn't look at IndexerDataServerQueryHandler because i think it was all the code that was previously in DataServerQueryHandler)
Contributor
Author
Yes, it was just moved from |
capistrant
pushed a commit
to capistrant/incubator-druid
that referenced
this pull request
Jul 17, 2025
* Dart: Async queries to realtime servers. Prior to this patch, queries from MSQ workers to data servers would be initiated in the processing pool, and would block the processing pool until results started coming in. This patch addresses it with the strategy: 1) Update DataServerClient to return a future that resolves when the response starts being written. 2) Split DataServerQueryHandler into DartDataServerQueryHandler and IndexerDataServerQueryHandler. The Dart version doesn't do retries and doesn't follow segments to other data servers. It just returns the async future from DataServerClient. The Indexer (tasks) version retains the prior logic and isn't really async. I didn't attempt to asyncify its retry logic in this patch. 3) Add ReturnOrAwait.awaitAllFutures, which allows processors to wait for a future to resolve. 4) Update ScanQueryFrameProcessor and GroupByPreShuffleFrameProcessor to give up the processing thread when waiting for a data server query to come back. Additionally, to simplify DataServerClient, cancellations are now issued without using a scheduled executor. There should be no need for this, because the service client is async. * Fix tests and checkstyle. * Fix exception checking.
capistrant
added a commit
that referenced
this pull request
Jul 18, 2025
* Dart: Async queries to realtime servers. Prior to this patch, queries from MSQ workers to data servers would be initiated in the processing pool, and would block the processing pool until results started coming in. This patch addresses it with the strategy: 1) Update DataServerClient to return a future that resolves when the response starts being written. 2) Split DataServerQueryHandler into DartDataServerQueryHandler and IndexerDataServerQueryHandler. The Dart version doesn't do retries and doesn't follow segments to other data servers. It just returns the async future from DataServerClient. The Indexer (tasks) version retains the prior logic and isn't really async. I didn't attempt to asyncify its retry logic in this patch. 3) Add ReturnOrAwait.awaitAllFutures, which allows processors to wait for a future to resolve. 4) Update ScanQueryFrameProcessor and GroupByPreShuffleFrameProcessor to give up the processing thread when waiting for a data server query to come back. Additionally, to simplify DataServerClient, cancellations are now issued without using a scheduled executor. There should be no need for this, because the service client is async. * Fix tests and checkstyle. * Fix exception checking. Co-authored-by: Gian Merlino <gianmerlino@gmail.com>
ashibhardwaj
pushed a commit
to ashibhardwaj/druid
that referenced
this pull request
Jul 23, 2025
* Dart: Async queries to realtime servers. Prior to this patch, queries from MSQ workers to data servers would be initiated in the processing pool, and would block the processing pool until results started coming in. This patch addresses it with the strategy: 1) Update DataServerClient to return a future that resolves when the response starts being written. 2) Split DataServerQueryHandler into DartDataServerQueryHandler and IndexerDataServerQueryHandler. The Dart version doesn't do retries and doesn't follow segments to other data servers. It just returns the async future from DataServerClient. The Indexer (tasks) version retains the prior logic and isn't really async. I didn't attempt to asyncify its retry logic in this patch. 3) Add ReturnOrAwait.awaitAllFutures, which allows processors to wait for a future to resolve. 4) Update ScanQueryFrameProcessor and GroupByPreShuffleFrameProcessor to give up the processing thread when waiting for a data server query to come back. Additionally, to simplify DataServerClient, cancellations are now issued without using a scheduled executor. There should be no need for this, because the service client is async. * Fix tests and checkstyle. * Fix exception checking.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Prior to this patch, queries from MSQ workers to realtime servers would be initiated in the processing pool, and would block the processing pool until results started coming in. This patch addresses it with this strategy:
Update DataServerClient to return a future that resolves when the response starts being written.
Split DataServerQueryHandler into DartDataServerQueryHandler and IndexerDataServerQueryHandler. The Dart version doesn't do retries and doesn't follow segments to other data servers. It just returns the async future from DataServerClient. The Indexer (tasks) version retains the prior logic and isn't really async. I didn't attempt to asyncify its retry logic in this patch. This is hopefully a situation that will be improved in the future, ideally by having realtime servers participate in MSQ queries as workers themselves.
Add ReturnOrAwait.awaitAllFutures, which allows processors to wait for a future to resolve.
Update ScanQueryFrameProcessor and GroupByPreShuffleFrameProcessor to give up the processing thread when waiting for a data server query to come back.
Additionally, to simplify DataServerClient, cancellations are now issued without using a scheduled executor. There should be no need for this, because the service client is async.
Tagged this as a bug because without this change, using Dart on Historicals would lead to the processing pool getting jammed up if there is realtime data in play. It seems serious enough to be classified as a bug.