Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partition key not working properly‏ with hard code keys #22

Open
feicun opened this issue Dec 10, 2014 · 1 comment
Open

Partition key not working properly‏ with hard code keys #22

feicun opened this issue Dec 10, 2014 · 1 comment

Comments

@feicun
Copy link

feicun commented Dec 10, 2014

This issue is hard to be described within a few words, but I posted it on Stackoverflow, please head to this link for full explanation: http://stackoverflow.com/questions/27373594/kafka-partition-key-not-working-properly .

Actually I'm not sure it is a bug or not, but serejja suggested me to open an issue here.

My guess for this issue is, the producer should be defined like this
val producer = new Producer[String, String](someConfig)
rather than
val producer = new Producer[AnyRef, AnyRef](someConfig)
then the internal default partitioner should work.

@deanchen
Copy link

Also ran in to this bug, with a String as the partition key. The HashCode for Array[Byte] is different regardless of contents.

Array[Byte](0, 1).hashCode != Array[Byte](0, 1).hashCode

deanchen added a commit to deanchen/scala-kafka that referenced this issue Dec 26, 2014
Fixes elodina#22

Array[Byte] does not have the identical hashcode even given identical contents. List[Byte] has the desired hashcode property at the cost of some performance.
deanchen added a commit to deanchen/scala-kafka that referenced this issue Dec 26, 2014
Fixes elodina#22

Force partition to be String since Array[Byte](1).hashcode != Array[Byte](1).hashcode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants