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

ShardRegistry::reload can overwrite existing entry with an older one temporarily in SCCC

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.2.0
    • Component/s: Sharding
    • Labels:
      None
    • Sharding
    • ALL
    • 0

      The outline for ShardRegistry::reload goes like this (as of 4b37c81ddfd33f550f2f42e1a14a56e427620db4):

      1. Query config.shards.
      2. Grab mutex.
      3. Clear everything and repopulate from the query result.

      The issue comes in when 2 threads calls reload and these threads got different results from the query at #1 (basically, they are state at different points in time). The newer one finishes first, and then the older one will overwrite the newer one after it grabs the lock. This will cause the ShardRegistry to contain the old entry until the next reload.

      This is only a problem with SCCC because the CSRS implementation has a guard against this (Note: opTime is always zero for SCCC):

      https://github.com/mongodb/mongo/blob/r3.2.0/src/mongo/s/client/shard_registry.cpp#L190-l195

            Assignee:
            backlog-server-sharding [DO NOT USE] Backlog - Sharding Team
            Reporter:
            randolph@mongodb.com Randolph Tan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: