Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-10094

In MirrorSourceConnector replace two-step assignment with single call

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • None
    • None
    • mirrormaker

    Description

      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.

       

          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);

       

       

      Attachments

        Issue Links

          Activity

            People

              mmtillu Mandar Tillu
              jghoman Jakob Homan
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: