Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-26759

stopMonitoringGuard in ShardingCatalogManagerImpl::addShard can remove an existing shard's ReplicaSetMonitor

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.4.0-rc4
    • Affects Version/s: 3.4.0-rc1
    • Component/s: Sharding
    • None
    • Fully Compatible
    • ALL
    • Sharding 2016-11-21

      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?).

            Assignee:
            esha.maharishi@mongodb.com Esha Maharishi (Inactive)
            Reporter:
            esha.maharishi@mongodb.com Esha Maharishi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: