voldemort.client.protocol.admin
Class AdminClient.RebalancingOperations

java.lang.Object
  extended by voldemort.client.protocol.admin.AdminClient.RebalancingOperations
Enclosing class:
AdminClient

public class AdminClient.RebalancingOperations
extends java.lang.Object

Encapsulates all operations concerning cluster expansion


Constructor Summary
AdminClient.RebalancingOperations()
           
 
Method Summary
 void checkEachServerInNormalState(Cluster cluster)
          Check the execution state of the server by checking the state of MetadataStore.VoldemortState
This function checks if the nodes are all in normal state ( MetadataStore.VoldemortState.NORMAL_SERVER).
 void deleteStoreRebalanceState(int donorNodeId, int stealerNodeId, java.lang.String storeName)
          Delete the rebalancing metadata related to the store on the stealer node
 java.util.List<StoreDefinition> getCurrentStoreDefinitions(Cluster cluster)
          Given the cluster metadata, retrieves the list of store definitions.
 Versioned<Cluster> getLatestCluster(java.util.List<java.lang.Integer> requiredNodes)
          Get the latest cluster from all available nodes in the cluster
Throws exception if:
A) Any node in the required nodes list fails to respond.
B) Cluster is in inconsistent state with concurrent versions for cluster metadata on any two nodes.
 Versioned<MetadataStore.VoldemortState> getRemoteServerState(int nodeId)
          Retrieve the server MetadataStore.VoldemortState from a remote node.
 int rebalanceNode(RebalanceTaskInfo stealInfo)
          Rebalance a stealer-donor node pair for a set of stores.
 void rebalanceStateChange(Cluster existingCluster, Cluster transitionCluster, java.util.List<StoreDefinition> existingStoreDefs, java.util.List<StoreDefinition> targetStoreDefs, java.util.List<RebalanceTaskInfo> rebalanceTaskPlanList, boolean swapRO, boolean changeClusterMetadata, boolean changeRebalanceState, boolean rollback, boolean failEarly)
          Used in rebalancing to indicate change in states.
 void validateReadOnlyStores(Cluster cluster, java.util.List<StoreDefinition> storeDefs)
          Given a list of store definitions, cluster and admin client returns a boolean indicating if all RO stores are in the correct format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AdminClient.RebalancingOperations

public AdminClient.RebalancingOperations()
Method Detail

rebalanceNode

public int rebalanceNode(RebalanceTaskInfo stealInfo)
Rebalance a stealer-donor node pair for a set of stores. This is run on the stealer node.

Parameters:
stealInfo - Partition steal information
Returns:
The request id of the async operation

deleteStoreRebalanceState

public void deleteStoreRebalanceState(int donorNodeId,
                                      int stealerNodeId,
                                      java.lang.String storeName)
Delete the rebalancing metadata related to the store on the stealer node

Parameters:
donorNodeId - The donor node id
stealerNodeId - The stealer node id
storeName - The name of the store

getRemoteServerState

public Versioned<MetadataStore.VoldemortState> getRemoteServerState(int nodeId)
Retrieve the server MetadataStore.VoldemortState from a remote node.

Parameters:
nodeId - The node from which we want to retrieve the state
Returns:
The server state

rebalanceStateChange

public void rebalanceStateChange(Cluster existingCluster,
                                 Cluster transitionCluster,
                                 java.util.List<StoreDefinition> existingStoreDefs,
                                 java.util.List<StoreDefinition> targetStoreDefs,
                                 java.util.List<RebalanceTaskInfo> rebalanceTaskPlanList,
                                 boolean swapRO,
                                 boolean changeClusterMetadata,
                                 boolean changeRebalanceState,
                                 boolean rollback,
                                 boolean failEarly)
Used in rebalancing to indicate change in states. Groups the partition plans on the basis of stealer nodes and sends them over. The various combinations and their order of execution is given below where:
 | swapRO | changeClusterMetadata | changeRebalanceState | Order                        |
 |   f    |         t             |          t           | cluster -> rebalance         |
 |   f    |         f             |          t           | rebalance                    |
 |   t    |         t             |          f           | cluster -> swap              |
 |   t    |         t             |          t           | cluster -> swap -> rebalance |
 
Similarly for rollback, order means the following:
 | swapRO | changeClusterMetadata | changeRebalanceState | Order                                    |
 |   f    |         t             |          t           | remove from rebalance -> cluster         |
 |   f    |         f             |          t           | remove from rebalance                    |
 |   t    |         t             |          f           | cluster -> swap                          |
 |   t    |         t             |          t           | remove from rebalance -> cluster -> swap |
 

Parameters:
existingCluster - Current cluster
transitionCluster - Transition cluster
existingStoreDefs - current store defs
targetStoreDefs - transition store defs
rebalanceTaskPlanList - The list of rebalance partition info plans
swapRO - Boolean indicating if we need to swap RO stores
changeClusterMetadata - Boolean indicating if we need to change cluster metadata
changeRebalanceState - Boolean indicating if we need to change rebalancing state
rollback - Do we want to do a rollback step in case of failures?
failEarly - Do we want to fail early while doing state change?

getLatestCluster

public Versioned<Cluster> getLatestCluster(java.util.List<java.lang.Integer> requiredNodes)
Get the latest cluster from all available nodes in the cluster
Throws exception if:
A) Any node in the required nodes list fails to respond.
B) Cluster is in inconsistent state with concurrent versions for cluster metadata on any two nodes.

Parameters:
requiredNodes - List of nodes from which we definitely need an answer
Returns:
Returns the latest cluster metadata

checkEachServerInNormalState

public void checkEachServerInNormalState(Cluster cluster)
Check the execution state of the server by checking the state of MetadataStore.VoldemortState
This function checks if the nodes are all in normal state ( MetadataStore.VoldemortState.NORMAL_SERVER).

Parameters:
cluster - Cluster metadata whose nodes we are checking
Throws:
VoldemortRebalancingException - if any node is not in normal state

getCurrentStoreDefinitions

public java.util.List<StoreDefinition> getCurrentStoreDefinitions(Cluster cluster)
Given the cluster metadata, retrieves the list of store definitions.
It also checks if the store definitions are consistent across the cluster

Parameters:
cluster - The cluster metadata
Returns:
List of store definitions

validateReadOnlyStores

public void validateReadOnlyStores(Cluster cluster,
                                   java.util.List<StoreDefinition> storeDefs)
Given a list of store definitions, cluster and admin client returns a boolean indicating if all RO stores are in the correct format.
This function also takes into consideration nodes which are being bootstrapped for the first time, in which case we can safely ignore checking them ( as they will have default to ro0 )

Parameters:
cluster - Cluster metadata
storeDefs - Complete list of store definitions


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