capistrant commented on code in PR #19091:
URL: https://github.com/apache/druid/pull/19091#discussion_r2906165802
##########
indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/supervisor/autoscaler/CostBasedAutoScaler.java:
##########
@@ -161,29 +172,26 @@ public int computeTaskCountForRollover()
public int computeTaskCountForScaleAction()
{
lastKnownMetrics = collectMetrics();
- if (lastKnownMetrics == null) {
- log.debug("Metrics not available for supervisorId [%s], skipping scaling
action", supervisorId);
- return -1;
- }
final int optimalTaskCount = computeOptimalTaskCount(lastKnownMetrics);
final int currentTaskCount = lastKnownMetrics.getCurrentTaskCount();
Review Comment:
NPE seems possible here now that there is no null check above. Looks like
`collectMetrics()` is nullable only when supervisor is suspended, so perhaps
unlikely/impossible we hit NPE here if scaler doesn't run in suspended state?
Either way, `computeOptimalTaskCount` code path handles the `null` metrics
state, so should we add a guard here too?
--
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]