[SERVER-42282] Consider replacing CommandOnShardedViewNotSupportedOnMongod mechanism with rewrite / routing from shard Created: 18/Jul/19  Updated: 20/Mar/23

Status: Backlog
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: James Wahlin Assignee: Backlog - Query Optimization
Resolution: Unresolved Votes: 0
Labels: read-only-views
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-65949 Sharded time series leads to high que... Backlog
related to SERVER-49228 Remove kickback to mongos requirement... Closed
is related to SERVER-74826 Errors CommandOnShardedViewNotSupport... Backlog
Assigned Teams:
Query Optimization
Participants:

 Description   

When a read against a non-materialized view is performed in a sharded cluster, the read is first sent to the primary shard for the database, which then looks up the view definition and returns to mongos as part of a CommandOnShardedViewNotSupportedOnMongod error response. We could consider instead performing the rewrite locally on the primary shard and then performing shard to shard routing. This would save us a network hop from the primary shard back to mongos.



 Comments   
Comment by Ana Meza [ 08/Oct/21 ]

Paasing this over to QO since this seems more of a Distributed Planning issues and it a bit big piece for Quick win

Comment by James Wahlin [ 30/Jun/20 ]

With the resolution of SERVER-32198, we are now in a position to tell on a shard whether a collection is sharded, unsharded, or whether we are not sure. If we decide not to do the work scope for this ticket in Q3, we may want to consider instead a change to allow a cluster view read, where the underlying collection is unsharded, to be resolved and executed on the primary shard without having to kickback to mongos.

Comment by Charlie Swanson [ 27/Feb/20 ]

Flagging for re-triage. The new mechanisms we built to support $unionWith running on a shard may allow us to do this relatively easily. I'd recommend considering this as a quick win.

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