kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jun...@apache.org
Subject git commit: kafka-1169; missing synchronization in access to leaderCache in KafkaApis; patched by Jun Rao; reviewed by Neha Narkhede
Date Thu, 05 Dec 2013 17:37:18 GMT
Updated Branches:
  refs/heads/trunk 8a2ba3f6f -> 7dee06ee9


kafka-1169; missing synchronization in access to leaderCache in KafkaApis; patched by Jun
Rao; reviewed by Neha Narkhede


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/7dee06ee
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/7dee06ee
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/7dee06ee

Branch: refs/heads/trunk
Commit: 7dee06ee99bf2610d71df04e4e5238a10a8388a2
Parents: 8a2ba3f
Author: Jun Rao <junrao@gmail.com>
Authored: Thu Dec 5 09:38:24 2013 -0800
Committer: Jun Rao <junrao@gmail.com>
Committed: Thu Dec 5 09:38:24 2013 -0800

----------------------------------------------------------------------
 core/src/main/scala/kafka/server/KafkaApis.scala | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/7dee06ee/core/src/main/scala/kafka/server/KafkaApis.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/kafka/server/KafkaApis.scala b/core/src/main/scala/kafka/server/KafkaApis.scala
index c9f92a2..29abc46 100644
--- a/core/src/main/scala/kafka/server/KafkaApis.scala
+++ b/core/src/main/scala/kafka/server/KafkaApis.scala
@@ -519,8 +519,11 @@ class KafkaApis(val requestChannel: RequestChannel,
     uniqueTopics = {
       if(metadataRequest.topics.size > 0)
         metadataRequest.topics.toSet
-      else
-        leaderCache.keySet.map(_.topic)
+      else {
+        partitionMetadataLock synchronized {
+          leaderCache.keySet.map(_.topic)
+        }
+      }
     }
     val topicMetadataList =
       partitionMetadataLock synchronized {


Mime
View raw message