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 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 boolean |
isEqual(double d1,
double d2)
Returns true if d1 = d2, false otherwise.
|
static boolean |
isLarger(double d1,
double d2)
Returns true if d1 > d2, false otherwise.
|
static AcceptanceResult |
isProposalAcceptableForOptimizedGoals(Set<Goal> optimizedGoals,
BalancingAction proposal,
ClusterModel clusterModel)
Check whether the given proposal is acceptable for all of the given optimized goals.
|
static boolean |
isSmaller(double d1,
double d2)
Returns true if d1 < d2, false otherwise.
|
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 AcceptanceResult 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 boolean isSmaller(double d1, double d2)
public static boolean isLarger(double d1, double d2)
public static boolean isEqual(double d1, double d2)