swaminathanmanish commented on code in PR #10359: URL: https://github.com/apache/pinot/pull/10359#discussion_r1128506464
########## pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/rebalance/ZkBasedTableRebalanceObserver.java: ########## @@ -0,0 +1,156 @@ +/** + * 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.google.common.base.Preconditions; +import java.util.Map; +import org.apache.helix.store.zk.ZkHelixPropertyStore; +import org.apache.helix.zookeeper.datamodel.ZNRecord; +import org.apache.pinot.controller.helix.core.PinotHelixResourceManager; +import org.apache.pinot.spi.utils.CommonConstants; +/** + * <code>ZkBasedTableRebalanceObserver</code> observes rebalance progress and tracks rebalance status, + * stats in Zookeeper. This will be used to show the progress of rebalance to users via rebalanceStatus API. + */ +public class ZkBasedTableRebalanceObserver implements TableRebalanceObserver { + private final String _tableNameWithType; + private final String _rebalanceJobId; + private final ZkHelixPropertyStore<ZNRecord> _propertyStore; + TableRebalanceProgressStats _tableRebalanceProgressStats; + + public ZkBasedTableRebalanceObserver(String tableNameWithType, + String rebalanceJobId, + ZkHelixPropertyStore<ZNRecord> propertyStore) { + Preconditions.checkState(tableNameWithType != null, "Table name cannot be null"); + Preconditions.checkState(rebalanceJobId != null, "rebalanceId cannot be null"); + Preconditions.checkState(propertyStore != null, "propertyStore cannot be null"); + _tableNameWithType = tableNameWithType; + _rebalanceJobId = rebalanceJobId; + _propertyStore = propertyStore; + _tableRebalanceProgressStats = new TableRebalanceProgressStats(); + } + + @Override + public void onTrigger(Trigger trigger, Map<String, Map<String, String>> currentState, + Map<String, Map<String, String>> targetState) { + switch (trigger) { + case START_TRIGGER: Review Comment: These are set in TableRebalancer class. I think you need to load the diff. By default the diff is not showing up. -- 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