FrankChen021 commented on code in PR #19665:
URL: https://github.com/apache/druid/pull/19665#discussion_r3543863056
##########
server/src/main/java/org/apache/druid/server/scheduling/WeightedQueryLaningStrategy.java:
##########
@@ -242,16 +309,16 @@ private <T> int computeCost(Query<T> query,
Set<SegmentServerSelector> segments)
// query with hundreds of intervals.
final List<Interval> intervals = query.getIntervals();
if (!intervals.isEmpty() &&
intervals.get(0).getStart().isBefore(cutoff)) {
- cost++;
+ cost += weightOrDefault(periodWeight);
}
}
if (durationThreshold != null &&
query.getDuration().isLongerThan(durationThreshold)) {
- cost++;
+ cost += weightOrDefault(durationWeight);
Review Comment:
[P2] Prevent weighted cost overflow from bypassing lanes
The new weight fields are only validated as >= 1, but `computeCost`
accumulates them in an `int`. A valid config such as `durationWeight=1` and
`segmentCountWeight=Integer.MAX_VALUE` overflows when both thresholds are
breached; the wrapped negative cost does not satisfy any positive lane
`minCost`, so the query falls back to the default pool instead of being
throttled. Please accumulate in `long` or checked arithmetic, or reject configs
whose maximum possible cost exceeds `Integer.MAX_VALUE`.
--
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]