liftbridge-io / go-liftbridge

Go client for Liftbridge. https://github.com/liftbridge-io/liftbridge
Apache License 2.0
67 stars 18 forks source link

Hi. #53

Closed pervrosen closed 4 years ago

pervrosen commented 4 years ago

I have been playing around with this example and possibly found an error. (message.go row 235:) return int32(hasher(key)) % partitions should be changed to (message.go row 235:) return int32(hasher(key) % uint32(partitions))

Why? It seems that the hasher function gives too large numbers and the conversion from uint to int will give negative numbers. Eg. int32: –2147483648 to 2147483647 uint32: 0 to 4294967295

BTW. I like this liftbridge and will certainly do something with it in the future. We use kafka, but I like this more - way more... Because of golang and speed.

tylertreat commented 4 years ago

I had just discovered this bug yesterday but ran out of time to look into it. Thanks so much for tracking it down. I'll get it fixed up.