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

Secondary reads right after change shard key can stall on refresh

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 4.2.0
    • Component/s: Sharding
    • None
    • Sharding
    • ALL
    • 8

      Sequence:
      1. Shard collection on primary, version is now (1,0|e1).
      2. Metadata refresh happens, insert { refreshing: true } to config.cache.collections.
      3. Metadata refresh finish, update config.cache.collections with { refreshing: false, lastRefreshedCollectionVersion: (1,0) }
      4. Change shard key on same collection, version is now (1,0|e2)
      5. Metadata refresh happens, update { refreshing: true } to config.cache.collections.
      6. Metadata refresh finish, update config.cache.collections with { refreshing: false, lastRefreshedCollectionVersion: (1,0) }. However, since lastRefreshedCollectionVersion didn't change, oplog entry will not contain it.

      So, if a secondary refresh happened in between step 5 & 6, it will block on a notification waiting for refresh false. However, the condition for triggering the refresh requires lastRefreshedCollectionVersion to be present in the oplog, it will be missed. And it will block until the next refresh bumps the version higher.

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

              Created:
              Updated:
              Resolved: