-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[fix][broker] Fix hash collision when using a consumer name that ends with a number #22053
[fix][broker] Fix hash collision when using a consumer name that ends with a number #22053
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 In the end, there would always be the possibility of conflict, though it would not impair the correctness. Even if we have 2 different keys hashing to the same bucket, one or the other consumer will get the messages, and with 100 points even few conflict shouldn't be skewing the assignments significantly.
… with a number (apache#22053) (cherry picked from commit ae2299c)
… with a number (apache#22053) (cherry picked from commit ae2299c)
Fixes #22050
Motivation
See #22050, there's a hash collision in ConsistentHashingStickyKeyConsumerSelector when the consumer name ends with a number for example "consumer1" and "consumer11" would collide for the key "consumer111" (consumer1, i=11 & consumer11, i=1).
Modifications
Fix hash collision by adding a separator between the 2 fields used in the hash calculation. Use the NUL character (
\0
) as a separator.Documentation
doc
doc-required
doc-not-needed
doc-complete