[ https://issues.apache.org/jira/browse/KAFKA-569?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13475443#comment-13475443 ]
Jay Kreps commented on KAFKA-569: --------------------------------- Oh my, good catch. BTW, in fixing this I found a rare bug in DefaultPartitioner which does a similar thing. The cause is that we take math.abs(key.hashCode) % numPartitions The problem with this is that since the creators of java hate all living things they made java.lang.Math.abs return a negative number when given Integer.MIN_VALUE (since it has no equivalent positive integer). Sooner or later hashCode() will return a negative value, which would cause this. I am adding a new method in Utils (how apt) def abs(n: Int) = n & 0x7fffffff That should fix this. Not sure if we ever saw this happen in practice. > Cleanup kafka.utils.Utils > ------------------------- > > Key: KAFKA-569 > URL: https://issues.apache.org/jira/browse/KAFKA-569 > Project: Kafka > Issue Type: Bug > Affects Versions: 0.8 > Reporter: Jay Kreps > Assignee: Jay Kreps > Attachments: KAFKA-569.patch, KAFKA-569-v2.patch > > > kafka.utils.Utils is a real mess. It is full of odd little pieces of business > logic dropped there. We should clean this up. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira