[SERVER-59935] Add NamespaceString::isPerShardNamespace method Created: 14/Sep/21  Updated: 06/Dec/22  Resolved: 14/Sep/21

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

Type: Improvement Priority: Major - P3
Reporter: Bernard Gorman Assignee: Backlog - Query Execution
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-59676 DocumentSourceFindAndModifyImageLooku... Closed
is related to SERVER-59839 ShardServerProcessInterface::getColle... Closed
Assigned Teams:
Query Execution
Participants:

 Description   

In recent tickets SERVER-59676 and SERVER-58689, we ran into an issue where a sub-operation pipeline issued via MongoProcessInterface behaved incorrectly in cases where the requested collection was shard-local, i.e. a collection which can exist on each shard independently. We worked around this issue using the NamespaceString::isNamespaceAlwaysUnsharded method, which is almost a synonym for the proposed isPerShardNamespace method. However, isNamespaceAlwaysUnsharded includes the system.views namespace, which is not shard-local but always exists, unsharded, on the primary shard for the given database. There may be other or future cases where the two concepts do not perfectly overlap.

Given this, we should add a specific NamespaceString::isPerShardNamespace method. This would be identical to the existing isNamespaceAlwaysUnsharded with the exception of the isSystemDotViews check. The isNamespaceAlwaysUnsharded method could then be re-expressed in terms of isPerShardNamespace, i.e. (isSystemDotViews() || isNamespaceAlwaysUnsharded()).

We should also consider using this new helper in attachCursorToPipeline, to have the pipeline automatically decline to send a remote request if the given namespace is per-shard.


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