rajagopr commented on code in PR #15008:
URL: https://github.com/apache/pinot/pull/15008#discussion_r1951529642


##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/minion/PinotTaskManager.java:
##########
@@ -641,6 +652,13 @@ protected TaskSchedulingInfo 
scheduleTask(PinotTaskGenerator taskGenerator, List
     for (TableConfig tableConfig : enabledTableConfigs) {
       String tableName = tableConfig.getTableName();
       try {
+        if 
(!_resourceUtilizationManager.isResourceUtilizationWithinLimits(tableName)) {

Review Comment:
   End result of merge rollup or RTO may indeed result in overall disk size. 
However, first these tasks would need to work on some segments on the disk to 
achieve that result.



##########
pinot-controller/src/main/java/org/apache/pinot/controller/validation/ResourceUtilizationChecker.java:
##########
@@ -0,0 +1,85 @@
+/**
+ * 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 java.util.HashSet;
+import java.util.Properties;
+import java.util.Set;
+import java.util.concurrent.Executor;
+import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager;
+import org.apache.pinot.common.metrics.ControllerMeter;
+import org.apache.pinot.common.metrics.ControllerMetrics;
+import org.apache.pinot.controller.ControllerConf;
+import org.apache.pinot.controller.helix.core.PinotHelixResourceManager;
+import org.apache.pinot.controller.util.CompletionServiceHelper;
+import org.apache.pinot.core.periodictask.BasePeriodicTask;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * This class is responsible for checking resource utilization for Pinot 
instances. To begin with, it checks
+ * disk utilization for all server instances. The computed disk utilization is 
stored in the class
+ * <code>org.apache.pinot.controller.validation.ResourceUtilizationInfo</code>.
+ */
+public class ResourceUtilizationChecker extends BasePeriodicTask {
+  private static final Logger LOGGER = 
LoggerFactory.getLogger(ResourceUtilizationChecker.class);
+
+  private final PoolingHttpClientConnectionManager _connectionManager;
+  private final ControllerMetrics _controllerMetrics;
+  private final DiskUtilizationChecker _diskUtilizationChecker;
+  private final Executor _executor;
+  private final PinotHelixResourceManager _helixResourceManager;
+
+  public ResourceUtilizationChecker(ControllerConf config, 
PoolingHttpClientConnectionManager connectionManager,
+      ControllerMetrics controllerMetrics, DiskUtilizationChecker 
diskUtilizationChecker, Executor executor,
+      PinotHelixResourceManager pinotHelixResourceManager) {
+    super(ResourceUtilizationChecker.class.getSimpleName(), 
config.getResourceUtilizationCheckerFrequency(),
+        config.getResourceUtilizationCheckerInitialDelay());
+    _connectionManager = connectionManager;
+    _controllerMetrics = controllerMetrics;
+    _diskUtilizationChecker = diskUtilizationChecker;
+    _executor = executor;
+    _helixResourceManager = pinotHelixResourceManager;
+  }
+
+  @Override
+  protected final void runTask(Properties periodicTaskProperties) {
+    _controllerMetrics.addMeteredTableValue(_taskName, 
ControllerMeter.CONTROLLER_PERIODIC_TASK_RUN, 1L);
+    Set<String> instances = new HashSet<>();
+    try {
+      Set<String> serverTenantNames = 
_helixResourceManager.getAllServerTenantNames();
+      for (String serverTenantName : serverTenantNames) {
+        Set<String> instancesForServerTenant = 
_helixResourceManager.getAllInstancesForServerTenant(serverTenantName);
+        if (!instancesForServerTenant.isEmpty()) {
+          instances.addAll(instancesForServerTenant);
+        }

Review Comment:
   `liveInstances` would give all instances including broker and controller 
instances. We need just the server instances.



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