Skip to content

Commit

Permalink
Fix a bug so that the value of the config topic-management.preferred.…
Browse files Browse the repository at this point in the history
…leader.election.check.interval.ms can be set to the MultiClusterTopicManagementService (#338)
  • Loading branch information
Lincong Li authored Feb 6, 2021
1 parent 687e045 commit 36a93e6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,14 @@ private static ArgumentParser argParser() {
.dest("rebalanceMs")
.help(MultiClusterTopicManagementServiceConfig.REBALANCE_INTERVAL_MS_DOC);

parser.addArgument("--topic-preferred-leader-election-interval-ms")
.action(net.sourceforge.argparse4j.impl.Arguments.store())
.required(false)
.type(Integer.class)
.metavar("PREFERED_LEADER_ELECTION_INTERVAL_MS")
.dest("preferredLeaderElectionIntervalMs")
.help(MultiClusterTopicManagementServiceConfig.PREFERRED_LEADER_ELECTION_CHECK_INTERVAL_MS_DOC);

return parser;
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,14 @@ private Map<String, Object> createMultiClusterTopicManagementServiceProps(Map<St
Map<String, Object> serviceProps = new HashMap<>();
serviceProps.put(MultiClusterTopicManagementServiceConfig.PROPS_PER_CLUSTER_CONFIG, configPerCluster);
serviceProps.put(MultiClusterTopicManagementServiceConfig.TOPIC_CONFIG, props.get(TopicManagementServiceConfig.TOPIC_CONFIG));
if (props.containsKey(MultiClusterTopicManagementServiceConfig.REBALANCE_INTERVAL_MS_CONFIG))
serviceProps.put(MultiClusterTopicManagementServiceConfig.REBALANCE_INTERVAL_MS_CONFIG, props.get(MultiClusterTopicManagementServiceConfig.REBALANCE_INTERVAL_MS_CONFIG));
Object providedRebalanceIntervalMsConfig = props.get(MultiClusterTopicManagementServiceConfig.REBALANCE_INTERVAL_MS_CONFIG);
if (providedRebalanceIntervalMsConfig != null) {
serviceProps.put(MultiClusterTopicManagementServiceConfig.REBALANCE_INTERVAL_MS_CONFIG, providedRebalanceIntervalMsConfig);
}
Object providedPreferredLeaderElectionIntervalMsConfig = props.get(MultiClusterTopicManagementServiceConfig.PREFERRED_LEADER_ELECTION_CHECK_INTERVAL_MS_CONFIG);
if (providedPreferredLeaderElectionIntervalMsConfig != null) {
serviceProps.put(MultiClusterTopicManagementServiceConfig.PREFERRED_LEADER_ELECTION_CHECK_INTERVAL_MS_CONFIG, providedPreferredLeaderElectionIntervalMsConfig);
}
return serviceProps;
}

Expand Down

0 comments on commit 36a93e6

Please sign in to comment.