[ 
https://issues.apache.org/jira/browse/KAFKA-10094?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jakob Homan resolved KAFKA-10094.
---------------------------------
    Resolution: Fixed

> In MirrorSourceConnector replace two-step assignment with single call
> ---------------------------------------------------------------------
>
>                 Key: KAFKA-10094
>                 URL: https://issues.apache.org/jira/browse/KAFKA-10094
>             Project: Kafka
>          Issue Type: Improvement
>          Components: mirrormaker
>            Reporter: Jakob Homan
>            Assignee: Mandar Tillu
>            Priority: Trivial
>              Labels: newbie
>
> n.b. This is a newbie ticket designed to be an introduction to contributing 
> for the assignee.
>  
> In MirrorSourceConnector::refreshTopicPartitions we have places where we 
> create a new HashSet and then addAll to the set.  We can replace both with a 
> direct call to the copy constructor.
>  
> {code:java}
>     void refreshTopicPartitions()
>             throws InterruptedException, ExecutionException {
>         knownSourceTopicPartitions = findSourceTopicPartitions();
>         knownTargetTopicPartitions = findTargetTopicPartitions();
>         List<TopicPartition> upstreamTargetTopicPartitions = 
> knownTargetTopicPartitions.stream()
>                 .map(x -> new 
> TopicPartition(replicationPolicy.upstreamTopic(x.topic()), x.partition()))
>                 .collect(Collectors.toList());
>         Set<TopicPartition> newTopicPartitions = new HashSet<>();
>         newTopicPartitions.addAll(knownSourceTopicPartitions);
>         newTopicPartitions.removeAll(upstreamTargetTopicPartitions);
>         Set<TopicPartition> deadTopicPartitions = new HashSet<>();
>         deadTopicPartitions.addAll(upstreamTargetTopicPartitions);{code}
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to