Jackie-Jiang commented on code in PR #16146:
URL: https://github.com/apache/pinot/pull/16146#discussion_r2167784227


##########
pinot-controller/src/main/java/org/apache/pinot/controller/BaseControllerStarter.java:
##########
@@ -903,7 +912,7 @@ protected List<PeriodicTask> setupControllerPeriodicTasks() 
{
         _controllerMetrics, _executorService, _connectionManager);
     periodicTasks.add(responseStoreCleaner);
     PeriodicTask resourceUtilizationChecker = new 
ResourceUtilizationChecker(_config, _connectionManager,
-        _controllerMetrics, _diskUtilizationChecker, _executorService, 
_helixResourceManager);
+        _controllerMetrics, _utilizationCheckers, _executorService, 
_helixResourceManager);

Review Comment:
   Should we consider passing in `_resourceUtilizationManager`?



##########
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> _utilizationCheckers;

Review Comment:
   I meant something like
   ```suggestion
     protected final List<UtilizationChecker> _utilizationCheckers = new 
ArrayList<>();
   ```



##########
pinot-common/src/main/java/org/apache/pinot/common/restlet/resources/PrimaryKeyCountInfo.java:
##########
@@ -0,0 +1,74 @@
+/**
+ * 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.common.restlet.resources;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.Collections;
+import java.util.Set;
+
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class PrimaryKeyCountInfo {
+  private final String _instanceId;
+  private final long _numPrimaryKeys;
+  private final Set<String> _tablesWithPrimaryKeys;
+  private final long _lastUpdatedTimeInEpochMs;
+
+  public PrimaryKeyCountInfo(@JsonProperty("instanceId") String instanceId) {
+    _instanceId = instanceId;
+    _numPrimaryKeys = -1;
+    _tablesWithPrimaryKeys = Collections.emptySet();

Review Comment:
   (minor) Use `Set.of()`, same for other places



##########
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:
   IMO, it is not checker's responsibility to let minion continue run. Minion 
shouldn't even check for resource utilization if we don't want to pause.



##########
pinot-controller/src/test/java/org/apache/pinot/controller/validation/ResourceUtilizationManagerTest.java:
##########
@@ -28,58 +30,88 @@
 public class ResourceUtilizationManagerTest {
 
   private DiskUtilizationChecker _diskUtilizationChecker;
+  private List<UtilizationChecker> _utilizationCheckers;
   private ControllerConf _controllerConf;
   private ResourceUtilizationManager _resourceUtilizationManager;
   private final String _testTable = "myTable_OFFLINE";
 
   @BeforeMethod
   public void setUp() {
     _diskUtilizationChecker = Mockito.mock(DiskUtilizationChecker.class);
+    _utilizationCheckers = Collections.singletonList(_diskUtilizationChecker);

Review Comment:
   (minor) Use `List.of(_diskUtilizationChecker)`



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

Reply via email to