|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectvoldemort.server.rebalance.Rebalancer
public class Rebalancer
Service responsible for rebalancing
Handles two scenarios a) When a new request comes in b) When a rebalancing
was shut down and the box was restarted
Constructor Summary | |
---|---|
Rebalancer(StoreRepository storeRepository,
MetadataStore metadataStore,
VoldemortConfig voldemortConfig,
AsyncOperationService asyncService)
|
Method Summary | |
---|---|
boolean |
acquireRebalancingPermit(int nodeId)
Acquire a permit for a particular node id so as to allow rebalancing |
AsyncOperationService |
getAsyncOperationService()
|
int |
rebalanceNode(RebalanceTaskInfo stealInfo)
This function is responsible for starting the actual async rebalance operation. |
void |
rebalanceStateChange(Cluster cluster,
java.util.List<StoreDefinition> storeDefs,
java.util.List<RebalanceTaskInfo> rebalanceTaskInfo,
boolean swapRO,
boolean changeClusterAndStoresMetadata,
boolean changeRebalanceState,
boolean rollback)
Support four different stages For normal operation: |
void |
releaseRebalancingPermit(int nodeId)
Release the rebalancing permit for a particular node id |
void |
run()
This is called only once at startup |
void |
start()
|
void |
stop()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Rebalancer(StoreRepository storeRepository, MetadataStore metadataStore, VoldemortConfig voldemortConfig, AsyncOperationService asyncService)
Method Detail |
---|
public AsyncOperationService getAsyncOperationService()
public void start()
public void stop()
public void run()
run
in interface java.lang.Runnable
public boolean acquireRebalancingPermit(int nodeId)
nodeId
- The id of the node for which we are acquiring a permit
public void releaseRebalancingPermit(int nodeId)
nodeId
- The node id whose permit we want to releasepublic void rebalanceStateChange(Cluster cluster, java.util.List<StoreDefinition> storeDefs, java.util.List<RebalanceTaskInfo> rebalanceTaskInfo, boolean swapRO, boolean changeClusterAndStoresMetadata, boolean changeRebalanceState, boolean rollback)
| swapRO | changeClusterMetadata | changeRebalanceState | Order | | f | t | t | rebalance -> cluster | | f | f | t | rebalance | | t | t | f | cluster -> swap | | t | t | t | rebalance -> cluster -> swap|In general we need to do [ cluster change -> swap -> rebalance state change ] NOTE: The update of the cluster metadata and the rebalancer state is not "atomic". Ergo, there could theoretically be a race where a client picks up new cluster metadata sends a request based on that, but the proxy bridges have not been setup and we either miss a proxy put or return a null for get/getalls TODO:refactor The rollback logic here is too convoluted. Specifically, the independent updates to each key could be split up into their own methods.
cluster
- Cluster metadata to changerebalanceTaskInfo
- List of rebalance partitions infoswapRO
- Boolean to indicate swapping of RO storechangeClusterAndStoresMetadata
- Boolean to indicate a change of
cluster metadatachangeRebalanceState
- Boolean to indicate a change in rebalance
staterollback
- Boolean to indicate that we are rolling back or notpublic int rebalanceNode(RebalanceTaskInfo stealInfo)
stealInfo
- Partition info to steal
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |