-
Type:
Bug
-
Resolution: Won't Fix
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Querying
-
ALL
-
Query Execution 2021-03-08
-
None
-
None
-
None
-
None
-
None
-
None
-
None
In SERVER-54221 we are using DepsTracker::State::SEE_NEXT for the getDependency() overload in DocumentSourceInternalUnpackBucket. This causes a problem when a few different kinds of queries are run against the time-series collection.
coll.find({}, {x: 1}).sort({x: 1})
Will fail because the the deps for $_internalUnpackBucket will inherit from the $project directly after $_internalUnpackBucket and cause the find layer absorb the $project and execute with a PROJECT_SIMPLE stage with just an inclusion projection on field x. This will mangle the bucket and $_internalUnpackBucket will fail.
"stages" : [
{
"$cursor" : {
"queryPlanner" : {
"namespace" : "test.system.buckets.timeseries_bucket_limit_count_1",
"indexFilterSet" : false,
"parsedQuery" : {
},
"queryHash" : "0E456FB4",
"planCacheKey" : "0E456FB4",
"maxIndexedOrSolutionsReached" : false,
"maxIndexedAndSolutionsReached" : false,
"maxScansToExplodeReached" : false,
"winningPlan" : {
"stage" : "PROJECTION_SIMPLE",
"transformBy" : {
"_id" : 1,
"x" : 1
},
"inputStage" : {
"stage" : "COLLSCAN",
"direction" : "forward"
}
},
"rejectedPlans" : [ ]
}
}
},
{
"$_internalUnpackBucket" : {
"include" : [
"_id",
"x"
],
"timeField" : "time"
}
},
{
"$project" : {
"_id" : true,
"x" : true
}
},
{
"$sort" : {
"sortKey" : {
"_id" : 1
}
}
},
{
"$project" : {
"_id" : true,
"x" : true
}
}
A fix for this is to use NOT_SUPPORTED for the deps tracker in $_internalUnpackBucket.