[SERVER-30698] make the distinct command deterministically versioned on mongos for sharded collections Created: 16/Aug/17  Updated: 30/Oct/23  Resolved: 21/Aug/17

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 3.5.11
Fix Version/s: 3.5.12

Type: Bug Priority: Major - P3
Reporter: Esha Maharishi (Inactive) Assignee: Esha Maharishi (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Gantt Dependency
has to be done before SERVER-30595 Do not use chunk metadata to filter r... Closed
Related
is related to SERVER-30734 make the distinct command versioned o... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Sharding 2017-08-21, Sharding 2017-09-11
Participants:
Linked BF Score: 0

 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.



 Comments   
Comment by Githook User [ 21/Aug/17 ]

Author:

{'username': 'EshaMaharishi', 'email': 'esha.maharishi@mongodb.com', 'name': 'Esha Maharishi'}

Message: SERVER-30698 make the distinct command deterministically versioned on mongos for sharded collections
Branch: master
https://github.com/mongodb/mongo/commit/ec54d07737812d56c8bef634bb5774a345adf619

Generated at Thu Feb 08 04:24:42 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.