[SERVER-26759] stopMonitoringGuard in ShardingCatalogManagerImpl::addShard can remove an existing shard's ReplicaSetMonitor Created: 25/Oct/16  Updated: 14/Nov/16  Resolved: 14/Nov/16

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 3.4.0-rc1
Fix Version/s: 3.4.0-rc4

Type: Bug Priority: Major - P3
Reporter: Esha Maharishi (Inactive) Assignee: Esha Maharishi (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Sharding 2016-11-21
Participants:

 Description   

The stopMonitoringGuard

https://github.com/mongodb/mongo/blob/r3.4.0-rc1/src/mongo/s/catalog/sharding_catalog_manager_impl.cpp#L742-L750

is meant to remove the ReplicaSetMonitor for a new shard if the addShard() fails for any reason.

However, if the shard attempting to be added has the same setName as an existing shard's setName, the stopMonitoringGuard will use the existing shard's ReplicaSetMonitor and, on error, will remove that existing shard's ReplicaSetMonitor.

Potential fixes:

1) Check if a ReplicaSetMonitor for the new shard's setName exists, and fail immediately if so.
2) Make the stopMonitoringGuard only remove the ReplicaSetMonitor on failure if it actually created it (this seems less preferable - why would we ever want to use an existing ReplicaSetMonitor during addShard?).



 Comments   
Comment by Esha Maharishi (Inactive) [ 14/Nov/16 ]

Fixed by SERVER-26761, since an existing ReplicaSetMonitor can no longer be used during addShard.

Generated at Thu Feb 08 04:13:08 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.