kangkaisen commented on a change in pull request #4771: URL: https://github.com/apache/incubator-doris/pull/4771#discussion_r514922361
########## File path: fe/fe-core/src/main/java/org/apache/doris/clone/Rebalancer.java ########## @@ -0,0 +1,80 @@ +// 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.doris.clone; + +import org.apache.doris.catalog.TabletInvertedIndex; +import org.apache.doris.clone.TabletScheduler.PathSlot; +import org.apache.doris.system.SystemInfoService; +import org.apache.doris.task.AgentBatchTask; +import org.apache.doris.thrift.TStorageMedium; + +import com.google.common.collect.Lists; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +/* + * Rebalancer is responsible for + * 1. selectAlternativeTablets: selecting alternative tablets by one rebalance strategy, + * and return them to tablet scheduler(maybe contains the concrete moves, or maybe not). + * 2. createBalanceTask: given a tablet, try to create a clone task for this tablet. + * 3. getCachedSrcBackendId: if the rebalance strategy wants to delete the replica of a specified be, + * override this func. + * NOTICE: + * It may have a long interval between selectAlternativeTablets() & createBalanceTask(). So the concrete moves may be + * invalid when we createBalanceTask(), you should check the moves' validation. + */ +public abstract class Rebalancer { Review comment: > Choosing dest be can be done before generating a clone task in createBalanceTask. The base class doesn't limit it. how to choose the dest be is core for balance strategy, if the base class doesn't limit it, what's the meaning of balance base class. ########## File path: fe/fe-core/src/main/java/org/apache/doris/clone/Rebalancer.java ########## @@ -0,0 +1,80 @@ +// 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.doris.clone; + +import org.apache.doris.catalog.TabletInvertedIndex; +import org.apache.doris.clone.TabletScheduler.PathSlot; +import org.apache.doris.system.SystemInfoService; +import org.apache.doris.task.AgentBatchTask; +import org.apache.doris.thrift.TStorageMedium; + +import com.google.common.collect.Lists; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +/* + * Rebalancer is responsible for + * 1. selectAlternativeTablets: selecting alternative tablets by one rebalance strategy, + * and return them to tablet scheduler(maybe contains the concrete moves, or maybe not). + * 2. createBalanceTask: given a tablet, try to create a clone task for this tablet. + * 3. getCachedSrcBackendId: if the rebalance strategy wants to delete the replica of a specified be, + * override this func. + * NOTICE: + * It may have a long interval between selectAlternativeTablets() & createBalanceTask(). So the concrete moves may be + * invalid when we createBalanceTask(), you should check the moves' validation. + */ +public abstract class Rebalancer { Review comment: > Choosing dest be can be done before generating a clone task in createBalanceTask. The base class doesn't limit it. How to choose the dest be is core for balance strategy, if the base class doesn't limit it, what's the meaning of balance base class. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org