public class AnalyzerUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
BROKERS |
static double |
EPSILON |
static String |
LEADER_REPLICAS |
static String |
METADATA |
static String |
POTENTIAL_NW_OUT |
static String |
REPLICAS |
static String |
STATISTICS |
static String |
TOPIC_REPLICAS |
static String |
TOPICS |
Modifier and Type | Method and Description |
---|---|
static int |
compare(double d1,
double d2,
double epsilon)
Compare the given values.
|
static int |
compare(double d1,
double d2,
Resource resource)
Compare the given values.
|
static Map<String,Goal> |
getCaseInsensitiveGoalsByName(KafkaCruiseControlConfig config)
Get a goal map with goal name as the keys.
|
static Set<ExecutionProposal> |
getDiff(Map<org.apache.kafka.common.TopicPartition,List<ReplicaPlacementInfo>> initialReplicaDistribution,
Map<org.apache.kafka.common.TopicPartition,ReplicaPlacementInfo> initialLeaderDistribution,
Map<org.apache.kafka.common.TopicPartition,List<ReplicaPlacementInfo>> initialObserverDistribution,
ClusterModel optimizedClusterModel)
Get the diff represented by the set of balancing proposals to move from initial to final distribution.
|
static Set<ExecutionProposal> |
getDiff(Map<org.apache.kafka.common.TopicPartition,List<ReplicaPlacementInfo>> initialReplicaDistribution,
Map<org.apache.kafka.common.TopicPartition,ReplicaPlacementInfo> initialLeaderDistribution,
Map<org.apache.kafka.common.TopicPartition,List<ReplicaPlacementInfo>> initialObserverDistribution,
ClusterModel optimizedClusterModel,
boolean skipReplicationFactorChangeCheck)
Get the diff represented by the set of balancing proposals to move from initial to final distribution.
|
static List<Goal> |
getGoalsByPriority(KafkaCruiseControlConfig config)
Get the list of goals sorted by highest to lowest default priority.
|
static ActionAcceptance |
isProposalAcceptableForOptimizedGoals(Set<Goal> optimizedGoals,
BalancingAction proposal,
ClusterModel clusterModel)
Check whether the given proposal is acceptable for all of the given optimized goals.
|
static double[] |
testDifference(double[][] orig,
double[][] optimized)
Test if two clusters are significantly different in the metrics we look at for balancing.
|
public static final String BROKERS
public static final String REPLICAS
public static final String TOPICS
public static final String METADATA
public static final String POTENTIAL_NW_OUT
public static final String LEADER_REPLICAS
public static final String TOPIC_REPLICAS
public static final String STATISTICS
public static final double EPSILON
public static Set<ExecutionProposal> getDiff(Map<org.apache.kafka.common.TopicPartition,List<ReplicaPlacementInfo>> initialReplicaDistribution, Map<org.apache.kafka.common.TopicPartition,ReplicaPlacementInfo> initialLeaderDistribution, Map<org.apache.kafka.common.TopicPartition,List<ReplicaPlacementInfo>> initialObserverDistribution, ClusterModel optimizedClusterModel)
initialReplicaDistribution
- Initial distribution of replicas over the cluster.initialLeaderDistribution
- Initial distribution of the leaders.optimizedClusterModel
- The optimized cluster model.public static Set<ExecutionProposal> getDiff(Map<org.apache.kafka.common.TopicPartition,List<ReplicaPlacementInfo>> initialReplicaDistribution, Map<org.apache.kafka.common.TopicPartition,ReplicaPlacementInfo> initialLeaderDistribution, Map<org.apache.kafka.common.TopicPartition,List<ReplicaPlacementInfo>> initialObserverDistribution, ClusterModel optimizedClusterModel, boolean skipReplicationFactorChangeCheck)
initialReplicaDistribution
- Initial distribution of replicas over the cluster.initialLeaderDistribution
- Initial distribution of the leaders.optimizedClusterModel
- The optimized cluster model.skipReplicationFactorChangeCheck
- Whether skip sanity check of topic partition's replication factor change before
and after optimization.public static ActionAcceptance isProposalAcceptableForOptimizedGoals(Set<Goal> optimizedGoals, BalancingAction proposal, ClusterModel clusterModel)
optimizedGoals
- Optimized goals to check whether they accept the given proposal.proposal
- Proposal to be checked for acceptance.clusterModel
- The state of the cluster.ActionAcceptance.ACCEPT
if the given proposal is acceptable for all the given optimized goals, the
reject flag (e.g. ActionAcceptance.REPLICA_REJECT
, ActionAcceptance.BROKER_REJECT
) otherwise.public static int compare(double d1, double d2, Resource resource)
d1
- The first double
to compare.d2
- The second double
to compare.resource
- the resource the current comparison is for.public static int compare(double d1, double d2, double epsilon)
d1
- The first double
to compare.d2
- The second double
to compare.public static List<Goal> getGoalsByPriority(KafkaCruiseControlConfig config)
public static Map<String,Goal> getCaseInsensitiveGoalsByName(KafkaCruiseControlConfig config)
public static double[] testDifference(double[][] orig, double[][] optimized)
orig
- the utilization matrix from the original clusteroptimized
- the utilization matrix from the optimized cluster