forked from voldemort/voldemort
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extracted the planning logic out of RebalanceController. This will reduce cut-and-paste coding, clarify which arguments are needed to tune planning (versus execution of a plan), and isolate rebalance planning logic from execution logic. There are a ton of TODOs added in this commit. As the refactoring continues, and the controller is changed to use the new RebalancePlan, these TODOs will be addressed. This commit has a working RebalancePlanCLI that handles the use cases rebalance planning has historically handled (rebalance in place and cluster expansion). This commit does not address zone expanison. The output of plan statistics is much richer and includes detailed statistics on cross zone moves (from which zone to which zone) and nodes (how much in and how much out). All these statistics are at the partition-store level which should be more informative than prior statistics. Finally, these statistics include an estimation of storage overhead per-node which can be used to assess how much free disk space is required to execute a plan safely. OrderedClusterTransition - TODOs to deprecate this. This logic belongs in the plan, not the execution. RebalanceClusterPlan - TODOs for refactoring - Has logic for doing things "the old way" and the "new way". The new way has simpler data structures nad better encapsulation. - Many more getters for detailed plan stats RebalanceNodePlan - Minor TODOs and some renaming of varaibles RebalancePartitionsInfo - A ton of refactoring TODOs - Fixed all move counting getters to count partition-stores Node - getStateString method to pretty print ID, host name and ports. RepartitionCLI - more argument handling PartitionBalance - getters for partition-store accounting of current cluster+store defs RebalanceUtils - Some methods to deprecate - validation methods for cluster arguments RebalancePlan - New class to encapsulate all rebalancing planning RebalanceTypedBatchPlan RebalanceDonorBasedBatchPlan RebalanceStealerBasedBatchPlan - Sub-classes of RebalancePlan that are needed for converting static plan into executable plan RebalancePlanCLI - CLI for generating a plan MoveMap & MoveMapTest - 2-d map counter used in partitoin-store accounting
- Loading branch information
Showing
15 changed files
with
1,222 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
src/java/voldemort/client/rebalance/RebalanceDonorBasedBatchPlan.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright 2013 LinkedIn, Inc | ||
* | ||
* Licensed 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 voldemort.client.rebalance; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
|
||
import voldemort.cluster.Cluster; | ||
import voldemort.store.StoreDefinition; | ||
|
||
import com.google.common.collect.Lists; | ||
|
||
public class RebalanceDonorBasedBatchPlan extends RebalanceTypedBatchPlan { | ||
|
||
public RebalanceDonorBasedBatchPlan(final Cluster currentCluster, | ||
final Cluster targetCluster, | ||
final List<StoreDefinition> storeDefs, | ||
final boolean enabledDeletePartition) { | ||
super(currentCluster, targetCluster, storeDefs, enabledDeletePartition); | ||
|
||
HashMap<Integer, List<RebalancePartitionsInfo>> donorToBatchPlan = new HashMap<Integer, List<RebalancePartitionsInfo>>(); | ||
for(RebalancePartitionsInfo info: batchPlan) { | ||
int donorId = info.getDonorId(); | ||
if(!donorToBatchPlan.containsKey(donorId)) { | ||
donorToBatchPlan.put(donorId, new ArrayList<RebalancePartitionsInfo>()); | ||
} | ||
donorToBatchPlan.get(donorId).add(info); | ||
} | ||
|
||
for(int donorId: donorToBatchPlan.keySet()) { | ||
rebalanceTaskQueue.offer(new RebalanceNodePlan(donorId, | ||
Lists.newArrayList(donorToBatchPlan.get(donorId)), | ||
false)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.