[SERVER-74202] Update balancer to use client local Prng for thread-safe shuffling Created: 21/Feb/23 Updated: 29/Oct/23 Resolved: 17/Apr/23 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 7.0.0-rc0, 7.1.0-rc0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Pol Pinol | Assignee: | Pol Pinol |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | sharding-wfbf-day | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Assigned Teams: |
Sharding EMEA
|
||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||
| Operating System: | ALL | ||||||||||||||||
| Backport Requested: |
v7.0
|
||||||||||||||||
| Sprint: | Sharding EMEA 2023-04-17 | ||||||||||||||||
| Participants: | |||||||||||||||||
| Linked BF Score: | 0 | ||||||||||||||||
| Description |
|
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:
We instead need to use the Client local Prng when using std::shuffle as:
With this implementation, we will not worry about thread-safety because the RNG is thread-local. |
| Comments |
| Comment by Githook User [ 19/Apr/23 ] |
|
Author: {'name': 'Pol Pinol Castuera', 'email': 'pol.pinol@mongodb.com', 'username': 'PolPinol'}Message: (cherry picked from commit 6a90a4d95b2f3c1f2619d332dd9d73fb39fe6167) |
| Comment by Githook User [ 17/Apr/23 ] |
|
Author: {'name': 'Pol Pinol Castuera', 'email': 'pol.pinol@mongodb.com', 'username': 'PolPinol'}Message: |