Jackie-Jiang commented on code in PR #16146: URL: https://github.com/apache/pinot/pull/16146#discussion_r2167719732
########## pinot-controller/src/main/java/org/apache/pinot/controller/validation/UtilizationChecker.java: ########## @@ -0,0 +1,48 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.pinot.controller.validation; + +import com.google.common.collect.BiMap; +import org.apache.pinot.controller.util.CompletionServiceHelper; + + +/** + * Interface for all utilization checkers to be used to by ResourceUtilizationManager and ResourceUtilizationChecker + */ +public interface UtilizationChecker { + /** + * Get the name of the utilization checker + */ + String getName(); + + /** + * Returns true if the resource's utilization is within limits + * @param tableNameWithType table name with type + * @param isForMinion should be true if called from the minion task generation framework + */ + boolean isResourceUtilizationWithinLimits(String tableNameWithType, boolean isForMinion); Review Comment: Why do we need to specialize minion? From high level, why do we need to differentiate the caller? ########## pinot-controller/src/main/java/org/apache/pinot/controller/validation/ResourceUtilizationManager.java: ########## @@ -28,22 +30,34 @@ public class ResourceUtilizationManager { private static final Logger LOGGER = LoggerFactory.getLogger(ResourceUtilizationManager.class); private final boolean _isResourceUtilizationCheckEnabled; - private final DiskUtilizationChecker _diskUtilizationChecker; + private final List<UtilizationChecker> _utilizationCheckerList; - public ResourceUtilizationManager(ControllerConf controllerConf, DiskUtilizationChecker diskUtilizationChecker) { + public ResourceUtilizationManager(ControllerConf controllerConf, + @Nonnull List<UtilizationChecker> utilizationCheckerList) { Review Comment: (minor) We don't usually annotate `@Nonnull` ```suggestion public ResourceUtilizationManager(ControllerConf controllerConf, List<UtilizationChecker> utilizationCheckers) { ``` ########## pinot-controller/src/main/java/org/apache/pinot/controller/BaseControllerStarter.java: ########## @@ -212,6 +213,7 @@ public abstract class BaseControllerStarter implements ServiceStartable { protected ExecutorService _rebalancerExecutorService; protected TableSizeReader _tableSizeReader; protected StorageQuotaChecker _storageQuotaChecker; + protected List<UtilizationChecker> _utilizationCheckerList; Review Comment: (nit) Same for other places ```suggestion protected List<UtilizationChecker> _utilizationCheckers; ``` ########## pinot-controller/src/main/java/org/apache/pinot/controller/BaseControllerStarter.java: ########## @@ -212,6 +213,7 @@ public abstract class BaseControllerStarter implements ServiceStartable { protected ExecutorService _rebalancerExecutorService; protected TableSizeReader _tableSizeReader; protected StorageQuotaChecker _storageQuotaChecker; + protected List<UtilizationChecker> _utilizationCheckerList; Review Comment: Consider making it `final` and add a method to add checker into it? -- 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