-
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
[C++] SinglePartition message router is always picking the same partition #9702
Conversation
ProducerConfiguration::HashingScheme hashingScheme) | ||
: MessageRouterBase(hashingScheme) { | ||
boost::random::mt19937 rng(std::chrono::high_resolution_clock::now().time_since_epoch().count()); | ||
boost::random::uniform_int_distribution<int> dist; |
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.
Should we use std::random
from C++ standard library instead of boost::random
?
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.
Good point. Fixed.
There are also other places where we use it. They should get converted as well .
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.
Yeah, in BackOff.cc
and RoundRobinMessageRouter.cc
.
Motivation
The
SinglePartitionMessageRouter
is supposed to pick a random partition for a given producer and to stick with that. The problem is that the Crand()
call is always using the seed 0 and that ends up having multiple processes to always deterministically pick the same partition.