-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
Sharding EMEA
-
Fully Compatible
-
ALL
-
v7.0
-
Sharding EMEA 2023-04-17
-
0
As part of introducing the defragmentation policy, we introduced new threads in the balancer. These different threads are using the same random_device to shuffle different vectors, causing data races.
Currently, we are using std::random_device in:
- balancer_chunk_selection_policy_impl.cpp
- balancer_chunk_selection_policy_impl.cpp
- balancer_defragmentation_policy_impl.cpp
- balancer.cpp
We instead need to use the Client local Prng when using std::shuffle as:
Client * client = ...; std::shuffle(begin, end, client->getPrng().urbg());
With this implementation, we will not worry about thread-safety because the RNG is thread-local.
- related to
-
SERVER-70129 std::random_device should be created per thread in the balancer
- Closed