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

make the distinct command deterministically versioned on mongos for sharded collections

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 3.5.11
    • Fix Version/s: 3.5.12
    • Component/s: Sharding
    • Labels:
      None

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: