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

make the distinct command deterministically versioned on mongos for sharded collections

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.5.12
    • Affects Version/s: 3.5.11
    • Component/s: Sharding
    • None
    • Fully Compatible
    • ALL
    • Sharding 2017-08-21, Sharding 2017-09-11
    • 0

      Currently, the distinct command's behavior (with respect to whether it does shard versioning or not) is nondeterministic.

      The distinct command on mongos uses ShardConnection with a namespace, but without a ChunkManager.

      So, if the connection retrieved from the sharded connection pool happens to be as fresh as the mongos's routing table cache, setShardVersion will not be sent over the connection.

      If the connection is staler than the mongos's routing table cache, setShardVersion will be sent over the connection, and if the mongos's routing table cache was staler than the authoritative routing table, the mongos will receive a stale version error.

      Then, mongos will refresh its routing table cache and retry the distinct command, which will now get routed to the correct shard.

      https://github.com/mongodb/mongo/blob/r3.5.11/src/mongo/s/client/version_manager.cpp#L332-L339

      This ticket should make the distinct command use scatterGather() rather than ShardConnection, so that it always has versioned behavior.

            Assignee:
            esha.maharishi@mongodb.com Esha Maharishi (Inactive)
            Reporter:
            esha.maharishi@mongodb.com Esha Maharishi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: