FrankChen021 commented on code in PR #19622:
URL: https://github.com/apache/druid/pull/19622#discussion_r3474274686


##########
indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/supervisor/autoscaler/WeightedCostFunction.java:
##########
@@ -156,6 +157,16 @@ public CostResult computeCost(
     return new CostResult(cost, lagCost, weightedIdleCost);
   }
 
+  /**
+   * Derives the current idle ratio from measured utilization ({@code 
avgProcessingRate / maxObservedRate}).
+   */
+  static double estimateIdleFromUtilization(CostMetrics metrics)
+  {
+    final Double maxObservedRate = metrics.getMaxObservedRate();
+    final double utilization = Math.min(1.0, metrics.getAvgProcessingRate() / 
maxObservedRate);

Review Comment:
   [P2] Restore fallback before dividing by maxObservedRate
   
   When `usePollIdleRatio` is false, this method derives idle ratio from 
`maxObservedRate`, but `CostMetrics` still allows that value to be null and the 
added tests explicitly cover null and zero watermarks. Dividing by the boxed 
value now throws on null, and a zero watermark yields `Infinity`/`NaN` behavior 
instead of the intended `IDEAL_IDLE_RATIO` cold-start fallback. Please keep the 
`maxObservedRate == null || maxObservedRate <= 0` guard before this division.



-- 
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]

Reply via email to