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

Access to Grid members should be protected with isShardingInitialized

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Sharding NYC
    • Fully Compatible
    • ALL
    • Sharding NYC 2023-03-20, Sharding NYC 2023-04-03, Sharding NYC 2023-04-17, Sharding NYC 2023-05-01
    • 0
    • 2

      Access to Grid members should be protected with isShardingInitialized when it can be called in both sharded and non-sharded context. This is because there is race that happens when addShard is performed, the mongod transitions from being non-sharded to sharded and calls Grid::init, which races with all other places where Grid can be accessed even in non-sharded context.

      Some examples include:

      https://github.com/mongodb/mongo/blob/cb138e05cf54d14fa886995c329c8da2c235d74b/src/mongo/db/exec/update_stage.cpp#L758
      https://github.com/mongodb/mongo/blob/cb138e05cf54d14fa886995c329c8da2c235d74b/src/mongo/db/catalog/coll_mod.cpp#L371

            Assignee:
            randolph@mongodb.com Randolph Tan
            Reporter:
            randolph@mongodb.com Randolph Tan
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: