kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jun...@apache.org
Subject svn commit: r1177516 - /incubator/kafka/trunk/core/src/main/scala/kafka/producer/DefaultPartitioner.scala
Date Fri, 30 Sep 2011 05:44:14 GMT
Author: junrao
Date: Fri Sep 30 05:44:13 2011
New Revision: 1177516

URL: http://svn.apache.org/viewvc?rev=1177516&view=rev
Log:
trival fix to make hash code positive; patched by Joel Koshy; reviewed by Jun Rao

Modified:
    incubator/kafka/trunk/core/src/main/scala/kafka/producer/DefaultPartitioner.scala

Modified: incubator/kafka/trunk/core/src/main/scala/kafka/producer/DefaultPartitioner.scala
URL: http://svn.apache.org/viewvc/incubator/kafka/trunk/core/src/main/scala/kafka/producer/DefaultPartitioner.scala?rev=1177516&r1=1177515&r2=1177516&view=diff
==============================================================================
--- incubator/kafka/trunk/core/src/main/scala/kafka/producer/DefaultPartitioner.scala (original)
+++ incubator/kafka/trunk/core/src/main/scala/kafka/producer/DefaultPartitioner.scala Fri
Sep 30 05:44:13 2011
@@ -24,6 +24,6 @@ private[kafka] class DefaultPartitioner[
     if(key == null)
       random.nextInt(numPartitions)
     else
-      key.hashCode % numPartitions
+      math.abs(key.hashCode) % numPartitions
   }
 }



Mime
View raw message