public class

SemiAutoRebalancer

extends Object
implements HelixRebalancer
java.lang.Object
   ↳ org.apache.helix.controller.rebalancer.SemiAutoRebalancer

Class Overview

Rebalancer for the SEMI_AUTO mode. It expects a RebalancerConfig that understands the preferred locations of each partition replica

Summary

Public Constructors
SemiAutoRebalancer()
Public Methods
ResourceAssignment computeResourceMapping(RebalancerConfig rebalancerConfig, Cluster cluster, ResourceCurrentState currentState)
Given an ideal state for a resource and liveness of participants, compute a assignment of instances and states to each partition of a resource.
void init(HelixManager helixManager)
Initialize the rebalancer with a HelixManager if necessary
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.apache.helix.controller.rebalancer.HelixRebalancer

Public Constructors

public SemiAutoRebalancer ()

Public Methods

public ResourceAssignment computeResourceMapping (RebalancerConfig rebalancerConfig, Cluster cluster, ResourceCurrentState currentState)

Given an ideal state for a resource and liveness of participants, compute a assignment of instances and states to each partition of a resource. This method provides all the relevant information needed to rebalance a resource. If you need additional information use manager.getAccessor to read and write the cluster data. This allows one to compute the ResourceAssignment according to app-specific requirements.

Say that you have:

 class MyRebalancerContext implements RebalancerContext
 
as your rebalancer context. To extract it from a RebalancerConfig, do the following:
 MyRebalancerContext context = rebalancerConfig.getRebalancerContext(MyRebalancerContext.class);
 

Parameters
rebalancerConfig the properties of the resource for which a mapping will be computed
cluster complete snapshot of the cluster
currentState the current states of all partitions

public void init (HelixManager helixManager)

Initialize the rebalancer with a HelixManager if necessary