[SERVER-23345] RAII semantics for ReplicaSetMonitor Created: 25/Mar/16 Updated: 28/Sep/16 Resolved: 01/Aug/16 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Sharding |
| Affects Version/s: | None |
| Fix Version/s: | 3.3.11 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Misha Tyulenev | Assignee: | Misha Tyulenev |
| Resolution: | Done | Votes: | 0 |
| Labels: | PM550 | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||||
| Sprint: | Sharding 14 (05/13/16), Sharding 15 (06/03/16), Sharding 16 (06/24/16), Sharding 18 (08/05/16) | ||||||||||||||||||||
| Participants: | |||||||||||||||||||||
| Linked BF Score: | 0 | ||||||||||||||||||||
| Description |
|
Delegate the cleanup of resources used by ReplicaSetMonitor the do its d-tor. Currently its done in ReplicaSetMonitor::remove() . a) Change ReplicaSetMonitorManager _monitors type to StringMap<std::weak_ptr<RepliceSetMonitor>> b) ReplicaSetMonitor::~ReplicaSetMonitor will now be called when it goes out of scope and hence it should erase itself from the _monitors map. c) ReplicaSetMonitorManager::getMonitor should d) disallow calling ReplicaSetMonitor::remove() - make its private or delete if not needed e) Optionally in the case there is need to get a shared_ptr from ReplicaSetMonitor object: derive ReplicaSetMonitor from enable_shared_from_this and use shared_from_this() call to get shared_ptr. |
| Comments |
| Comment by Misha Tyulenev [ 01/Aug/16 ] |
|
The required changes are documented in |
| Comment by Misha Tyulenev [ 01/Aug/16 ] |
|
|