public class

CustomRebalancer

extends Object
implements Rebalancer MappingCalculator
java.lang.Object
   ↳ org.apache.helix.controller.rebalancer.CustomRebalancer

Class Overview

This is a Rebalancer specific to custom mode. It is tasked with checking an existing mapping of partitions against the set of live instances to mark assignment states as dropped or erroneous as necessary. The input is the required current assignment of partitions to instances, as well as the required existing instance preferences. The output is a verified mapping based on that preference list, i.e. partition p has a replica on node k with state s, where s may be a dropped or error state if necessary.

Summary

Public Constructors
CustomRebalancer()
Public Methods
ResourceAssignment computeBestPossiblePartitionState(ClusterDataCache cache, IdealState idealState, Resource resource, CurrentStateOutput currentStateOutput)
Given an ideal state for a resource and the liveness of instances, compute the best possible state assignment for each partition's replicas.
IdealState computeNewIdealState(String resourceName, IdealState currentIdealState, CurrentStateOutput currentStateOutput, ClusterDataCache clusterData)
This method provides all the relevant information needed to rebalance a resource.
void init(HelixManager manager)
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.apache.helix.controller.rebalancer.Rebalancer
From interface org.apache.helix.controller.rebalancer.internal.MappingCalculator

Public Constructors

public CustomRebalancer ()

Public Methods

public ResourceAssignment computeBestPossiblePartitionState (ClusterDataCache cache, IdealState idealState, Resource resource, CurrentStateOutput currentStateOutput)

Given an ideal state for a resource and the liveness of instances, compute the best possible state assignment for each partition's replicas.

Parameters
currentStateOutput Provides the current state and pending state transitions for all partitions

public IdealState computeNewIdealState (String resourceName, IdealState currentIdealState, CurrentStateOutput currentStateOutput, ClusterDataCache clusterData)

This method provides all the relevant information needed to rebalance a resource. If you need additional information use manager.getAccessor to read the cluster data. This allows one to compute the newIdealState according to app specific requirement.

Parameters
resourceName Name of the resource to be rebalanced
currentStateOutput Provides the current state and pending state transition for all partitions
clusterData Provides additional methods to retrieve cluster data.

public void init (HelixManager manager)