Skip to content

Commit 36a93e6

Browse files
author
Lincong Li
authored
Fix a bug so that the value of the config topic-management.preferred.leader.election.check.interval.ms can be set to the MultiClusterTopicManagementService (#338)
1 parent 687e045 commit 36a93e6

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

src/main/java/com/linkedin/xinfra/monitor/apps/SingleClusterMonitor.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,14 @@ private static ArgumentParser argParser() {
309309
.dest("rebalanceMs")
310310
.help(MultiClusterTopicManagementServiceConfig.REBALANCE_INTERVAL_MS_DOC);
311311

312+
parser.addArgument("--topic-preferred-leader-election-interval-ms")
313+
.action(net.sourceforge.argparse4j.impl.Arguments.store())
314+
.required(false)
315+
.type(Integer.class)
316+
.metavar("PREFERED_LEADER_ELECTION_INTERVAL_MS")
317+
.dest("preferredLeaderElectionIntervalMs")
318+
.help(MultiClusterTopicManagementServiceConfig.PREFERRED_LEADER_ELECTION_CHECK_INTERVAL_MS_DOC);
319+
312320
return parser;
313321
}
314322

@@ -360,6 +368,8 @@ public static void main(String[] args) throws Exception {
360368
props.put(TopicManagementServiceConfig.TOPIC_REPLICATION_FACTOR_CONFIG, res.getInt("replicationFactor"));
361369
if (res.getInt("rebalanceMs") != null)
362370
props.put(MultiClusterTopicManagementServiceConfig.REBALANCE_INTERVAL_MS_CONFIG, res.getInt("rebalanceMs"));
371+
if (res.getLong("preferredLeaderElectionIntervalMs") != null)
372+
props.put(MultiClusterTopicManagementServiceConfig.PREFERRED_LEADER_ELECTION_CHECK_INTERVAL_MS_CONFIG, res.getLong("preferredLeaderElectionIntervalMs"));
363373
SingleClusterMonitor app = new SingleClusterMonitor(props, "single-cluster-monitor");
364374
app.start();
365375

src/main/java/com/linkedin/xinfra/monitor/services/TopicManagementService.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,14 @@ private Map<String, Object> createMultiClusterTopicManagementServiceProps(Map<St
5858
Map<String, Object> serviceProps = new HashMap<>();
5959
serviceProps.put(MultiClusterTopicManagementServiceConfig.PROPS_PER_CLUSTER_CONFIG, configPerCluster);
6060
serviceProps.put(MultiClusterTopicManagementServiceConfig.TOPIC_CONFIG, props.get(TopicManagementServiceConfig.TOPIC_CONFIG));
61-
if (props.containsKey(MultiClusterTopicManagementServiceConfig.REBALANCE_INTERVAL_MS_CONFIG))
62-
serviceProps.put(MultiClusterTopicManagementServiceConfig.REBALANCE_INTERVAL_MS_CONFIG, props.get(MultiClusterTopicManagementServiceConfig.REBALANCE_INTERVAL_MS_CONFIG));
61+
Object providedRebalanceIntervalMsConfig = props.get(MultiClusterTopicManagementServiceConfig.REBALANCE_INTERVAL_MS_CONFIG);
62+
if (providedRebalanceIntervalMsConfig != null) {
63+
serviceProps.put(MultiClusterTopicManagementServiceConfig.REBALANCE_INTERVAL_MS_CONFIG, providedRebalanceIntervalMsConfig);
64+
}
65+
Object providedPreferredLeaderElectionIntervalMsConfig = props.get(MultiClusterTopicManagementServiceConfig.PREFERRED_LEADER_ELECTION_CHECK_INTERVAL_MS_CONFIG);
66+
if (providedPreferredLeaderElectionIntervalMsConfig != null) {
67+
serviceProps.put(MultiClusterTopicManagementServiceConfig.PREFERRED_LEADER_ELECTION_CHECK_INTERVAL_MS_CONFIG, providedPreferredLeaderElectionIntervalMsConfig);
68+
}
6369
return serviceProps;
6470
}
6571

0 commit comments

Comments
 (0)