Jackie-Jiang commented on code in PR #13541: URL: https://github.com/apache/pinot/pull/13541#discussion_r1674706317
########## pinot-common/src/main/java/org/apache/pinot/common/utils/ServiceStatus.java: ########## @@ -434,6 +434,30 @@ private StatusDescriptionPair evaluateResourceStatus(String resourceName) { return new StatusDescriptionPair(Status.GOOD, STATUS_DESCRIPTION_NONE); } + // Cache ideal state status to avoid reading it twice + Map<String, String> partitionToIdealStateStatusMap = new HashMap<>(); + Set<String> partitionSet = idealState.getPartitionSet(); + + // Check that at least one partition is assigned in the ideal state, since if no partitions are assigned + // then consider the resource status GOOD. This check is needed to handle the case where the resource no + // longer exists on the server (i.e., last segment on the server was removed), but it still exists in the + // ideal state + boolean atLeastOnePartitionAssigned = false; + for (String partitionName : partitionSet) { + String idealStateStatus = idealState.getInstanceStateMap(partitionName).get(_instanceName); Review Comment: We can reduce the map lookup by looping over entries in `idealState.getRecord().getMapFields()`, same for the for loop below -- 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: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org