[SERVER-49228] Remove kickback to mongos requirement for cluster view read when view is backed by unsharded collection Created: 01/Jul/20  Updated: 29/Oct/23  Resolved: 08/Mar/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 4.4.0-rc11
Fix Version/s: 4.9.0

Type: Improvement Priority: Major - P3
Reporter: James Wahlin Assignee: James Wahlin
Resolution: Fixed Votes: 0
Labels: neweng, qopt-team
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-55454 Relax OperationShardingState::initial... Closed
is related to SERVER-32198 Missing collection metadata on the sh... Closed
is related to SERVER-42282 Consider replacing CommandOnShardedVi... Backlog
Backwards Compatibility: Fully Compatible
Sprint: Query Optimization 2021-02-22, Query Optimization 2021-03-08, Query Optimization 2021-03-22
Participants:

 Description   

Currently when a read is performed against a view backed by an unsharded collection, the following takes place:
1) mongos sends the read to the primary shard for the given database
2) The primary shard determines that namespace is a view, and returns the view definition and underlying namespace to mongos
3) mongos rewrites the read on the view to be an aggregate command against the underlying collection, with the view definition incorporated into the aggregation pipeline
4) mongos executes the aggregate command

When the view is backed by an unsharded collection we would ideally perform the rewrite on the primary shard and execute locally rather than return the view definition to mongos for rewrite/execution. This was previously not possible, as the primary shard could incorrectly report that a sharded collection was unsharded. With the completion of SERVER-32198 however we can now definitively know whether a collection's sharding state is sharded, unsharded or unknown. In the case where we know it is unsharded, we can execute the view on the read remotely, without mongos kick-back.



 Comments   
Comment by Githook User [ 05/Mar/21 ]

Author:

{'name': 'James Wahlin', 'email': 'james@mongodb.com', 'username': 'jameswahlin'}

Message: SERVER-49228 Remove kickback to mongos requirement for cluster view read when view is backed by unsharded collection
Branch: master
https://github.com/mongodb/mongo/commit/a407cf2e8e25aad8762bb379854e10acf17793bd

Generated at Thu Feb 08 05:19:17 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.