-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: 9.0.2, 8.3.11, 8.0.32, 8.0.34
-
Component/s: Distributed Query Planning
-
Query Optimization
-
Fully Compatible
-
ALL
-
v9.0, v8.3, v8.0
-
None
-
None
-
None
-
None
-
None
-
None
-
None
The tassert is triggered when a stage which sets HostTypeRequirement::kAllShardHosts is followed by a stage with which requires a shard but which does not set mergeShardId, such as $unionWith (kTargetedShards) or $group with allowDiskUse=true which disqualifies the mongos.
We also need to have no collation on the command and the collection to be untracked.
The following fail:
[\{$planCacheStats: {allHosts: true}}, $unionWith: \{...}]
[\{$planCacheStats: {allHosts: true}}, $group: \{...}], {allowDiskUse: true}
Other stages which could be used for kAllShardHosts are collStats, $currentOp.
I've attached a reproduction script.