somandal commented on code in PR #15029: URL: https://github.com/apache/pinot/pull/15029#discussion_r1957028914
########## pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/rebalance/DefaultRebalancePreChecker.java: ########## @@ -0,0 +1,136 @@ +/** + * 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.helix.core.rebalance; + +import com.fasterxml.jackson.databind.JsonNode; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.ExecutorService; +import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager; +import org.apache.pinot.common.assignment.InstanceAssignmentConfigUtils; +import org.apache.pinot.common.exception.InvalidConfigException; +import org.apache.pinot.controller.helix.core.PinotHelixResourceManager; +import org.apache.pinot.controller.util.TableMetadataReader; +import org.apache.pinot.spi.config.table.TableConfig; +import org.apache.pinot.spi.config.table.TableType; +import org.apache.pinot.spi.config.table.assignment.InstanceAssignmentConfig; +import org.apache.pinot.spi.config.table.assignment.InstancePartitionsType; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +public class DefaultRebalancePreChecker implements RebalancePreChecker { + private static final Logger LOGGER = LoggerFactory.getLogger(DefaultRebalancePreChecker.class); + + public static final String NEEDS_RELOAD_STATUS = "needsReloadStatus"; + public static final String IS_MINIMIZE_DATA_MOVEMENT = "isMinimizeDataMovement"; + + private PinotHelixResourceManager _pinotHelixResourceManager; + private ExecutorService _executorService; + + @Override + public void init(PinotHelixResourceManager pinotHelixResourceManager, ExecutorService executorService) { + _pinotHelixResourceManager = pinotHelixResourceManager; + _executorService = executorService; + } + + @Override + public Map<String, String> check(String rebalanceJobId, String tableNameWithType, + TableConfig tableConfig) { + LOGGER.info("Start pre-checks for table: {} with rebalanceJobId: {}", tableNameWithType, rebalanceJobId); + + Map<String, String> preCheckResult = new HashMap<>(); + // Check for reload status + Boolean needsReload = checkReloadNeededOnServers(rebalanceJobId, tableNameWithType); + preCheckResult.put(NEEDS_RELOAD_STATUS, + needsReload == null ? "error" : needsReload ? String.valueOf(true) : String.valueOf(false)); + // Check whether minimizeDataMovement is set in TableConfig + boolean isMinimizeDataMovement = checkIsMinimizeDataMovement(rebalanceJobId, tableNameWithType, tableConfig); + preCheckResult.put(IS_MINIMIZE_DATA_MOVEMENT, String.valueOf(isMinimizeDataMovement)); + + LOGGER.info("End pre-checks for table: {} with rebalanceJobId: {}", tableNameWithType, rebalanceJobId); + return preCheckResult; + } + + /** + * Checks if the current segments on any servers needs a reload (table config or schema change that hasn't been + * applied yet). This check does not guarantee that the segments in deep store are up to date. + * TODO: Add an API to check for whether segments in deep store are up to date with the table configs and schema + * and add a pre-check here to call that API. + */ + private Boolean checkReloadNeededOnServers(String rebalanceJobId, String tableNameWithType) { + // Use at most 10 threads to get whether reload is needed from servers Review Comment: done ########## pinot-tools/src/main/java/org/apache/pinot/tools/perf/PerfBenchmarkDriver.java: ########## @@ -291,7 +292,7 @@ private void startHelixResourceManager() // participant with the same host and port. ControllerConf controllerConf = getControllerConf(); controllerConf.setControllerPort(Integer.toString(_conf.getControllerPort() + 1)); - _helixResourceManager = new PinotHelixResourceManager(controllerConf); + _helixResourceManager = new PinotHelixResourceManager(controllerConf, Executors.newFixedThreadPool(10)); Review Comment: done -- 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