Skip to content

Commit 195e35e

Browse files
committed
Fix PartitionSizeAnomalyFinder, to be able to handle custom SELF_HEALING_PARTITION_SIZE_THRESHOLD_MB values
1 parent 2b81fb1 commit 195e35e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

cruise-control/src/main/java/com/linkedin/kafka/cruisecontrol/detector/PartitionSizeAnomalyFinder.java

+6-3
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,12 @@ public void configure(Map<String, ?> configs) {
108108
String topicExcludedFromCheck = (String) configs.get(TOPIC_EXCLUDED_FROM_PARTITION_SIZE_CHECK);
109109
_topicExcludedFromCheck = Pattern.compile(topicExcludedFromCheck == null ? DEFAULT_TOPIC_EXCLUDED_FROM_PARTITION_SIZE_CHECK
110110
: topicExcludedFromCheck);
111-
Integer partitionSizeThreshold = (Integer) configs.get(SELF_HEALING_PARTITION_SIZE_THRESHOLD_MB_CONFIG);
112-
_partitionSizeThresholdInMb = partitionSizeThreshold == null ? DEFAULT_SELF_HEALING_PARTITION_SIZE_THRESHOLD_MB
113-
: partitionSizeThreshold;
111+
String partitionSizeThresholdStr = (String) configs.get(SELF_HEALING_PARTITION_SIZE_THRESHOLD_MB_CONFIG);
112+
_partitionSizeThresholdInMb = DEFAULT_SELF_HEALING_PARTITION_SIZE_THRESHOLD_MB;
113+
if (partitionSizeThresholdStr != null) {
114+
_partitionSizeThresholdInMb = Integer.parseInt(partitionSizeThresholdStr.trim());
115+
}
116+
114117
String topicPartitionSizeAnomalyClass = (String) configs.get(TOPIC_PARTITION_SIZE_ANOMALY_CLASS_CONFIG);
115118
if (topicPartitionSizeAnomalyClass == null) {
116119
_topicPartitionSizeAnomalyClass = DEFAULT_TOPIC_PARTITION_SIZE_ANOMALY_CLASS;

0 commit comments

Comments
 (0)