public class

PartitionedRebalancerConfig

extends BasicRebalancerConfig
implements ReplicatedRebalancerConfig
java.lang.Object
   ↳ org.apache.helix.controller.rebalancer.config.BasicRebalancerConfig
     ↳ org.apache.helix.controller.rebalancer.config.PartitionedRebalancerConfig
Known Direct Subclasses

Class Overview

RebalancerConfig for a resource whose subunits are partitions. In addition, these partitions can be replicated.

Summary

Nested Classes
class PartitionedRebalancerConfig.AbstractBuilder<T extends AbstractBuilder<T>> Abstract builder for a generic partitioned resource rebalancer config  
class PartitionedRebalancerConfig.Builder Builder for a basic data rebalancer config  
Public Constructors
PartitionedRebalancerConfig()
Instantiate a PartitionedRebalancerConfig
Public Methods
boolean anyLiveParticipant()
Check if this resource should be assigned to any live participant
static PartitionedRebalancerConfig from(RebalancerConfig config)
static PartitionedRebalancerConfig from(IdealState idealState)
Convert a physically-stored IdealState into a rebalancer config for a partitioned resource
void generateDefaultConfiguration(StateModelDefinition stateModelDef, Set<ParticipantId> participantSet)
Generate a default configuration given the state model and a participant.
int getMaxPartitionsPerParticipant()
Get the maximum number of partitions that a participant can serve
Partition getPartition(PartitionId partitionId)
Get a partition
Map<PartitionIdPartition> getPartitionMap()
Get a map from partition id to partition
Set<PartitionId> getPartitionSet()
Get the set of partitions for this resource
IdealState.RebalanceMode getRebalanceMode()
Get the rebalancer mode of the resource
int getReplicaCount()
Get the number of replicas that each resource subunit should have
Map<PartitionIdPartition> getSubUnitMap()
Get a map of resource partition identifiers to partitions.
void setAnyLiveParticipant(boolean anyLiveParticipant)
Indicate if this resource should be assigned to any live participant
void setMaxPartitionsPerParticipant(int maxPartitionsPerParticipant)
Set the maximum number of partitions that a participant can serve
void setPartitionMap(Map<PartitionIdPartition> partitionMap)
Set a map of partition id to partition
void setRebalanceMode(IdealState.RebalanceMode rebalanceMode)
Set the rebalancer mode of the partitioned resource
void setReplicaCount(int replicaCount)
Set the number of replicas that each partition should have
[Expand]
Inherited Methods
From class org.apache.helix.controller.rebalancer.config.BasicRebalancerConfig
From class java.lang.Object
From interface org.apache.helix.controller.rebalancer.config.RebalancerConfig
From interface org.apache.helix.controller.rebalancer.config.ReplicatedRebalancerConfig

Public Constructors

public PartitionedRebalancerConfig ()

Instantiate a PartitionedRebalancerConfig

Public Methods

public boolean anyLiveParticipant ()

Check if this resource should be assigned to any live participant

Returns
  • true if any live participant expected, false otherwise

public static PartitionedRebalancerConfig from (RebalancerConfig config)

Parameters
config the base config
Returns

public static PartitionedRebalancerConfig from (IdealState idealState)

Convert a physically-stored IdealState into a rebalancer config for a partitioned resource

Parameters
idealState populated IdealState
Returns
  • PartitionedRebalancerConfig

public void generateDefaultConfiguration (StateModelDefinition stateModelDef, Set<ParticipantId> participantSet)

Generate a default configuration given the state model and a participant.

Parameters
stateModelDef the state model definition to follow
participantSet the set of participant ids to configure for

public int getMaxPartitionsPerParticipant ()

Get the maximum number of partitions that a participant can serve

Returns
  • maximum number of partitions per participant

public Partition getPartition (PartitionId partitionId)

Get a partition

Parameters
partitionId id of the partition to get
Returns
  • Partition object, or null if not present

public Map<PartitionIdPartition> getPartitionMap ()

Get a map from partition id to partition

Returns
  • partition map (mutable)

public Set<PartitionId> getPartitionSet ()

Get the set of partitions for this resource

Returns
  • set of partition ids

public IdealState.RebalanceMode getRebalanceMode ()

Get the rebalancer mode of the resource

Returns
  • RebalanceMode

public int getReplicaCount ()

Get the number of replicas that each resource subunit should have

Returns
  • replica count

public Map<PartitionIdPartition> getSubUnitMap ()

Get a map of resource partition identifiers to partitions. A partition is a subunit of a resource, e.g. a subtask of a task

Returns
  • map of (subunit id, subunit) pairs

public void setAnyLiveParticipant (boolean anyLiveParticipant)

Indicate if this resource should be assigned to any live participant

Parameters
anyLiveParticipant true if any live participant expected, false otherwise

public void setMaxPartitionsPerParticipant (int maxPartitionsPerParticipant)

Set the maximum number of partitions that a participant can serve

Parameters
maxPartitionsPerParticipant maximum number of partitions per participant

public void setPartitionMap (Map<PartitionIdPartition> partitionMap)

Set a map of partition id to partition

Parameters
partitionMap partition map

public void setRebalanceMode (IdealState.RebalanceMode rebalanceMode)

Set the rebalancer mode of the partitioned resource

Parameters
rebalanceMode IdealState.RebalanceMode enum value

public void setReplicaCount (int replicaCount)

Set the number of replicas that each partition should have