voldemort.utils
Class UpdateClusterUtils

java.lang.Object
  extended by voldemort.utils.UpdateClusterUtils

public class UpdateClusterUtils
extends java.lang.Object

UpdateClusterUtils provides helper methods for manipulating nodes and clusters. The methods are used by rebalancing tools and in tests.


Constructor Summary
UpdateClusterUtils()
           
 
Method Summary
static Node addPartitionsToNode(Node node, java.util.Set<java.lang.Integer> donatedPartitions)
          Add the set of partitions to the node provided
static Node addPartitionToNode(Node node, java.lang.Integer donatedPartition)
          Add a partition to the node provided
static Cluster createUpdatedCluster(Cluster currentCluster, int stealerNodeId, java.util.List<java.lang.Integer> donatedPartitions)
          Updates the existing cluster such that we remove partitions mentioned from the stealer node and add them to the donor node
static Node removePartitionFromNode(Node node, java.lang.Integer donatedPartition)
          Remove a partition from the node provided
static Node removePartitionsFromNode(Node node, java.util.Set<java.lang.Integer> donatedPartitions)
          Remove the set of partitions from the node provided
static Cluster updateCluster(Cluster currentCluster, java.util.List<Node> updatedNodeList)
          Concatenates the list of current nodes in the given cluster with the new nodes provided and returns an updated cluster metadata.
static Node updateNode(Node node, java.util.List<java.lang.Integer> partitionsList)
          Creates a replica of the node with the new partitions list
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UpdateClusterUtils

public UpdateClusterUtils()
Method Detail

updateNode

public static Node updateNode(Node node,
                              java.util.List<java.lang.Integer> partitionsList)
Creates a replica of the node with the new partitions list

Parameters:
node - The node whose replica we are creating
partitionsList - The new partitions list
Returns:
Replica of node with new partitions list

addPartitionToNode

public static Node addPartitionToNode(Node node,
                                      java.lang.Integer donatedPartition)
Add a partition to the node provided

Parameters:
node - The node to which we'll add the partition
donatedPartition - The partition to add
Returns:
The new node with the new partition

removePartitionFromNode

public static Node removePartitionFromNode(Node node,
                                           java.lang.Integer donatedPartition)
Remove a partition from the node provided

Parameters:
node - The node from which we're removing the partition
donatedPartition - The partitions to remove
Returns:
The new node without the partition

addPartitionsToNode

public static Node addPartitionsToNode(Node node,
                                       java.util.Set<java.lang.Integer> donatedPartitions)
Add the set of partitions to the node provided

Parameters:
node - The node to which we'll add the partitions
donatedPartitions - The list of partitions to add
Returns:
The new node with the new partitions

removePartitionsFromNode

public static Node removePartitionsFromNode(Node node,
                                            java.util.Set<java.lang.Integer> donatedPartitions)
Remove the set of partitions from the node provided

Parameters:
node - The node from which we're removing the partitions
donatedPartitions - The list of partitions to remove
Returns:
The new node without the partitions

updateCluster

public static Cluster updateCluster(Cluster currentCluster,
                                    java.util.List<Node> updatedNodeList)
Concatenates the list of current nodes in the given cluster with the new nodes provided and returns an updated cluster metadata.
If the nodes being updated already exist in the current metadata, we take the updated ones

Parameters:
currentCluster - The current cluster metadata
updatedNodeList - The list of new nodes to be added
Returns:
New cluster metadata containing both the sets of nodes

createUpdatedCluster

public static Cluster createUpdatedCluster(Cluster currentCluster,
                                           int stealerNodeId,
                                           java.util.List<java.lang.Integer> donatedPartitions)
Updates the existing cluster such that we remove partitions mentioned from the stealer node and add them to the donor node

Parameters:
currentCluster - Existing cluster metadata. Both stealer and donor node should already exist in this metadata
stealerNodeId - Id of node for which we are stealing the partitions
donatedPartitions - List of partitions we are moving
Returns:
Updated cluster metadata


Jay Kreps, Roshan Sumbaly, Alex Feinberg, Bhupesh Bansal, Lei Gao, Chinmay Soman, Vinoth Chandar, Zhongjie Wu