[SERVER-32610] Include databaseVersion when targeting by primary shard in paths that use buildVersionedRequestsForTargetedShards() Created: 09/Jan/18  Updated: 30/Oct/23  Resolved: 27/Feb/18

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: 3.7.3

Type: Task Priority: Major - P3
Reporter: Randolph Tan 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
depends on SERVER-32607 Implement a DatabaseVersion class and... Closed
Backwards Compatibility: Fully Compatible
Sprint: Sharding 2018-02-12, Sharding 2018-02-26, Sharding 2018-03-12
Participants:

 Description   

If mongos doesn’t see a namespace in its cache, it will discover whether the namespace is a view or collection from the primary shard.
It will discover if the primary shard has changed through database versioning.

Routing logic for a namespace not in mongos’s cache:

  1. Mongos forwards the request to the node it believes to be the primary shard for “test”, with both
    1. shardVersion “UNSHARDED”
    2. databaseVersion <mongos’s cached databaseVersion>
  2. Since the request contains a databaseVersion, the shard verifies it
    1. If the databaseVersion doesn't match, the shard returns StaleDbVersion
    2. If it does match, the shard tries to resolve the namespace
      1. If it’s a view, returns the viewDefinition
      2. Else processes the request normally
        1. This can return StaleShardVersion or actual data
  3. Mongos receives the response. If the response is
    1. StaleDbVersion, refreshes its cache entry for db “test” and retries
    2. StaleShardVersion, refreshes cache entry for “test.foo” and retries
    3. viewDefinition, rewrites the request as an aggregation and retries
    4. actual data, returns the data


 Comments   
Comment by Githook User [ 27/Feb/18 ]

Author:

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

Message: SERVER-32610 Include databaseVersion when targeting by primary shard in paths that use buildVersionedRequestsForTargetedShards()
Branch: master
https://github.com/mongodb/mongo/commit/494bc5fa73352687f4b0a39f4b8338fc9e258cc0

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