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

Don't attempt to retrieve a ReshardingCoordinator instance on a replica set secondary

    • Fully Compatible
    • ALL
    • Sharding 2020-10-19, Sharding 2020-11-02

      When a PrimaryOnlyService service exists on a replica set secondary, it will be in state kPaused. On a primary, it will be in state kRunning.

      If one attempts to retrieve an instance while the service is in kPaused, the returned instance will be a boost::none.

      OpObservers are run on both primaries and secondaries. This becomes an issue when attempting to run the ReshardingOpObserver, particularly here..

      We should prepend a call to PrimaryOnlyService::isRunning() to verify that the PrimaryOnlyService is running before trying to retrieve the instance. Furthermore, we should check if the boost::optional is initialized and throw a DBException anyway, because attempting to index into an uninitialized boost::optional will create a segfault.

            Assignee:
            janna.golden@mongodb.com Janna Golden
            Reporter:
            blake.oler@mongodb.com Blake Oler
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: