public class GoalUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
MIN_NUM_VALID_WINDOWS_FOR_SELF_HEALING |
Modifier and Type | Method and Description |
---|---|
static double |
averageDiskUtilizationPercentage(Broker broker)
Get the latest average utilization percentage of all the alive disks on the broker.
|
static double |
diskUtilizationPercentage(Disk disk)
Get the latest utilization percentage of the disk, or
DEAD_DISK_UTILIZATION if the disk is dead. |
static void |
ensureNoOfflineReplicas(ClusterModel clusterModel,
java.lang.String goalName)
Checks the replicas that are supposed to be moved away from the dead brokers or broken disks have been moved.
|
static void |
ensureReplicasMoveOffBrokersWithBadDisks(ClusterModel clusterModel,
java.lang.String goalName)
Checks for the broker with broken disk, the partitions of the replicas used to be on its broken disk does not have
any replica on this broker.
|
static java.util.Set<Replica> |
filterReplicas(Broker broker,
boolean followersOnly,
boolean leadersOnly,
boolean immigrantsOnly)
Get a filtered set of replicas from the given broker based on given filtering requirements.
|
static double |
utilizationPercentage(Broker broker,
Resource resource)
Get the utilization percentage of the broker for the given resource, or
DEAD_BROKER_UTILIZATION if the
broker is dead. |
public static final int MIN_NUM_VALID_WINDOWS_FOR_SELF_HEALING
public static void ensureNoOfflineReplicas(ClusterModel clusterModel, java.lang.String goalName) throws OptimizationFailureException
clusterModel
- the cluster model to check.goalName
- Goal name for which the sanity check is executed.OptimizationFailureException
- when there are still replicas on the dead brokers or on broken disks.public static void ensureReplicasMoveOffBrokersWithBadDisks(ClusterModel clusterModel, java.lang.String goalName) throws OptimizationFailureException
clusterModel
- the cluster model to check.goalName
- Goal name for which the sanity check is executed.OptimizationFailureException
- when there are replicas hosted by broker with broken disk which belongs to the
same partition as the replica used to be hosted on broken diskspublic static java.util.Set<Replica> filterReplicas(Broker broker, boolean followersOnly, boolean leadersOnly, boolean immigrantsOnly)
broker
- Broker whose replicas will be filters.followersOnly
- True if replicas should be filtered to ensure that they contain only the followers.leadersOnly
- True if replicas should be filtered to ensure that they contain only the leaders.immigrantsOnly
- True if replicas should be filtered to ensure that they contain only the immigrants.public static double utilizationPercentage(Broker broker, Resource resource)
DEAD_BROKER_UTILIZATION
if the
broker is dead. The utilization percentage for resources is calculated from broker capacity and
Load.expectedUtilizationFor(Resource)
.broker
- Broker for which the resource utilization percentage has been queried.resource
- Resource for the utilization percentage.public static double averageDiskUtilizationPercentage(Broker broker)
broker
- Broker for which the average disk utilization percentage has been queried.public static double diskUtilizationPercentage(Disk disk)
DEAD_DISK_UTILIZATION
if the disk is dead.disk
- Disk to query.