-
Type: Bug
-
Resolution: Gone away
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Query Execution, Sharding
-
Sharding EMEA
-
QE 2023-08-07
The code in attachCursorToPipeline performs routing and when it thinks that the collection is UNSHARDED, it will attempt to take the optimised path, establishing cursors locally, though DBDirectClient, instead of making a remote call.
In order to do this, it sets the expected state of the collection correctly on the OpCtx, and then makes a call, which eventually will enter in the shard role. Since this call will already ensure that the cursors are established on the right shard, by virtue of entering the shard role and the checks that this involves (namely db primary and shard version), it is unnecessary (and wrong by itself) to call checkOnPrimaryShardForDb, because that check can be invalid as soon as that function returns.
When this line is removed, however, there are failures in some $unionWith tests, which indicates that there are places where query doesn't correctly perform shard version checking.
The goal of this ticket is to investigate and fix the respective query bugs as a prerequisite for SERVER-74816.
- is depended on by
-
SERVER-74816 Unnecessary call to `checkOnPrimaryShardForDb' in `attachCursorToPipeline`
- Closed