Secondary reads right after change shard key can stall on refresh

XMLWordPrintableJSON

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

      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:
            [DO NOT USE] Backlog - Sharding Team
            Reporter:
            Randolph Tan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: