[SERVER-45186] Checks for sharded collections are racy on mongos Created: 17/Dec/19  Updated: 06/Dec/22

Status: Backlog
Project: Core Server
Component/s: Aggregation Framework, Sharding
Affects Version/s: 4.3.3
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Charlie Swanson Assignee: Backlog - Query Optimization
Resolution: Unresolved Votes: 0
Labels: qopt-team
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Query Optimization
Operating System: ALL
Participants:

 Description   

The checks that we do to enforce certain collections are not sharded on mongos rely on consulting the catalog cache. This is not guaranteed to be up to date and we also don't want to pay for a hard refresh on each query. 

The observable effects of this are that you can drop a sharded collection transitioning from sharded -> unsharded without every mongos knowing this happened. This means that mongos processes which have not observed this drop will incorrectly reject requests to use it in stages which can't use sharded collections like $lookup and $out.

If you instead shard ac collection and transition from unshared -> sharded then everything will work fine since the shard versioning protocol will retry the entire command and the second time the mongos will know that the namespace is sharded.


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