-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Query Execution
-
ALL
-
None
-
None
-
None
-
None
-
None
-
None
-
None
SERVER-118494 disabled the test that was throwing this error in query-correctness-tests-1. We should investigate the root cause of this issue and re-enable the test once we have either fixed it or remove it entirely if this is acceptable behavior. This error was surfaced when we attempted to default enable the automaticCE plan ranker mode. This mode slightly changes the condition so that some queries that were previously considered for subplanning are no longer considered for subplanning and end up going through multiplanning.
However, we can isolate the issue to simply being execution differences when running under subplanner and multiplanner and thus can ignore the automaticCE. This likely stems from the order in which we see the documents., i.e. the access path. More concretely, there is an erroring document that we encounter during multiplanning the full rooted $or tree that we do not encounter when subplanning the branches of rooted $or (and consequently, the winning plan also does not end up seeing this document). Thus in the multiplanning case we see the following error indicating that we passed in an invalid input to $mergeObjects. I've attached the steps to repro this locally at the bottom of this description.
Open questions:
1. Is it acceptable behavior that a query can fail depending on what access path is chosen?
2. Should the query-correctness-tests corpus have tests that can error during execution depending on the access path?
3. Should expression operator errors cause the query to fail rather than outputting null?
The error:
Failed to execute test number 557. Expected OK command result but got { ok: 0.0, errmsg: "error while multiplanner was selecting best plan :: caused by :: $mergeObjects requires object inputs, but input 78447 is of type int", code: 40400, codeName: "Location40400" }
The erroring pipeline:
[ { "$match" : { "$or" : [ { "$or" : [ { "obj.array" : { "$elemMatch" : { "$ne" : ISODate("2019-12-05T02:36:42.397Z"), "$lt" : [ { "array" : [ "synergistic", { "str" : "HDD monitor Fantastic Soft Table" }, NumberInt(84890), ISODate("2019-07-10T14:37:15.122Z"), "Operative Georgia bleeding-edge" ], "date" : ISODate("2019-03-05T07:17:34.538Z"), "num" : NumberInt(77815) }, 314159285, NumberInt(-30) ] } } }, { "obj.str" : { "$regex" : /(?:Home Loan Accou|redunda)nt|Massachusetts|co(?:mposite|pying)/ } }, { "$and" : [ { "obj.str" : { "$regex" : /Gorgeous Rubber Cheese|multi\-state|Intranet|parsing/ } }, { "$and" : [ { "obj.obj.obj.obj.str" : { "$lte" : "program" } } ] }, { "$expr" : { "$function" : { "body" : "function(arg1, arg2){ return arg2; }", "args" : [ { "$function" : { "body" : "function(arg1, arg2){ return arg1; }", "args" : [ { "$map" : { "input" : [ "$num" ], "as" : "stefan", "in" : { "$indexOfBytes" : [ { "$ifNull" : [ { "$reduce" : { "input" : [ "$$stefan", { "$let" : { "vars" : { "wilfredo" : { "$mergeObjects" : [ { "$ifNull" : [ "$obj.obj.obj", { } ] }, { "$ifNull" : [ "$obj.obj.obj.obj", { } ] }, { "date" : ISODate("2019-08-19T20:12:47.692Z") }, { "$ifNull" : [ "$$stefan", { } ] }, { "obj" : { "num" : NumberInt(31301), "str" : "Hong Kong bottom-line Pants" } } ] }, "candice" : "$$ROOT", "osvaldo" : { "$function" : { "body" : "function(){ return {obj: {num: NumberLong(\"93320\"), num: 314159265000}, str: \"Administrator\", array: [NumberLong(\"18523\"), \"invoice\", [\"red\", [{date: new Date(\"2019-01-28T01:19:15.194Z\")}], new Date(\"2019-12-22T13:26:32.282Z\")], true, \"Grocery Bedfordshire Oman\", /synthesizing|parsing|Soap|Club/], num: NumberLong(\"54832\")}; }", "args" : [ ], "lang" : "js" } }, "evie" : { "$arrayElemAt" : [ [ true, NumberDecimal("-0E-6176"), { "$let" : { "vars" : { "stanford" : { "$sortArray" : { "input" : { "$setDifference" : [ [ "COM", NumberLong(70942) ], [ NumberDecimal("-9.999999999999999999999999999999999E+6144"), "$obj.obj.obj.obj.obj.str" ] ] }, "sortBy" : 1 } } }, "in" : { "$allElementsTrue" : [ { "$ifNull" : [ [ "$$stefan", "$$stefan" ], [ ] ] } ] } } }, false, "$obj.obj.obj.obj.num", NumberLong(0), true, "Research" ], 4 ] }, "rosalind" : { "$map" : { "input" : [ "$count", "$$stefan" ], "as" : "josh", "in" : { "$stdDevSamp" : [ "$$josh", NumberInt(13024), 1.7976931348623157e+308, NumberLong("314159265358979303"), NumberInt(0), NumberLong("9223372036854775807"), NumberDecimal("0") ] } } } }, "in" : { "$substr" : [ "$obj.str", 7, NumberInt(6) ] } } } ], "initialValue" : "$obj.obj.str", "in" : { "$substrBytes" : [ "Human programming", NumberInt(20), NumberLong(5) ] } } }, "" ] }, { "$ifNull" : [ "turquoise", "" ] }, NumberLong(19) ] } } }, { "$zip" : { "inputs" : [ { "$ifNull" : [ [ ], [ ] ] }, { "$ifNull" : [ [ "$obj.obj.obj.obj.str", { "$reduce" : { "input" : [ ], "initialValue" : "communities 1080p", "in" : { "$replaceOne" : { "input" : "$obj.obj.obj.str", "find" : "backing up port engineer", "replacement" : "uniform Solutions" } } } }, "$obj.obj.obj.obj.str", "Djibouti Franc Optional Clothing", "real-time mobile Soft" ], [ ] ] }, { "$ifNull" : [ [ "$num" ], [ ] ] }, { "$ifNull" : [ [ [ ], [ false, { "array" : [ /Fantastic Plastic Table/ ] } ], /Home Loan Account|installation|innovative|extensible/ ], [ ] ] } ] } } ], "lang" : "js" } }, { "$sortArray" : { "input" : { "$setDifference" : [ [ { "$max" : [ ISODate("0001-01-01T00:00:00Z"), { "$dateAdd" : { "startDate" : Timestamp(2147483647, 0), "unit" : "minute", "amount" : { "$toInt" : { "$min" : [ "$num", "$obj.obj.obj.obj.num" ] } }, "timezone" : "America/Halifax" } } ] }, ISODate("2019-08-29T19:23:54.509Z") ], [ "Money Market Account web-readiness", false ] ] }, "sortBy" : -1 } } ], "lang" : "js" } } }, { "obj.obj.obj.obj.obj.date" : { "$lte" : ISODate("2019-07-03T07:18:46.669Z") } } ] }, { "$and" : [ { "any" : { "$in" : [ { "num" : 0 }, { "obj" : { "str" : "Games", "obj" : { } } }, 1, true ] } }, { "$and" : [ { "$expr" : { "$sortArray" : { "input" : { "$setDifference" : [ [ true, "$num" ], [ { "$max" : [ ISODate("0001-01-01T00:00:00Z"), { "$dateTrunc" : { "date" : Timestamp(4294967295, 0), "unit" : "second", "timezone" : "America/Los_Angeles", "startOfWeek" : "SUN" } } ] }, "Buckinghamshire maroon Integration" ] ] }, "sortBy" : -1 } } }, { "obj.obj.bool" : { "$lte" : false } }, { "obj.any" : { "$not" : { "$in" : [ /mint green|bluetooth|array/, ISODate("2019-04-23T10:16:38.689Z"), /^Checking Account|partnerships|transmitting|Avon|red/, { "num" : 31.415 } ] } } }, { "$or" : [ { "$expr" : { "$max" : [ ISODate("0001-01-01T00:00:00Z"), { "$dateFromParts" : { "isoWeekYear" : NumberInt(13), "isoWeek" : 20, "isoDayOfWeek" : 11, "minute" : NumberLong(8), "timezone" : "America/Puerto_Rico" } } ] } }, { "array" : { "$all" : [ NumberLong("-314159265358979323") ] } }, { "obj.obj.obj.obj.str" : { "$regex" : "Credit Card Account|B(?:uckinghamshir|ik)e|(?:infomediarie|Shoal)s", "$options" : "" } } ] } ] } ] } ] } ] } }, { "$count" : "num" }, { "$replaceWith" : { "array" : [ { "num" : 54040, "obj" : { } }, [ { "date" : ISODate("2019-04-23T14:06:28.880Z") } ], ISODate("2019-01-23T15:33:34.178Z"), NumberDecimal("-9.999999999999999999999999999999999E+6144"), [ /Money Market Account|(?:navigat|engag)e|indexing|Lake/, false ] ], "num" : NumberInt(-314159235) } } ]
Steps to repro:
1. Use sparse-checkout to quickly clone the large query-correctness-tests-1 repo with only the erroring test.
git clone --filter=blob:none --sparse git@github.com:10gen/query-correctness-tests-1.git query-correctness-tests-1 cd query-correctness-tests-1 git sparse-checkout set generated_tests/octopus-1771702139016
2. Checkout the commit before we disabled the erroring test:
git checkout a9a8c2b3e565e618cd677e4b874a931a1061b72b
3. Build a mongod with the opt profile. I am running this on 10gen/mongo commit 56c369e4ba2d71145f211fc5a481bb56ed766d05. This is before we made any changes to default enable the automaticCE plan ranker mode, i.e. the planRankerMode is `multiPlanning` but we can be explicit about it:
bazel build install-dist-test --config=opt
4. Run the server and explicitly set it to planRankerMode='multiPlanning, which is the current default anyway. In this mode, we expect the erroring query to go through subplanning:
./bazel-bin/install-dist-test/bin/mongod --setParameter planRankerMode='multiPlanning'
5. Run the failing test against this configuration (we expect it to pass since this will run through the subplanner).
./bazel-bin/src/mongo/db/query/query_tester/mongotest --drop --load --mode compare -t query-correctness-tests-1/generated_tests/octopus-1771702139016/good1-8.1.test -n 557
6. Now restart mongod but disable the subplanner via the internalQueryPlanOrChildrenIndependently knob so the query is forced to go through multiplanning
./bazel-bin/install-dist-test/bin/mongod --setParameter planRankerMode='multiPlanning' --setParameter internalQueryPlanOrChildrenIndependently=false
7. Re-run the test
./bazel-bin/src/mongo/db/query/query_tester/mongotest --drop --load --mode compare -t query-correctness-tests-1/generated_tests/octopus-1771702139016/good1-8.1.test -n 557
- is related to
-
SERVER-118494 Disable failing $mergeObjects test in query-correctness-tests-1
-
- Closed
-