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

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Major - P3 Major - P3
    • None
    • 3.2.0
    • Sharding
    • None
    • Sharding
    • ALL
    • 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

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: