I'm working on a disaster recovery feature where I need to determine the Kafka partition of a given key in order to replay messages from that partition. I've read that if a key is provided to Kafka, it will use murmur2(key) % numOfPartitions
however this doesn't seem to be what is happening in implementation.
Here's a table with the keys, the result of murmur2(key) % numOfParitions, and what it's actually partitioning to.
key | murmur2 % 3 | Actual partition |
---|---|---|
AF42CC55DFC84DBC881743CEC2733A22 | 1 | 2 |
209BFB14708147319571502816D3D100 | 0 | 0 |
5A8DE05847404D1DA856EF8E35AE3830 | 2 | 1 |
The topic has 3 partitions and I'm using this online murmurhash2 32-bit algorithm: http://murmurhash.shorelabs.com/
Note the discrepancy in the 1st and 3rd keys - the actual partition does not match the calculated hashed partition.
DefaultPartitioner is a Partitioner that uses a 32-bit murmur2 hash to compute the partition for a record (with the key defined) or chooses a partition in a round-robin fashion (per the available partitions of the topic).
Any ideas why the keys AF42CC55DFC84DBC881743CEC2733A22
and 5A8DE05847404D1DA856EF8E35AE3830
are not being stored in the murmur2 hashed partition?