Info
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 SERVER-51476.
Similar to the fix in SERVER-57267.
Abseil at head actually already has absl::erase_if overloads for the containers so we can bring that into stdx later.
Top User Comments
JIRAUSER1259052 commented on Wed, 6 Oct 2021 18:31:28 +0000:
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!
xgen-internal-githook commented on Mon, 7 Jun 2021 22:23:26 +0000:
Author:
{'name': 'Billy Donahue', 'email': 'billy.donahue@mongodb.com', 'username': 'BillyDonahue'}
Message: SERVER-57477 stdx::erase_if for stdx::unordered_map
Fix loops that erase elements of the container while iterating over it.
revert api_version_metrics.cpp
Branch: master
https://github.com/mongodb/mongo/commit/f63751ef3dbe5513211e74f0554b42e466ae9711
billy.donahue commented on Sat, 5 Jun 2021 22:43:28 +0000:
Bug in api_version_metrics.cpp introduced by SERVER-49965,
which was released in 4.7.
billy.donahue commented on Sat, 5 Jun 2021 20:23:41 +0000:
Code Review
https://mongodbcr.appspot.com/800010001/