[SERVER-57477] stdx::erase_if for stdx::unordered_map Created: 05/Jun/21 Updated: 29/Oct/23 Resolved: 10/Jun/21 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 5.1.0-rc0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Billy Donahue | Assignee: | Billy Donahue |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||||||||||||
| Backport Requested: |
v5.0, v4.9
|
||||||||||||||||||||||||||||
| Sprint: | Service Arch 2021-06-14 | ||||||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||||||
| Description |
|
Introduce a stdx::erase_if that properly handles absl::node_hash_map, which has the peculiar semantics that erase(pos) doesn't return an iterator but also doesn't change traversal order. Call this erase_if function to repair range based for loops where an element can be erased from the range, and similar code. This work must be done on its own merits as the codebase is currently suffering UB from these erased iterators, but it also unblocks abseil upgrade Similar to the fix in Abseil at head actually already has absl::erase_if overloads for the containers so we can bring that into stdx later. |
| Comments |
| Comment by Vivian Ge (Inactive) [ 06/Oct/21 ] |
|
Updating the fixversion since branching activities occurred yesterday. This ticket will be in rc0 when it’s been triggered. For more active release information, please keep an eye on #server-release. Thank you! |
| Comment by Githook User [ 07/Jun/21 ] |
|
Author: {'name': 'Billy Donahue', 'email': 'billy.donahue@mongodb.com', 'username': 'BillyDonahue'}Message: Fix loops that erase elements of the container while iterating over it. revert api_version_metrics.cpp |
| Comment by Billy Donahue [ 05/Jun/21 ] |
|
Bug in api_version_metrics.cpp introduced by |
| Comment by Billy Donahue [ 05/Jun/21 ] |
|
Code Review |