|
I was working on something totally unrelated and ran "aggregation_multiversion_fuzzer" with SBE enabled, and I found an interesting failure:
https://spruce.mongodb.com/task/mongodb_mongo_master_enterprise_rhel_80_64_bit_dynamic_all_feature_flags_required_aggregation_multiversion_fuzzer_4_enterprise_rhel_80_64_bit_dynamic_all_feature_flags_required_patch_d6f45f76d79d7905fba6ee90a6e805b3cd9a1370_608afc860ae6062333543496_21_04_29_18_36_47/tests?execution=0&sortBy=STATUS&sortDir=ASC
I was able to boil it down to the following repro:
> db.coll.insert({a: 1});
|
> db.coll.aggregate([{"$project": {"a.x": "$a.x", "a.b.x": "$a.x"}}]);
|
Running these commands with SBE enabled will produce the following error message:
uncaught exception: Error: command failed: { "ok" : 0, "errmsg" : "undefined slot accessor:6", "code" : 4946301, "codeName" : "Location4946301"} with original command request: { "aggregate" : "coll", "pipeline" : [ { "$project" : { "a.x" : "$a.x", "a.b.x" : "$a.x" } } ], "cursor" : { }, "lsid" : { "id" : UUID("fd211cab-715c-41fa-827c-c0ae006ca0a8") }} on connection: connection to 127.0.0.1:27017 : aggregate failed
|
Running these commands with SBE disabled produces no error.
I attached gdb and I managed to print out the generated SBE plan that is causing theĀ "undefined slot accessor:6" error (see below). It appears that "s6" is being read from in a context where it is not defined.
The goal of this task is to fix this bug.
== SBE plan of the aggregate() command that fails ==
[2] traverse s22 s21 s3 {} {}
|
from
|
[1] scan s3 s4 none none none none [] @"7a47a3f3-af02-40d4-960c-caaa4a5da425" true false
|
in
|
[2] mkbson s21 s3 [_id] keep [a = s20] true false
|
[2] traverse s20 s19 s5 {} {}
|
from
|
[2] project [s5 = getField (s3, "a")]
|
[2] limit 1
|
[2] coscan
|
in
|
[2] mkbson s19 s5 [] keep [x = s10, b = s18] true false
|
[2] project [s10 = s7]
|
[2] traverse s18 s17 s11 {} {}
|
from
|
[2] project [s11 = getField (s5, "b")]
|
[2] traverse s7 s7 s6 {} {}
|
from
|
[2] project [s6 = getField (s3, "a")]
|
[2] limit 1
|
[2] coscan
|
in
|
[2] project [s7 = s9]
|
[2] traverse s9 s9 s8 {} {}
|
from
|
[2] project [s8 = getField (s6, "x")]
|
[2] limit 1
|
[2] coscan
|
in
|
[2] project [s9 = s8]
|
[2] limit 1
|
[2] coscan
|
in
|
[2] mkbson s17 s11 [] keep [x = s16] true false
|
[2] project [s16 = s13]
|
[2] traverse s13 s13 s12 [s6, s7] {} {}
|
from
|
[2] project [s12 = getField (s3, "a")]
|
[2] limit 1
|
[2] coscan
|
in
|
[2] project [s13 = s15]
|
[2] traverse s15 s15 s14 {} {}
|
from
|
[2] project [s14 = getField (s12, "x")]
|
[2] limit 1
|
[2] coscan
|
in
|
[2] project [s15 = s14]
|
[2] limit 1
|
[2] coscan
|
|