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

Commands that are not allowed on sharded collections should target the primary shard with shardVersion UNSHARDED

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.6.2, 3.7.2
    • Component/s: Sharding
    • Cluster Scalability

      Today, for commands that are not allowed on sharded collections, mongos checks its cache and if the cache says the collection is sharded, mongos returns an error to the client without ever contacting any shard.

      This is wrong, because mongos's cache could be stale.

      Instead, mongos should assume its cache is stale (i.e., assume the collection is unsharded no matter what its cache says) and target the primary shard with shardVersion UNSHARDED. If the collection is actually sharded, the shard will return StaleShardVersion. Mongos should catch StaleShardVersion for these commands and convert it to IllegalOperation (rather than letting it bubble up to the service entry point and making the command be retried repeatedly).

      As part of fixing this, we should update the safe_secondary_reads*.js tests' expected behavior of "unshardedOnly" commands.

            Assignee:
            backlog-server-cluster-scalability [DO NOT USE] Backlog - Cluster Scalability
            Reporter:
            esha.maharishi@mongodb.com Esha Maharishi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: