[SERVER-50189] Replace ReplicaSetMonitorManager::removeMonitor with a custom deleter for shared_ptr<ReplicaSetMonitor> Created: 07/Aug/20 Updated: 12/Dec/23 |
|
| Status: | Backlog |
| Project: | Core Server |
| Component/s: | Replication, Sharding |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Esha Maharishi (Inactive) | Assignee: | Backlog - Cluster Scalability |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | sharding-common-backlog, sharding-nyc-subteam2 | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||
| Assigned Teams: |
Cluster Scalability
|
||||||||||||||||||||||||||||||||
| Sprint: | Sharding 2020-08-24 | ||||||||||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||||||||||
| Story Points: | 3 | ||||||||||||||||||||||||||||||||
| Description |
|
ReplicaSetMonitorManager stores ReplicaSetMonitors by weak_ptr so that the ReplicaSetMonitor is destroyed when the last shared_ptr reference to it goes out of scope. However, ReplicaSetMonitorManager also has a removeMonitor function, which currently the holder of the last shared_ptr reference has to call to remove the entry for the ReplicaSetMonitor from the ReplicaSetMonitorManager's map. Instead, the shared_ptr to ReplicaSetMonitor could be created with a custom deleter that removes the entry from the map, like:
See also https://en.cppreference.com/w/cpp/memory/shared_ptr/shared_ptr. There are a couple complications:
|
| Comments |
| Comment by Andrew Shuvalov (Inactive) [ 08/Oct/20 ] |
|
I'm trying this again but with only minimal changes:
And I expect a lot of tests to fail, which could be hard to fix but unfortunately cleaning up the circular dependency is inevitable one day anyway
Test failures so far: https://spruce.mongodb.com/version/5f7f846c3e8e864890e64103/tasks
The error is during the shutdown, key log entry:
|