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

Avoid creation of extra Map for futures in KafkaAdminClient

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Later
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      Description

      In various methods from KafkaAdminClient, there is extra Map created when constructing XXResult instance.
      e.g.

              return new DescribeReplicaLogDirResult(new HashMap<TopicPartitionReplica, KafkaFuture<ReplicaLogDirInfo>>(futures));
      

      Prior to returning, futures Map is already filled.
      Calling get() and values() does not involve the internals of HashMap when we consider thread-safety.

      The extra Map doesn't need to be created.

        Issue Links

          Activity

          Hide
          yuzhihong@gmail.com Ted Yu added a comment -

          I have run KafkaAdminClientTest thru the patch which passed.

          Show
          yuzhihong@gmail.com Ted Yu added a comment - I have run KafkaAdminClientTest thru the patch which passed.
          Hide
          githubbot ASF GitHub Bot added a comment -

          GitHub user tedyu opened a pull request:

          https://github.com/apache/kafka/pull/3925

          KAFKA-5911 Avoid creation of extra Map for futures in KafkaAdminClient

          This reduces creation of garbage while keeping thread safety untouched.

          You can merge this pull request into a Git repository by running:

          $ git pull https://github.com/tedyu/kafka trunk

          Alternatively you can review and apply these changes as the patch at:

          https://github.com/apache/kafka/pull/3925.patch

          To close this pull request, make a commit to your master/trunk branch
          with (at least) the following in the commit message:

          This closes #3925


          commit b53379ed9a327b2c195dffc4c5d537fb0a0ace13
          Author: tedyu <yuzhihong@gmail.com>
          Date: 2017-09-20T21:09:21Z

          KAFKA-5911 Avoid creation of extra Map for futures in KafkaAdminClient


          Show
          githubbot ASF GitHub Bot added a comment - GitHub user tedyu opened a pull request: https://github.com/apache/kafka/pull/3925 KAFKA-5911 Avoid creation of extra Map for futures in KafkaAdminClient This reduces creation of garbage while keeping thread safety untouched. You can merge this pull request into a Git repository by running: $ git pull https://github.com/tedyu/kafka trunk Alternatively you can review and apply these changes as the patch at: https://github.com/apache/kafka/pull/3925.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #3925 commit b53379ed9a327b2c195dffc4c5d537fb0a0ace13 Author: tedyu <yuzhihong@gmail.com> Date: 2017-09-20T21:09:21Z KAFKA-5911 Avoid creation of extra Map for futures in KafkaAdminClient

            People

            • Assignee:
              Unassigned
              Reporter:
              yuzhihong@gmail.com Ted Yu
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development