-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Query Integration
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Currently, the expression context stores whether or not the "main collection" for the query contains extended range data (for multi-shard queries, this only applies to the local shard). This field is a simple boolean.
This flag is important because when it is false, we can more aggressively optimize time series queries. But when it is true, we need to avoid certain optimizations because we know that some invariants on the data won't hold. The default is false, which leaves us prone to wrong answer bugs.
One way to ensure we will be more conservative would be to make this field into a boost::optional<bool>, with boost::none being the default.
On the router, it will never be set, so we assume conservative behavior.
On the shards, we require the bit to have been set to something other than boost::none, and tassert if it is not explicitly true or false. This way, if there is a code path on the shards that is not setting this bit, we know that we have missed an opportunity to optimize.