mshahid6 opened a new pull request, #19235:
URL: https://github.com/apache/druid/pull/19235
### Description
Added early query cancellation on historicals by sampling segment completion
times and extrapolating whether the query will exceed its timeout. After a
configurable number of segments complete, elapsed time is measured and used to
project total query time. If the projection exceeds the remaining timeout, all
pending segment futures are cancelled immediately.
New query context parameter is `perSegmentSamplingWindow` (number of
segments to complete before extrapolating) with a default value of 0 i.e.
disabled.
Can be set per-query via query context, or as a system default via
druid.query.default.context.perSegmentSamplingWindow.
**Example**
```
{
"context": {
"timeout": 30000,
"perSegmentSamplingWindow": 5
}
}
```
After 5 segments complete, if wall-clock extrapolation suggests the query
will exceed 30 seconds, it fails fast instead of waiting for the full timeout.
##### Key changed/added classes in this PR
* `ChainedExecutionQueryRunner`
* `QueryContexts/QueryContext`
* `ChainedExecutionQueryRunnerExtrapolationTest`
**Limitations**
- GroupByMergingQueryRunner is not covered yet (follow-up)
- Extrapolation assumes roughly uniform segment cost; skewed first segments
could cause false positives or misses
This PR has:
- [ ] been self-reviewed.
- [ ] using the [concurrency
checklist](https://github.com/apache/druid/blob/master/dev/code-review/concurrency.md)
(Remove this item if the PR doesn't have any relation to concurrency.)
- [ ] added documentation for new or modified features or behaviors.
- [ ] a release note entry in the PR description.
- [ ] added Javadocs for most classes and all non-trivial methods. Linked
related entities via Javadoc links.
- [ ] added or updated version, license, or notice information in
[licenses.yaml](https://github.com/apache/druid/blob/master/dev/license.md)
- [ ] added comments explaining the "why" and the intent of the code
wherever would not be obvious for an unfamiliar reader.
- [ ] added unit tests or modified existing tests to cover new code paths,
ensuring the threshold for [code
coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md)
is met.
- [ ] added integration tests.
- [ ] been tested in a test Druid cluster.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]