Skip to content

Commit

Permalink
Interim commit: OrderedClusterTransition has been removed from the co…
Browse files Browse the repository at this point in the history
…de base.
  • Loading branch information
jayjwylie committed Jun 20, 2013
1 parent d9e2623 commit 91be6db
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 175 deletions.
98 changes: 0 additions & 98 deletions src/java/voldemort/client/rebalance/OrderedClusterTransition.java

This file was deleted.

9 changes: 4 additions & 5 deletions src/java/voldemort/client/rebalance/RebalanceController.java
Expand Up @@ -212,9 +212,8 @@ private void executePlan(RebalancePlan rebalancePlan) {
} else {
executableBatch = new RebalanceDonorBasedBatchPlan(batchPlan);
}
final OrderedClusterTransition orderedClusterTransition = new OrderedClusterTransition(executableBatch);

RebalanceUtils.printLog(batchCount, logger, orderedClusterTransition.toString());
RebalanceUtils.printLog(batchCount, logger, executableBatch.toString());

long startTimeMs = System.currentTimeMillis();
// TODO: should be
Expand All @@ -223,7 +222,7 @@ private void executePlan(RebalancePlan rebalancePlan) {
batchPlan.getCurrentCluster(),
batchPlan.getFinalCluster(),
batchPlan.getStoreDefs(),
orderedClusterTransition);
executableBatch);
totalTimeMs += (System.currentTimeMillis() - startTimeMs);

// Bump up the statistics
Expand Down Expand Up @@ -289,9 +288,9 @@ private void executeBatch(int batchCount,
final Cluster batchCurrentCluster,
final Cluster batchFinalCluster,
List<StoreDefinition> batchStoreDefs,
final OrderedClusterTransition orderedClusterTransition) {
final RebalanceTypedBatchPlan executableBatch) {
try {
final List<RebalancePartitionsInfo> rebalancePartitionsInfoList = orderedClusterTransition.getOrderedRebalancePartitionsInfoList();
final List<RebalancePartitionsInfo> rebalancePartitionsInfoList = executableBatch.getRebalancingTasks();

if(rebalancePartitionsInfoList.isEmpty()) {
RebalanceUtils.printLog(batchCount, logger, "Skipping batch " + batchCount
Expand Down
35 changes: 10 additions & 25 deletions src/java/voldemort/client/rebalance/RebalanceTypedBatchPlan.java
Expand Up @@ -15,7 +15,6 @@
*/
package voldemort.client.rebalance;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand All @@ -26,6 +25,8 @@
import voldemort.store.StoreDefinition;
import voldemort.utils.Utils;

import com.google.common.collect.Lists;

// TODO: Rename to ExecutableRebalanceBatch
public abstract class RebalanceTypedBatchPlan {

Expand Down Expand Up @@ -64,31 +65,15 @@ public Queue<RebalanceNodePlan> getRebalancingTaskQueue() {
return rebalanceTaskQueue;
}

// TODO: Change method name once types have better names.
// TODO: add javadoc
// Take an unorderd list of tasks and order them by zone n-ary for sake of
// prioritizing zone primaries ahead of zone secondaries ahead of ...
protected List<RebalancePartitionsInfo> sortTasks(int nodeId,
List<RebalancePartitionsInfo> tasks) {
int zoneId = rebalanceClusterPlan.getFinalCluster().getNodeById(nodeId).getZoneId();
for(RebalancePartitionsInfo task: tasks) {
Map<Integer, List<RebalancePartitionsInfo>> zoneNaryToTasks = new HashMap<Integer, List<RebalancePartitionsInfo>>();
for(String storeName: storeToRoutingPlan.keySet()) {
StoreRoutingPlan storeRoutingPlan = storeToRoutingPlan.get(storeName);
List<Integer> partitionIds = task.getPartitionIds(storeName);
for(Integer partitionId: partitionIds) {
int zoneNaryType = storeRoutingPlan.getZoneReplicaType(zoneId,
nodeId,
partitionId);
if(!zoneNaryToTasks.containsKey(zoneNaryType)) {
zoneNaryToTasks.put(zoneNaryType, new ArrayList<RebalancePartitionsInfo>());
}
List<RebalancePartitionsInfo> naryTasks = zoneNaryToTasks.get(zoneNaryType);
// naryTasks. .add(partitionId);
}
}
// TODO: Are both interfaces (getRebalancingTasks &&
// getRebalancingTaskQueue) needed?
// TODO: javadoc
public List<RebalancePartitionsInfo> getRebalancingTasks() {
List<RebalancePartitionsInfo> infos = Lists.newArrayList();
for(RebalanceNodePlan rebalanceNodePlan: rebalanceTaskQueue) {
infos.addAll(rebalanceNodePlan.getRebalanceTaskList());
}
return null;
return infos;
}

@Override
Expand Down

0 comments on commit 91be6db

Please sign in to comment.