Skip to content

Commit

Permalink
Cleaned up code and Javadoc.
Browse files Browse the repository at this point in the history
  • Loading branch information
afeinberg committed May 7, 2010
1 parent 3def36b commit 8c22766
Showing 1 changed file with 20 additions and 29 deletions.
49 changes: 20 additions & 29 deletions src/java/voldemort/client/rebalance/RebalanceController.java
Expand Up @@ -4,7 +4,6 @@
import java.util.concurrent.*;

import com.google.common.collect.HashMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.SetMultimap;
import org.apache.log4j.Logger;

Expand Down Expand Up @@ -55,15 +54,8 @@ public Thread newThread(Runnable r) {
}

/**
* Voldemort dynamic cluster membership rebalancing mechanism. <br>
* Migrate partitions across nodes to managed changes in cluster
* memberships. <br>
* Takes targetCluster as parameters, fetches the current cluster
* configuration from the cluster compares and makes a list of partitions
* need to be transferred.<br>
* The cluster is kept consistent during rebalancing using a proxy mechanism
* via {@link RedirectingStore}<br>
*
* Grabs the latest cluster definition and calls
* {@link #rebalance(voldemort.cluster.Cluster, voldemort.cluster.Cluster)}
*
* @param targetCluster: target Cluster configuration
*/
Expand All @@ -86,16 +78,16 @@ private SetMultimap<Integer, RebalancePartitionsInfo> divideRebalanceNodePlan(Re

/**
* Voldemort dynamic cluster membership rebalancing mechanism. <br>
* Migrate partitions across nodes to managed changes in cluster
* memberships. <br>
* Takes targetCluster as parameters, fetches the current cluster
* configuration from the cluster compares and makes a list of partitions
* need to be transferred.<br>
* Migrate partitions across nodes to manage changes in cluster
* membership. <br>
* Takes target cluster as parameter, fetches the current cluster
* configuration from the cluster, compares and makes a list of partitions
* that eed to be transferred.<br>
* The cluster is kept consistent during rebalancing using a proxy mechanism
* via {@link RedirectingStore}<br>
* via {@link RedirectingStore}
*
*
* @param targetCluster: target Cluster configuration
* @param currentCluster: current cluster configuration
* @param targetCluster: target cluster configuration
*/
public void rebalance(Cluster currentCluster, final Cluster targetCluster) {
logger.debug("Current Cluster configuration:" + currentCluster);
Expand Down Expand Up @@ -256,17 +248,16 @@ public void stop() {

/**
* Does an atomic commit or revert for the intended partitions ownership
* changes and modify adminClient with the updatedCluster.<br>
* creates a new cluster metadata by moving partitions list passed in
* parameter rebalanceStealInfo and propagates it to all nodes.<br>
* Revert all changes if failed to copy on required copies (stealerNode and
* donorNode).<br>
* holds a lock untill the commit/revert finishes.
* changes and modifies adminClient with the updatedCluster.<br>
* Creates new cluster metadata by moving partitions list passed in
* as parameter rebalanceStealInfo and propagates it to all nodes.<br>
* Revert all changes if failed to copy on required nodes (stealer and
* donor).<br>
* Holds a lock untill the commit/revert finishes.
*
* @param stealPartitionsMap
* @param stealerNodeId
* @param rebalanceStealInfo
* @throws Exception
* @param stealerNode Node copy data from
* @param rebalanceStealInfo Current rebalance sub task
* @throws Exception If we are unable to propagate the cluster definition to donor and stealer
*/
void commitClusterChanges(Node stealerNode, RebalancePartitionsInfo rebalanceStealInfo)
throws Exception {
Expand All @@ -287,7 +278,7 @@ void commitClusterChanges(Node stealerNode, RebalancePartitionsInfo rebalanceSte
// increment clock version on stealerNodeId
latestClock.incrementVersion(stealerNode.getId(), System.currentTimeMillis());
try {
// propogates changes to all nodes.
// propagates changes to all nodes.
RebalanceUtils.propagateCluster(adminClient,
updatedCluster,
latestClock,
Expand Down

0 comments on commit 8c22766

Please sign in to comment.