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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Won't Fix
    • Affects Version/s: 3.2.0
    • Fix Version/s: None
    • Component/s: Sharding
    • Labels:
      None
    • Operating System:
      ALL
    • Linked BF Score:
      0

      Description

      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

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: