diff options
author | Anton Korshunov <anton.korshunov@mongodb.com> | 2021-01-31 00:34:57 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-02-14 15:30:07 +0000 |
commit | 0fc5b56b12dbdc248556fdfa9da2f44479eac699 (patch) | |
tree | dfac279997b20789e8c376fcf5a74fce75b15d22 | |
parent | 4dd10ec20b608ec364db1ba4815bbf45d73e8da4 (diff) | |
download | mongo-0fc5b56b12dbdc248556fdfa9da2f44479eac699.tar.gz |
SERVER-51823 Use classic engine to evaluate queries containing expressions not supported in SBE
323 files changed, 462 insertions, 1095 deletions
diff --git a/buildscripts/resmokeconfig/suites/cst_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/cst_jscore_passthrough.yml index 8a1d9f5718c..04a61d6de47 100755 --- a/buildscripts/resmokeconfig/suites/cst_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/cst_jscore_passthrough.yml @@ -223,7 +223,6 @@ selector: - jstests/core/hint1.js - jstests/core/id1.js - jstests/core/idhack.js - - jstests/core/id_sbe.js - jstests/core/in.js - jstests/core/in2.js - jstests/core/in3.js @@ -504,7 +503,6 @@ selector: - jstests/core/fts_trailing_fields.js - jstests/core/geo_2d_trailing_fields.js - jstests/core/idhack.js - - jstests/core/id_sbe.js - jstests/core/in7.js - jstests/core/index13.js - jstests/core/index_check2.js diff --git a/jstests/aggregation/bugs/reverseArray.js b/jstests/aggregation/bugs/reverseArray.js index 68065e39e68..cf80c040171 100644 --- a/jstests/aggregation/bugs/reverseArray.js +++ b/jstests/aggregation/bugs/reverseArray.js @@ -1,9 +1,6 @@ // SERVER-23029 added a new expression, $reverseArray, which consumes an array or a nullish value // and produces either the reversed version of that array, or null. In this test file, we check the // behavior and error cases. -// @tags: [ -// sbe_incompatible, -// ] load("jstests/aggregation/extras/utils.js"); // For assertErrorCode. (function() { diff --git a/jstests/aggregation/bugs/server10176.js b/jstests/aggregation/bugs/server10176.js index d527cd8463d..32cb8754b35 100644 --- a/jstests/aggregation/bugs/server10176.js +++ b/jstests/aggregation/bugs/server10176.js @@ -1,10 +1,8 @@ // SERVER-10176: Add $abs aggregation expression. -// @tags: [ -// sbe_incompatible, -// ] // For assertErrorCode. load('jstests/aggregation/extras/utils.js'); +load("jstests/libs/sbe_assert_error_override.js"); // Override error-code-checking APIs. (function() { var coll = db.abs_expr; diff --git a/jstests/aggregation/bugs/server11118.js b/jstests/aggregation/bugs/server11118.js index 40a44ffb0c7..560389f21e1 100644 --- a/jstests/aggregation/bugs/server11118.js +++ b/jstests/aggregation/bugs/server11118.js @@ -1,7 +1,4 @@ // SERVER-11118 Tests for $dateToString -// @tags: [ -// sbe_incompatible, -// ] (function() { "use strict"; diff --git a/jstests/aggregation/bugs/server11675.js b/jstests/aggregation/bugs/server11675.js index 1682a5437e3..72f9471bc8a 100644 --- a/jstests/aggregation/bugs/server11675.js +++ b/jstests/aggregation/bugs/server11675.js @@ -1,7 +1,4 @@ // SERVER-11675 Text search integration with aggregation -// @tags: [ -// sbe_incompatible, -// ] (function() { load('jstests/aggregation/extras/utils.js'); // For 'assertErrorCode'. load('jstests/libs/fixture_helpers.js'); // For 'FixtureHelpers' diff --git a/jstests/aggregation/bugs/server14421.js b/jstests/aggregation/bugs/server14421.js index 3d7386feaa7..5bd4e206013 100644 --- a/jstests/aggregation/bugs/server14421.js +++ b/jstests/aggregation/bugs/server14421.js @@ -1,7 +1,4 @@ // SERVER-14421 minDistance for $geoNear aggregation operator -// @tags: [ -// sbe_incompatible, -// ] (function() { 'use strict'; var coll = db.mindistance; @@ -40,4 +37,4 @@ results = coll.aggregate([{ }]); assert.eq(results.itcount(), 2); coll.drop(); -}());
\ No newline at end of file +}()); diff --git a/jstests/aggregation/bugs/server20163.js b/jstests/aggregation/bugs/server20163.js index b33a868d8b5..a03e3c70fbe 100644 --- a/jstests/aggregation/bugs/server20163.js +++ b/jstests/aggregation/bugs/server20163.js @@ -1,8 +1,5 @@ // SERVER-20163 introduced the $zip expression. In this test file, we check the behavior and error // cases of the expression. -// @tags: [ -// sbe_incompatible, -// ] load("jstests/aggregation/extras/utils.js"); // For assertErrorCode. (function() { diff --git a/jstests/aggregation/bugs/server22093.js b/jstests/aggregation/bugs/server22093.js index b63cfd7aabb..1adc279571d 100644 --- a/jstests/aggregation/bugs/server22093.js +++ b/jstests/aggregation/bugs/server22093.js @@ -10,7 +10,6 @@ // @tags: [ // assumes_unsharded_collection, // do_not_wrap_aggregations_in_facets, -// sbe_incompatible, // ] load('jstests/libs/analyze_plan.js'); diff --git a/jstests/aggregation/bugs/server26462.js b/jstests/aggregation/bugs/server26462.js index 612c3952fa9..16aacb905ab 100644 --- a/jstests/aggregation/bugs/server26462.js +++ b/jstests/aggregation/bugs/server26462.js @@ -1,8 +1,5 @@ // Tests that adding a field that only contains metadata does not cause a segmentation fault when // grouping on the added field. -// @tags: [ -// sbe_incompatible, -// ] (function() { "use strict"; diff --git a/jstests/aggregation/bugs/server42756.js b/jstests/aggregation/bugs/server42756.js index 5e710a377e9..48215ae7ae9 100644 --- a/jstests/aggregation/bugs/server42756.js +++ b/jstests/aggregation/bugs/server42756.js @@ -1,8 +1,5 @@ // SERVER-42756 Test that commutative arithmetic operations with special arguments doesn't violate // commutativity. -// @tags: [ -// sbe_incompatible, -// ] (function() { "use strict"; diff --git a/jstests/aggregation/bugs/server6121.js b/jstests/aggregation/bugs/server6121.js index 20f2455a971..a65775e7acb 100644 --- a/jstests/aggregation/bugs/server6121.js +++ b/jstests/aggregation/bugs/server6121.js @@ -4,9 +4,6 @@ * This test validates the SERVER-6121 ticket. Add support for timestamps to Aggregation and * ensure they can do everything dates can. Previously timestamps were awkwardly used as dates * and long longs. - * @tags: [ - * sbe_incompatible, - * ] */ /* diff --git a/jstests/aggregation/bugs/server6185.js b/jstests/aggregation/bugs/server6185.js index a7060f466e3..156dc6ce6fe 100644 --- a/jstests/aggregation/bugs/server6185.js +++ b/jstests/aggregation/bugs/server6185.js @@ -1,8 +1,5 @@ /** * Tests that projecting a non-existent subfield behaves identically in both query and aggregation. - * @tags: [ - * sbe_incompatible, - * ] */ (function() { "use strict"; diff --git a/jstests/aggregation/bugs/server6189.js b/jstests/aggregation/bugs/server6189.js index 035210df906..13385aa0443 100644 --- a/jstests/aggregation/bugs/server6189.js +++ b/jstests/aggregation/bugs/server6189.js @@ -1,7 +1,4 @@ // server6189 - Support date operators with dates before 1970 -// @tags: [ -// sbe_incompatible, -// ] c = db.c; function test(date, testSynthetics) { diff --git a/jstests/aggregation/bugs/server6190.js b/jstests/aggregation/bugs/server6190.js index cda230fd944..2e23e99ec65 100644 --- a/jstests/aggregation/bugs/server6190.js +++ b/jstests/aggregation/bugs/server6190.js @@ -1,8 +1,5 @@ // $week returns a date's week of the year. Week zero is comprised of any dates before the first // Sunday of the year. SERVER-6190 -// @tags: [ -// sbe_incompatible, -// ] load('jstests/aggregation/extras/utils.js'); t = db.jstests_aggregation_server6190; diff --git a/jstests/aggregation/bugs/server6239.js b/jstests/aggregation/bugs/server6239.js index 79876edcad9..4b9cc350ee5 100644 --- a/jstests/aggregation/bugs/server6239.js +++ b/jstests/aggregation/bugs/server6239.js @@ -1,10 +1,11 @@ // SERVER-6239 reenable $add and $subtract with dates with better semantics // Note: error conditions tested also in server6240.js // @tags: [ -// sbe_incompatible, +// sbe_incompatible, // ] load('jstests/aggregation/extras/utils.js'); +load("jstests/libs/sbe_assert_error_override.js"); // Override error-code-checking APIs. var millis = 12345; var num = 54312; diff --git a/jstests/aggregation/bugs/server6240.js b/jstests/aggregation/bugs/server6240.js index 8a525179cd4..8a194e82a99 100644 --- a/jstests/aggregation/bugs/server6240.js +++ b/jstests/aggregation/bugs/server6240.js @@ -5,9 +5,6 @@ * null value. Prevously verify'd. * * This test also validates the error cases for SERVER-6239 (support $add and $subtract with dates) - * @tags: [ - * sbe_incompatible, - * ] */ /* @@ -18,6 +15,7 @@ // Load test utilities load('jstests/aggregation/extras/utils.js'); +load("jstests/libs/sbe_assert_error_override.js"); // Override error-code-checking APIs. // Clear db db.s6240.drop(); diff --git a/jstests/aggregation/bugs/server6531.js b/jstests/aggregation/bugs/server6531.js index 46f09a0f379..5f5ebee3836 100644 --- a/jstests/aggregation/bugs/server6531.js +++ b/jstests/aggregation/bugs/server6531.js @@ -1,7 +1,4 @@ // SERVER-6531 support $within in $match aggregation operations -// @tags: [ -// sbe_incompatible, -// ] c = db.s6531; c.drop(); diff --git a/jstests/aggregation/bugs/server6556.js b/jstests/aggregation/bugs/server6556.js index 2220a02e9c6..a6d1a0c4837 100644 --- a/jstests/aggregation/bugs/server6556.js +++ b/jstests/aggregation/bugs/server6556.js @@ -1,7 +1,4 @@ // ensure strings containing null characters dont end at that null -// @tags: [ -// sbe_incompatible, -// ] c = db.s6556; c.drop(); diff --git a/jstests/aggregation/bugs/server6570.js b/jstests/aggregation/bugs/server6570.js index 5b6a723981f..7e92dc05875 100644 --- a/jstests/aggregation/bugs/server6570.js +++ b/jstests/aggregation/bugs/server6570.js @@ -3,6 +3,7 @@ // sbe_incompatible, // ] load('jstests/aggregation/extras/utils.js'); +load("jstests/libs/sbe_assert_error_override.js"); // Override error-code-checking APIs. c = db.s6570; c.drop(); diff --git a/jstests/aggregation/bugs/server7781.js b/jstests/aggregation/bugs/server7781.js index 77f8bbc6866..225cda90b1a 100644 --- a/jstests/aggregation/bugs/server7781.js +++ b/jstests/aggregation/bugs/server7781.js @@ -1,7 +1,4 @@ // SERVER-7781 $geoNear pipeline stage -// @tags: [ -// sbe_incompatible, -// ] (function() { 'use strict'; diff --git a/jstests/aggregation/bugs/server8141.js b/jstests/aggregation/bugs/server8141.js index 92f404a7327..3b1477e9ac4 100644 --- a/jstests/aggregation/bugs/server8141.js +++ b/jstests/aggregation/bugs/server8141.js @@ -1,7 +1,4 @@ // SERVER-8141 Avoid treating arrays as literals in aggregation pipeline. -// @tags: [ -// sbe_incompatible, -// ] (function() { 'use strict'; var coll = db.exprs_in_arrays; diff --git a/jstests/aggregation/bugs/server9289.js b/jstests/aggregation/bugs/server9289.js index c428adcc81f..06afc36d5e7 100644 --- a/jstests/aggregation/bugs/server9289.js +++ b/jstests/aggregation/bugs/server9289.js @@ -1,7 +1,4 @@ // server9289 - support objects as single arguments to expressions. -// @tags: [ -// sbe_incompatible, -// ] var t = db.server9289; t.drop(); diff --git a/jstests/aggregation/bugs/server9625.js b/jstests/aggregation/bugs/server9625.js index 7313e95f269..2cf1353f53d 100644 --- a/jstests/aggregation/bugs/server9625.js +++ b/jstests/aggregation/bugs/server9625.js @@ -1,8 +1,5 @@ // SERVER-9625 Making accumulators $sum, $min, $max, $avg, $stdDevSamp, and $stdDevPop available as // expressions. -// @tags: [ -// sbe_incompatible, -// ] // For assertErrorCode. load('jstests/aggregation/extras/utils.js'); diff --git a/jstests/aggregation/bugs/skip_limit_overflow.js b/jstests/aggregation/bugs/skip_limit_overflow.js index 132fbe5cfdb..6d1cbd15482 100644 --- a/jstests/aggregation/bugs/skip_limit_overflow.js +++ b/jstests/aggregation/bugs/skip_limit_overflow.js @@ -10,7 +10,6 @@ * assumes_unsharded_collection, * do_not_wrap_aggregations_in_facets, * requires_pipeline_optimization, - * sbe_incompatible, * ] */ (function() { diff --git a/jstests/aggregation/bugs/strcasecmp.js b/jstests/aggregation/bugs/strcasecmp.js index f404f852306..736e7ec0dac 100644 --- a/jstests/aggregation/bugs/strcasecmp.js +++ b/jstests/aggregation/bugs/strcasecmp.js @@ -1,7 +1,4 @@ // Aggregation $strcasecmp tests. -// @tags: [ -// sbe_incompatible, -// ] t = db.jstests_aggregation_strcasecmp; t.drop(); diff --git a/jstests/aggregation/bugs/substr.js b/jstests/aggregation/bugs/substr.js index 082998a76c6..66ad4a75253 100644 --- a/jstests/aggregation/bugs/substr.js +++ b/jstests/aggregation/bugs/substr.js @@ -1,7 +1,4 @@ // Aggregation $substrBytes tests. -// @tags: [ -// sbe_incompatible, -// ] (function() { "use strict"; diff --git a/jstests/aggregation/explain.js b/jstests/aggregation/explain.js index 92bd2322c98..75a71412c74 100644 --- a/jstests/aggregation/explain.js +++ b/jstests/aggregation/explain.js @@ -1,6 +1,7 @@ // Tests the behavior of explain() when used with the aggregation pipeline. // - Explain() should not read or modify the plan cache. // - The result should always include serverInfo. +// TODO SERVER-50737: remove sbe_incompatible tag // @tags: [ // sbe_incompatible, // ] diff --git a/jstests/aggregation/expressions/arrayToObject.js b/jstests/aggregation/expressions/arrayToObject.js index 58bd662d195..c5f3ec358c2 100644 --- a/jstests/aggregation/expressions/arrayToObject.js +++ b/jstests/aggregation/expressions/arrayToObject.js @@ -1,7 +1,4 @@ // Tests for $arrayToObject aggregation expression. -// @tags: [ -// sbe_incompatible, -// ] (function() { "use strict"; diff --git a/jstests/aggregation/expressions/binarySize.js b/jstests/aggregation/expressions/binarySize.js index 27b139ac1ae..076498b8f63 100644 --- a/jstests/aggregation/expressions/binarySize.js +++ b/jstests/aggregation/expressions/binarySize.js @@ -1,8 +1,5 @@ /** * Test the $binarySize expression. - * @tags: [ - * sbe_incompatible, - * ] */ (function() { "use strict"; diff --git a/jstests/aggregation/expressions/collation_expressions.js b/jstests/aggregation/expressions/collation_expressions.js index ded218f91ab..5ecad4f02ec 100644 --- a/jstests/aggregation/expressions/collation_expressions.js +++ b/jstests/aggregation/expressions/collation_expressions.js @@ -1,7 +1,6 @@ // Cannot implicitly shard accessed collections because of collection existing when none expected. // @tags: [ // assumes_no_implicit_collection_creation_after_drop, -// sbe_incompatible, // ] // Test that expressions which make can make string comparisons respect the collation. diff --git a/jstests/aggregation/expressions/collation_expressions_sbe.js b/jstests/aggregation/expressions/collation_expressions_sbe.js deleted file mode 100644 index 2d91424c44b..00000000000 --- a/jstests/aggregation/expressions/collation_expressions_sbe.js +++ /dev/null @@ -1,204 +0,0 @@ -// Cannot implicitly shard accessed collections because of collection existing when none expected. -// TODO: Enable "collation_expressions.js" under SBE mode and remove this test once SERVER-51823 -// is fixed. -// @tags: [ -// assumes_no_implicit_collection_creation_after_drop, -// ] - -// Test that expressions which make can make string comparisons respect the collation. -(function() { -"use strict"; - -// For testExpression() and testExpressionWithCollation(). -load("jstests/aggregation/extras/utils.js"); - -var coll = db.collation_expressions_sbe; -coll.drop(); - -var results; -const caseInsensitive = { - locale: "en_US", - strength: 2 -}; -const numericOrdering = { - locale: "en_US", - numericOrdering: true -}; - -// Test that $cmp respects the collection-default collation. -assert.commandWorked(db.createCollection(coll.getName(), {collation: caseInsensitive})); -testExpression(coll, {$cmp: ["a", "A"]}, 0); - -coll.drop(); - -// Test that $cmp respects the collation. -testExpressionWithCollation(coll, {$cmp: ["a", "A"]}, 0, caseInsensitive); - -// Test that $eq respects the collation. -testExpressionWithCollation(coll, {$eq: ["a", "A"]}, true, caseInsensitive); - -// Test that $ne respects the collation. -testExpressionWithCollation(coll, {$ne: ["a", "A"]}, false, caseInsensitive); - -// Test that $lt respects the collation. -testExpressionWithCollation(coll, {$lt: ["2", "10"]}, true, numericOrdering); - -// Test that $lte respects the collation. -testExpressionWithCollation(coll, {$lte: ["2", "10"]}, true, numericOrdering); -testExpressionWithCollation(coll, {$lte: ["b", "B"]}, true, caseInsensitive); - -// Test that $gt respects the collation. -testExpressionWithCollation(coll, {$gt: ["2", "10"]}, false, numericOrdering); - -// Test that $gte respects the collation. -testExpressionWithCollation(coll, {$gte: ["2", "10"]}, false, numericOrdering); -testExpressionWithCollation(coll, {$gte: ["b", "B"]}, true, caseInsensitive); - -// Test that $in respects the collation. -testExpressionWithCollation(coll, {$in: ["A", [1, 2, "a", 3, 4]]}, true, caseInsensitive); - -// Test that $indexOfArray respects the collation. -testExpressionWithCollation( - coll, {$indexOfArray: [[1, 2, "a", "b", "c", "B"], "B"]}, 3, caseInsensitive); - -// Test that $indexOfBytes doesn't respect the collation. -testExpressionWithCollation(coll, {$indexOfBytes: ["12abcB", "B"]}, 5, caseInsensitive); - -// Test that $indexOfCP doesn't respect the collation. -testExpressionWithCollation(coll, {$indexOfCP: ["12abcB", "B"]}, 5, caseInsensitive); - -// Test that $strcasecmp doesn't respect the collation. -testExpressionWithCollation(coll, {$strcasecmp: ["100", "2"]}, -1, numericOrdering); - -// Test that $setEquals respects the collation. -testExpressionWithCollation(coll, {$setEquals: [["a", "B"], ["b", "A"]]}, true, caseInsensitive); - -// Test that $setIntersection respects the collation. -results = - coll.aggregate([{$project: {out: {$setIntersection: [["a", "B", "c"], ["d", "b", "A"]]}}}], - {collation: caseInsensitive}) - .toArray(); -assert.eq(1, results.length); -assert.eq(2, results[0].out.length); - -// Test that $setUnion respects the collation. -results = coll.aggregate([{$project: {out: {$setUnion: [["a", "B", "c"], ["d", "b", "A"]]}}}], - {collation: caseInsensitive}) - .toArray(); -assert.eq(1, results.length); -assert.eq(4, results[0].out.length); - -// Test that $setDifference respects the collation. -testExpressionWithCollation(coll, {$setDifference: [["a", "B"], ["b", "A"]]}, [], caseInsensitive); - -// Test that $setIsSubset respects the collation. -testExpressionWithCollation( - coll, {$setIsSubset: [["a", "B"], ["b", "A", "c"]]}, true, caseInsensitive); - -// Test that $split doesn't respect the collation. -testExpressionWithCollation(coll, {$split: ["abc", "B"]}, ["abc"], caseInsensitive); - -// Test that an $and which can be optimized out respects the collation. -coll.drop(); -assert.commandWorked(coll.insert({_id: 1, str: "A"})); -results = coll.aggregate([{$project: {out: {$and: [{$eq: ["$str", "a"]}, {$eq: ["b", "B"]}]}}}], - {collation: caseInsensitive}) - .toArray(); -assert.eq(1, results.length); -assert.eq(true, results[0].out); - -// Test that an $and which cannot be optimized out respects the collation. -coll.drop(); -assert.commandWorked(coll.insert({_id: 1, str: "A", str2: "B"})); -results = coll.aggregate([{$project: {out: {$and: [{$eq: ["$str", "a"]}, {$eq: ["$str2", "b"]}]}}}], - {collation: caseInsensitive}) - .toArray(); -assert.eq(1, results.length); -assert.eq(true, results[0].out); - -// Test that an $or which can be optimized out respects the collation. -coll.drop(); -assert.commandWorked(coll.insert({_id: 1, str: "A"})); -results = coll.aggregate([{$project: {out: {$or: [{$eq: ["$str", "a"]}, {$eq: ["b", "c"]}]}}}], - {collation: caseInsensitive}) - .toArray(); -assert.eq(1, results.length); -assert.eq(true, results[0].out); - -// Test that an $or which cannot be optimized out respects the collation. -coll.drop(); -assert.commandWorked(coll.insert({_id: 1, str: "A", str2: "B"})); -results = coll.aggregate([{$project: {out: {$or: [{$eq: ["$str", "c"]}, {$eq: ["$str2", "b"]}]}}}], - {collation: caseInsensitive}) - .toArray(); -assert.eq(1, results.length); -assert.eq(true, results[0].out); - -// Test that $filter's subexpressions respect the collation. -testExpressionWithCollation(coll, - { - $filter: { - input: { - $cond: { - if: {$eq: ["FOO", "foo"]}, - then: ["a", "b", "A", "c", "C", "d"], - else: null - } - }, - as: "str", - cond: {$or: [{$eq: ["$$str", "a"]}, {$eq: ["$$str", "c"]}]} - } - }, - ["a", "A", "c", "C"], - caseInsensitive); - -// Test that $let's subexpressions respect the collation. -testExpressionWithCollation(coll, - { - $let: { - vars: {str: {$cond: [{$eq: ["A", "a"]}, "b", "c"]}}, - in : {$cond: [{$eq: ["$$str", "B"]}, "d", "e"]} - } - }, - "d", - caseInsensitive); - -// Test that $group stage's _id expressions respect the collation. -coll.drop(); -assert.commandWorked(coll.insert({_id: 1})); -results = coll.aggregate([{$group: {_id: {a: {$eq: ["a", "A"]}, b: {$eq: ["b", "B"]}}}}], - {collation: caseInsensitive}) - .toArray(); -assert.eq(1, results.length); -assert.eq(true, results[0]._id.a); -assert.eq(true, results[0]._id.b); - -// Test that $switch's subexpressions respect the collation. -coll.drop(); -assert.commandWorked(coll.insert({_id: 1, a: "A"})); -assert.commandWorked(coll.insert({_id: 2, b: "B"})); -assert.commandWorked(coll.insert({_id: 3, c: "C"})); -results = coll.aggregate( - [ - {$sort: {_id: 1}}, - { - $project: { - out: { - $switch: { - branches: [ - {case: {$eq: ["$a", "a"]}, then: "foo"}, - {case: {$eq: ["$b", "b"]}, then: "bar"} - ], - default: "baz" - } - } - } - } - ], - {collation: caseInsensitive}) - .toArray(); -assert.eq(3, results.length); -assert.eq("foo", results[0].out); -assert.eq("bar", results[1].out); -assert.eq("baz", results[2].out); -})(); diff --git a/jstests/aggregation/expressions/convert.js b/jstests/aggregation/expressions/convert.js index 9279338b462..395ab5d9e93 100644 --- a/jstests/aggregation/expressions/convert.js +++ b/jstests/aggregation/expressions/convert.js @@ -1,8 +1,5 @@ /** * Tests behavior of $convert aggregation operator. - * @tags: [ - * sbe_incompatible, - * ] */ (function() { "use strict"; diff --git a/jstests/aggregation/expressions/date_from_parts.js b/jstests/aggregation/expressions/date_from_parts.js index 812e2a1b2d7..695a6966e36 100644 --- a/jstests/aggregation/expressions/date_from_parts.js +++ b/jstests/aggregation/expressions/date_from_parts.js @@ -7,9 +7,6 @@ load("jstests/libs/sbe_assert_error_override.js"); // Override error-code-check const coll = db.dateFromParts; // Basic Sanity Checks -// @tags: [ -// sbe_incompatible, -// ] coll.drop(); assert.commandWorked(coll.insert([ diff --git a/jstests/aggregation/expressions/date_from_string.js b/jstests/aggregation/expressions/date_from_string.js index 466730c3775..9b4d0702e5e 100644 --- a/jstests/aggregation/expressions/date_from_string.js +++ b/jstests/aggregation/expressions/date_from_string.js @@ -1,8 +1,3 @@ -/** - * @tags: [ - * sbe_incompatible, - * ] - */ load("jstests/aggregation/extras/utils.js"); // For assertErrorCode and assertErrMsgContains. (function() { diff --git a/jstests/aggregation/expressions/date_from_string_on_error.js b/jstests/aggregation/expressions/date_from_string_on_error.js index 2d04e1697ca..51936da86ea 100644 --- a/jstests/aggregation/expressions/date_from_string_on_error.js +++ b/jstests/aggregation/expressions/date_from_string_on_error.js @@ -1,8 +1,5 @@ /** * Tests for the $dateFromString expression with the optional 'onError' parameter. - * @tags: [ - * sbe_incompatible, - * ] */ (function() { "use strict"; diff --git a/jstests/aggregation/expressions/date_from_string_on_null.js b/jstests/aggregation/expressions/date_from_string_on_null.js index 02340c3e925..be99897d5cb 100644 --- a/jstests/aggregation/expressions/date_from_string_on_null.js +++ b/jstests/aggregation/expressions/date_from_string_on_null.js @@ -1,8 +1,5 @@ /** * Tests for the $dateFromString expression with the optional 'onNull' parameter. - * @tags: [ - * sbe_incompatible, - * ] */ (function() { "use strict"; diff --git a/jstests/aggregation/expressions/date_to_string.js b/jstests/aggregation/expressions/date_to_string.js index 2964183a5ec..b618c81e383 100644 --- a/jstests/aggregation/expressions/date_to_string.js +++ b/jstests/aggregation/expressions/date_to_string.js @@ -1,8 +1,3 @@ -/** - * @tags: [ - * sbe_incompatible, - * ] - */ load("jstests/aggregation/extras/utils.js"); // For assertErrorCode (function() { diff --git a/jstests/aggregation/expressions/date_to_string_on_null.js b/jstests/aggregation/expressions/date_to_string_on_null.js index 3f4973dbe02..15db75bee75 100644 --- a/jstests/aggregation/expressions/date_to_string_on_null.js +++ b/jstests/aggregation/expressions/date_to_string_on_null.js @@ -1,8 +1,5 @@ /** * Tests for the $dateToString expression with the optional 'onNull' parameter. - * @tags: [ - * sbe_incompatible, - * ] */ (function() { "use strict"; diff --git a/jstests/aggregation/expressions/expression_function.js b/jstests/aggregation/expressions/expression_function.js index f3b0191d63a..27b38bc9148 100644 --- a/jstests/aggregation/expressions/expression_function.js +++ b/jstests/aggregation/expressions/expression_function.js @@ -1,7 +1,4 @@ // Tests basic functionality of the $function expression. -// @tags: [ -// sbe_incompatible, -// ] (function() { "use strict"; diff --git a/jstests/aggregation/expressions/internal_js_emit.js b/jstests/aggregation/expressions/internal_js_emit.js index 26b579972e7..7f8f1f4f38c 100644 --- a/jstests/aggregation/expressions/internal_js_emit.js +++ b/jstests/aggregation/expressions/internal_js_emit.js @@ -1,8 +1,5 @@ // Tests basic functionality of the $_internalJsEmit expression, which provides capability for the // map stage of MapReduce. -// @tags: [ -// sbe_incompatible, -// ] (function() { "use strict"; @@ -88,4 +85,4 @@ pipeline = [{ assert.commandFailedWithCode( db.runCommand({aggregate: coll.getName(), pipeline: pipeline, cursor: {}}), ErrorCodes.JSInterpreterFailure); -})();
\ No newline at end of file +})(); diff --git a/jstests/aggregation/expressions/internal_js_emit_with_scope.js b/jstests/aggregation/expressions/internal_js_emit_with_scope.js index 012fea634d6..261addf7f89 100644 --- a/jstests/aggregation/expressions/internal_js_emit_with_scope.js +++ b/jstests/aggregation/expressions/internal_js_emit_with_scope.js @@ -4,7 +4,6 @@ // Do not run in sharded passthroughs since 'runtimeConstants' is disallowed on mongos. // @tags: [ // assumes_unsharded_collection, -// sbe_incompatible, // ] (function() { "use strict"; diff --git a/jstests/aggregation/expressions/is_number.js b/jstests/aggregation/expressions/is_number.js index ddf75dba4dc..0a7c68cecab 100644 --- a/jstests/aggregation/expressions/is_number.js +++ b/jstests/aggregation/expressions/is_number.js @@ -1,8 +1,5 @@ /** * Tests for the $isNumber aggregation expression. - * @tags: [ - * sbe_incompatible, - * ] */ (function() { 'use strict'; diff --git a/jstests/aggregation/expressions/let.js b/jstests/aggregation/expressions/let.js index bd6e83d3e9f..9bc3fcdb87f 100644 --- a/jstests/aggregation/expressions/let.js +++ b/jstests/aggregation/expressions/let.js @@ -1,8 +1,5 @@ /** * Basic integration tests for the $let expression. - * @tags: [ - * sbe_incompatible, - * ] */ (function() { "use strict"; diff --git a/jstests/aggregation/expressions/map.js b/jstests/aggregation/expressions/map.js index d8b3794aea9..0792f7211e7 100644 --- a/jstests/aggregation/expressions/map.js +++ b/jstests/aggregation/expressions/map.js @@ -1,7 +1,4 @@ // SERVER-9841 $map expression to map over arrays -// @tags: [ -// sbe_incompatible, -// ] (function() { "use strict"; load('jstests/aggregation/extras/utils.js'); diff --git a/jstests/aggregation/expressions/merge_objects.js b/jstests/aggregation/expressions/merge_objects.js index 48805c0890d..995299f3e6c 100644 --- a/jstests/aggregation/expressions/merge_objects.js +++ b/jstests/aggregation/expressions/merge_objects.js @@ -1,7 +1,4 @@ // Tests for the $mergeObjects aggregation expression. -// @tags: [ -// sbe_incompatible, -// ] (function() { "use strict"; diff --git a/jstests/aggregation/expressions/objectToArray.js b/jstests/aggregation/expressions/objectToArray.js index ad42501a67a..704aacd62a6 100644 --- a/jstests/aggregation/expressions/objectToArray.js +++ b/jstests/aggregation/expressions/objectToArray.js @@ -1,7 +1,4 @@ // Tests for the $objectToArray aggregation expression. -// @tags: [ -// sbe_incompatible, -// ] (function() { "use strict"; diff --git a/jstests/aggregation/expressions/rand.js b/jstests/aggregation/expressions/rand.js index f22b10da905..d4d3559bc1a 100644 --- a/jstests/aggregation/expressions/rand.js +++ b/jstests/aggregation/expressions/rand.js @@ -1,8 +1,5 @@ /** * Test the $rand expression. - * @tags: [ - * sbe_incompatible, - * ] */ (function() { "use strict"; diff --git a/jstests/aggregation/expressions/reduce.js b/jstests/aggregation/expressions/reduce.js index e81d9131be9..2565b88ed60 100644 --- a/jstests/aggregation/expressions/reduce.js +++ b/jstests/aggregation/expressions/reduce.js @@ -1,8 +1,5 @@ // In SERVER-17258, the $reduce expression was introduced. In this test file, we check the // functionality and error cases of the expression. -// @tags: [ -// sbe_incompatible, -// ] load("jstests/aggregation/extras/utils.js"); // For assertErrorCode and testExpression. (function() { diff --git a/jstests/aggregation/expressions/size.js b/jstests/aggregation/expressions/size.js index 2b77a2529a7..3aa1c5d61eb 100644 --- a/jstests/aggregation/expressions/size.js +++ b/jstests/aggregation/expressions/size.js @@ -1,8 +1,5 @@ /** * Test the $size expression. - * @tags: [ - * sbe_incompatible, - * ] */ (function() { "use strict"; diff --git a/jstests/aggregation/expressions/switch_errors.js b/jstests/aggregation/expressions/switch_errors.js index c45d20f56a3..9701bc4b019 100644 --- a/jstests/aggregation/expressions/switch_errors.js +++ b/jstests/aggregation/expressions/switch_errors.js @@ -1,9 +1,7 @@ // SERVER-10689 introduced the $switch expression. In this file, we test the error cases of the // expression. -// @tags: [ -// sbe_incompatible, -// ] -load("jstests/aggregation/extras/utils.js"); // For assertErrorCode. +load("jstests/aggregation/extras/utils.js"); // For assertErrorCode. +load("jstests/libs/sbe_assert_error_override.js"); // Override error-code-checking APIs. (function() { "use strict"; diff --git a/jstests/aggregation/expressions/trim.js b/jstests/aggregation/expressions/trim.js index 96597d402f4..821e15ea4a3 100644 --- a/jstests/aggregation/expressions/trim.js +++ b/jstests/aggregation/expressions/trim.js @@ -1,8 +1,5 @@ /** * Basic tests for the $trim, $ltrim, and $rtrim expressions. - * @tags: [ - * sbe_incompatible, - * ] */ (function() { "use strict"; diff --git a/jstests/aggregation/group_conversion_to_distinct_scan.js b/jstests/aggregation/group_conversion_to_distinct_scan.js index 72d1da8b46d..95a55fec612 100644 --- a/jstests/aggregation/group_conversion_to_distinct_scan.js +++ b/jstests/aggregation/group_conversion_to_distinct_scan.js @@ -13,7 +13,6 @@ * do_not_wrap_aggregations_in_facets, * # Index filter commands do not support causal consistency. * does_not_support_causal_consistency, - * sbe_incompatible, * ] */ diff --git a/jstests/aggregation/match_swapping_renamed_fields.js b/jstests/aggregation/match_swapping_renamed_fields.js index 77aac5732d9..1657282e735 100644 --- a/jstests/aggregation/match_swapping_renamed_fields.js +++ b/jstests/aggregation/match_swapping_renamed_fields.js @@ -4,7 +4,6 @@ * @tags: [ * do_not_wrap_aggregations_in_facets, * requires_pipeline_optimization, - * sbe_incompatible, * ] */ (function() { diff --git a/jstests/aggregation/sort_key_with_missing_fields.js b/jstests/aggregation/sort_key_with_missing_fields.js index 5c45a0e6736..f70847c5f38 100644 --- a/jstests/aggregation/sort_key_with_missing_fields.js +++ b/jstests/aggregation/sort_key_with_missing_fields.js @@ -1,9 +1,6 @@ // Ensure that sort behavior for undefined, missing, and null fields is the same for both find and // aggregation. This test validates the fix for SERVER-42565, which was caused by inconsistent // behavior for generating sort keys in aggregation. -// @tags: [ -// sbe_incompatible, -// ] (function() { "use strict"; @@ -63,4 +60,4 @@ assert.commandWorked(coll.insert([ checkFindAndAggSorts({"a.b": 1, _id: 1}, expectedOrderForward); checkFindAndAggSorts({"a.b": -1, _id: -1}, expectedOrderReverse); -}());
\ No newline at end of file +}()); diff --git a/jstests/aggregation/sources/addFields/weather.js b/jstests/aggregation/sources/addFields/weather.js index b081aa84908..6b440bf5f66 100644 --- a/jstests/aggregation/sources/addFields/weather.js +++ b/jstests/aggregation/sources/addFields/weather.js @@ -2,9 +2,6 @@ * $addFields can be used to add fixed and computed fields to documents while preserving the * original document. Verify that using $addFields and adding computed fields in a $project yield * the same result. Use the sample case of computing weather metadata. - * @tags: [ - * sbe_incompatible, - * ] */ (function() { diff --git a/jstests/aggregation/sources/geonear/collation_geonear.js b/jstests/aggregation/sources/geonear/collation_geonear.js index b14d39211a7..4bc74e66c0d 100644 --- a/jstests/aggregation/sources/geonear/collation_geonear.js +++ b/jstests/aggregation/sources/geonear/collation_geonear.js @@ -1,7 +1,6 @@ // Cannot implicitly shard accessed collections because of collection existing when none expected. // @tags: [ // assumes_no_implicit_collection_creation_after_drop, -// sbe_incompatible, // ] // Test that the $geoNear stage's query predicate respects the collation. diff --git a/jstests/aggregation/sources/geonear/distancefield_and_includelocs.js b/jstests/aggregation/sources/geonear/distancefield_and_includelocs.js index 26469fadea4..c2406299a4b 100644 --- a/jstests/aggregation/sources/geonear/distancefield_and_includelocs.js +++ b/jstests/aggregation/sources/geonear/distancefield_and_includelocs.js @@ -1,9 +1,6 @@ /** * Tests the behavior of the $geoNear stage by varying 'distanceField' and 'includeLocs' * (specifically, by specifying nested fields, overriding existing fields, and so on). - * @tags: [ - * sbe_incompatible, - * ] */ (function() { "use strict"; diff --git a/jstests/aggregation/sources/geonear/geonear_hint.js b/jstests/aggregation/sources/geonear/geonear_hint.js index fc5ff62ed3a..31c700955b3 100644 --- a/jstests/aggregation/sources/geonear/geonear_hint.js +++ b/jstests/aggregation/sources/geonear/geonear_hint.js @@ -1,7 +1,4 @@ // Verify that an aggregate with $geoNear always uses the index hinted to the aggregate command. -// @tags: [ -// sbe_incompatible, -// ] (function() { "use strict"; diff --git a/jstests/aggregation/sources/geonear/mindistance_and_maxdistance.js b/jstests/aggregation/sources/geonear/mindistance_and_maxdistance.js index 22591bffa35..99262902d3e 100644 --- a/jstests/aggregation/sources/geonear/mindistance_and_maxdistance.js +++ b/jstests/aggregation/sources/geonear/mindistance_and_maxdistance.js @@ -1,8 +1,5 @@ /** * Tests the behavior of the $geoNear stage with varying values of 'minDistance' and 'maxDistance'. - * @tags: [ - * sbe_incompatible, - * ] */ (function() { "use strict"; diff --git a/jstests/aggregation/sources/geonear/requires_geo_index.js b/jstests/aggregation/sources/geonear/requires_geo_index.js index b425d8bece6..7362ba0b09f 100644 --- a/jstests/aggregation/sources/geonear/requires_geo_index.js +++ b/jstests/aggregation/sources/geonear/requires_geo_index.js @@ -4,7 +4,6 @@ // @tags: [ // assumes_unsharded_collection, // do_not_wrap_aggregations_in_facets, -// sbe_incompatible, // ] (function() { "use strict"; diff --git a/jstests/aggregation/sources/graphLookup/error.js b/jstests/aggregation/sources/graphLookup/error.js index fe1b08ac81c..76245fe5ebb 100644 --- a/jstests/aggregation/sources/graphLookup/error.js +++ b/jstests/aggregation/sources/graphLookup/error.js @@ -2,11 +2,11 @@ // for target collection of $lookup and $graphLookup. // @tags: [ // assumes_unsharded_collection, -// sbe_incompatible, // ] // In MongoDB 3.4, $graphLookup was introduced. In this file, we test the error cases. -load("jstests/aggregation/extras/utils.js"); // For "assertErrorCode". +load("jstests/aggregation/extras/utils.js"); // For "assertErrorCode". +load("jstests/libs/sbe_assert_error_override.js"); // Override error-code-checking APIs. (function() { "use strict"; diff --git a/jstests/aggregation/sources/group/text_score_grouping.js b/jstests/aggregation/sources/group/text_score_grouping.js index eb6cbd6957a..1fa328a196e 100644 --- a/jstests/aggregation/sources/group/text_score_grouping.js +++ b/jstests/aggregation/sources/group/text_score_grouping.js @@ -1,8 +1,5 @@ /** * Tests that a user can group on the text score. - * @tags: [ - * sbe_incompatible, - * ] */ (function() { "use strict"; diff --git a/jstests/aggregation/sources/lookup/lookup_absorb_match.js b/jstests/aggregation/sources/lookup/lookup_absorb_match.js index d0a9c762d7a..926abfad7e7 100644 --- a/jstests/aggregation/sources/lookup/lookup_absorb_match.js +++ b/jstests/aggregation/sources/lookup/lookup_absorb_match.js @@ -6,7 +6,6 @@ * collection. * @tags: [ * assumes_unsharded_collection, - * sbe_incompatible, * ] */ (function() { diff --git a/jstests/aggregation/sources/lookup/lookup_contains_text.js b/jstests/aggregation/sources/lookup/lookup_contains_text.js index e7ed12bac5b..10f2d018dfb 100644 --- a/jstests/aggregation/sources/lookup/lookup_contains_text.js +++ b/jstests/aggregation/sources/lookup/lookup_contains_text.js @@ -3,7 +3,6 @@ // TODO SERVER-29159: Enable test on passthroughs with sharded collections. // @tags: [ // assumes_unsharded_collection, -// sbe_incompatible, // ] (function() { "use strict"; diff --git a/jstests/aggregation/sources/lookup/lookup_subpipeline_and_fields.js b/jstests/aggregation/sources/lookup/lookup_subpipeline_and_fields.js index 1aa1cb44e37..48a5cb4517d 100644 --- a/jstests/aggregation/sources/lookup/lookup_subpipeline_and_fields.js +++ b/jstests/aggregation/sources/lookup/lookup_subpipeline_and_fields.js @@ -5,7 +5,6 @@ * collection. * @tags: [ * assumes_unsharded_collection, - * sbe_incompatible * ] */ (function() { diff --git a/jstests/aggregation/sources/lookup/lookup_subpipeline_geonear.js b/jstests/aggregation/sources/lookup/lookup_subpipeline_geonear.js index b199d03ae13..af5fdb31a1a 100644 --- a/jstests/aggregation/sources/lookup/lookup_subpipeline_geonear.js +++ b/jstests/aggregation/sources/lookup/lookup_subpipeline_geonear.js @@ -4,7 +4,6 @@ // @tags: [ // assumes_unsharded_collection, // do_not_wrap_aggregations_in_facets, -// sbe_incompatible, // ] (function() { "use strict"; diff --git a/jstests/aggregation/sources/match/dotted_numeric_path.js b/jstests/aggregation/sources/match/dotted_numeric_path.js index e2e77147979..86ee090624e 100644 --- a/jstests/aggregation/sources/match/dotted_numeric_path.js +++ b/jstests/aggregation/sources/match/dotted_numeric_path.js @@ -1,6 +1,7 @@ /** * Tests that $match works correctly with dotted numeric path. * + * TODO SERVER-49852: remove sbe_incompatible tag * @tags: [sbe_incompatible] */ (function() { diff --git a/jstests/aggregation/sources/match/expr_match.js b/jstests/aggregation/sources/match/expr_match.js index 97809af0431..6f780883955 100644 --- a/jstests/aggregation/sources/match/expr_match.js +++ b/jstests/aggregation/sources/match/expr_match.js @@ -1,7 +1,4 @@ // Basic testing to confirm that the $match stage handles $expr correctly. -// @tags: [ -// sbe_incompatible, -// ] (function() { "use strict"; diff --git a/jstests/aggregation/sources/project/id_meta_projection.js b/jstests/aggregation/sources/project/id_meta_projection.js index 898ae799cdf..9f604068d47 100644 --- a/jstests/aggregation/sources/project/id_meta_projection.js +++ b/jstests/aggregation/sources/project/id_meta_projection.js @@ -8,7 +8,6 @@ assert.commandWorked(coll.insert({_id: 0, a: 1, b: 1})); // Run the aggregate once where the $project can be pushed down. // @tags: [ -// sbe_incompatible, // ] const projectPushedDownRes = coll.aggregate([{$sort: {a: 1}}, {$project: {_id: 0, metaField: {$meta: "sortKey"}}}]) diff --git a/jstests/aggregation/sources/project/remove_redundant_projects.js b/jstests/aggregation/sources/project/remove_redundant_projects.js index b5aa4ed7d31..2ab081f77a8 100644 --- a/jstests/aggregation/sources/project/remove_redundant_projects.js +++ b/jstests/aggregation/sources/project/remove_redundant_projects.js @@ -46,10 +46,10 @@ function assertResultsMatch({ if (pipelineOptimizedAway) { assert(isQueryPlan(explain), explain); - result = explain.queryPlanner.winningPlan; + result = getWinningPlan(explain.queryPlanner); } else { assert(isAggregationPlan(explain), explain); - result = explain.stages[0].$cursor.queryPlanner.winningPlan; + result = getWinningPlan(explain.stages[0].$cursor.queryPlanner); } // Check that $project uses the query system. diff --git a/jstests/aggregation/sources/sort/sort_with_metadata.js b/jstests/aggregation/sources/sort/sort_with_metadata.js index 155426c912d..1bb9a6779fd 100644 --- a/jstests/aggregation/sources/sort/sort_with_metadata.js +++ b/jstests/aggregation/sources/sort/sort_with_metadata.js @@ -1,7 +1,4 @@ // Test that the $sort stage properly errors on invalid $meta. -// @tags: [ -// sbe_incompatible, -// ] (function() { "use strict"; @@ -47,4 +44,4 @@ assert.sameMembers(results, {$sort: {textScore: {$meta: 'randVal'}}} ]) .toArray()); -})();
\ No newline at end of file +})(); diff --git a/jstests/aggregation/sources/unionWith/unionWith_allows_stages.js b/jstests/aggregation/sources/unionWith/unionWith_allows_stages.js index e5f5ce5d760..6d8496df44b 100644 --- a/jstests/aggregation/sources/unionWith/unionWith_allows_stages.js +++ b/jstests/aggregation/sources/unionWith/unionWith_allows_stages.js @@ -3,7 +3,6 @@ * Some of these stages cannot be used in facets. * @tags: [ * do_not_wrap_aggregations_in_facets, - * sbe_incompatible, * ] */ diff --git a/jstests/aggregation/sources/unionWith/unionWith_maxTimeMS.js b/jstests/aggregation/sources/unionWith/unionWith_maxTimeMS.js index fcec578a996..92d84b4ee37 100644 --- a/jstests/aggregation/sources/unionWith/unionWith_maxTimeMS.js +++ b/jstests/aggregation/sources/unionWith/unionWith_maxTimeMS.js @@ -1,8 +1,5 @@ /** * Tests that maxTimeMS is respected even in an inner $unionWith pipeline. - * @tags: [ - * sbe_incompatible, - * ] */ (function() { diff --git a/jstests/aggregation/testall.js b/jstests/aggregation/testall.js index ba3de62d09c..94966fb2d62 100644 --- a/jstests/aggregation/testall.js +++ b/jstests/aggregation/testall.js @@ -2,9 +2,6 @@ "use strict"; // Loads data into the namespace 'aggdb.articles'. -// @tags: [ -// sbe_incompatible, -// ] load('jstests/aggregation/data/articles.js'); load('jstests/aggregation/extras/utils.js'); diff --git a/jstests/aggregation/use_query_sort.js b/jstests/aggregation/use_query_sort.js index fdb408ae047..ca8c6f3bd77 100644 --- a/jstests/aggregation/use_query_sort.js +++ b/jstests/aggregation/use_query_sort.js @@ -5,7 +5,6 @@ // in $facet stages: // @tags: [ // do_not_wrap_aggregations_in_facets, -// sbe_incompatible, // ] (function() { "use strict"; diff --git a/jstests/aggregation/variables/remove_system_variable.js b/jstests/aggregation/variables/remove_system_variable.js index 04341180aad..21bc308d0c9 100644 --- a/jstests/aggregation/variables/remove_system_variable.js +++ b/jstests/aggregation/variables/remove_system_variable.js @@ -1,8 +1,5 @@ /** * Tests for the $$REMOVE system variable. - * @tags: [ - * sbe_incompatible, - * ] */ (function() { "use strict"; diff --git a/jstests/core/add_skip_stage_before_fetch.js b/jstests/core/add_skip_stage_before_fetch.js index 6bbefdb881f..bef29a795e6 100644 --- a/jstests/core/add_skip_stage_before_fetch.js +++ b/jstests/core/add_skip_stage_before_fetch.js @@ -6,7 +6,6 @@ // @tags: [ // assumes_unsharded_collection, // operations_longer_than_stepdown_interval_in_txns, -// sbe_incompatible, // ] (function() { diff --git a/jstests/core/agg_hint.js b/jstests/core/agg_hint.js index c6eea5159dc..0deb0bf4408 100644 --- a/jstests/core/agg_hint.js +++ b/jstests/core/agg_hint.js @@ -3,7 +3,6 @@ // @tags: [ // assumes_no_implicit_collection_creation_after_drop, // does_not_support_stepdowns, -// sbe_incompatible, // ] // Confirms correct behavior for hinted aggregation execution. This includes tests for scenarios diff --git a/jstests/core/all2.js b/jstests/core/all2.js index 44462787d20..385e01763e3 100644 --- a/jstests/core/all2.js +++ b/jstests/core/all2.js @@ -1,5 +1,6 @@ /** + * TODO SERVER-50737: remove sbe_incompatible tag * @tags: [ * sbe_incompatible, * ] diff --git a/jstests/core/and3.js b/jstests/core/and3.js index 1e74db57594..77f769c805a 100644 --- a/jstests/core/and3.js +++ b/jstests/core/and3.js @@ -1,4 +1,5 @@ // Check key match with sub matchers - part of SERVER-3192 +// TODO SERVER-52734: remove sbe_incompatible tag // @tags: [ // assumes_balancer_off, // # Uses $where operator diff --git a/jstests/core/api_version_test_expression.js b/jstests/core/api_version_test_expression.js index 1e16c0781be..5259fdc3dfa 100644 --- a/jstests/core/api_version_test_expression.js +++ b/jstests/core/api_version_test_expression.js @@ -7,7 +7,6 @@ * assumes_against_mongod_not_mongos, * assumes_unsharded_collection, * requires_fcv_47, - * sbe_incompatible, * uses_api_parameters, * ] */ diff --git a/jstests/core/array4.js b/jstests/core/array4.js index 556fd3c2717..c43cbb047c0 100644 --- a/jstests/core/array4.js +++ b/jstests/core/array4.js @@ -1,5 +1,6 @@ /** + * TODO SERVER-49852: remove sbe_incompatible tag * @tags: [ * sbe_incompatible, * ] diff --git a/jstests/core/basic2.js b/jstests/core/basic2.js index a4ed5905291..3500d9fbdb5 100644 --- a/jstests/core/basic2.js +++ b/jstests/core/basic2.js @@ -1,7 +1,6 @@ // @tags: [ // requires_fastcount, // requires_non_retryable_writes, -// sbe_incompatible, // ] t = db.getCollection("basic2"); diff --git a/jstests/core/batch_size.js b/jstests/core/batch_size.js index c0afc382975..7beda6fe349 100644 --- a/jstests/core/batch_size.js +++ b/jstests/core/batch_size.js @@ -1,3 +1,4 @@ +// TODO SERVER-50737: remove sbe_incompatible tag // @tags: [ // assumes_balancer_off, // requires_getmore, diff --git a/jstests/core/bypass_doc_validation.js b/jstests/core/bypass_doc_validation.js index 19e70019686..41ead9501c9 100644 --- a/jstests/core/bypass_doc_validation.js +++ b/jstests/core/bypass_doc_validation.js @@ -3,7 +3,6 @@ // requires_fastcount, // requires_fcv_47, // requires_non_retryable_commands, -// sbe_incompatible, // uses_$out, // uses_map_reduce_with_temp_collections, // ] diff --git a/jstests/core/collation.js b/jstests/core/collation.js index 8d8b2a7f4c5..15142a7659f 100644 --- a/jstests/core/collation.js +++ b/jstests/core/collation.js @@ -6,7 +6,6 @@ // requires_capped, // requires_non_retryable_commands, // requires_non_retryable_writes, -// sbe_incompatible, // ] // Integration tests for the collation feature. @@ -20,6 +19,14 @@ load("jstests/concurrency/fsm_workload_helpers/server_types.js"); // For isReplSet load("jstests/libs/fixture_helpers.js"); +// Note that the "getParameter" command is expected to fail in versions of mongod that do not yet +// include the slot-based execution engine. When that happens, however, 'isSBEEnabled' still +// correctly evaluates to false. +const isSBEEnabled = (() => { + const getParam = db.adminCommand({getParameter: 1, featureFlagSBE: 1}); + return getParam.hasOwnProperty("featureFlagSBE") && getParam.featureFlagSBE.value; +})(); + var coll = db.collation; coll.drop(); @@ -46,10 +53,10 @@ var getQueryCollation = function(explainRes) { return explainRes.queryPlanner.collation; } - if (getWinningPlan(explainRes.queryPlanner).hasOwnProperty("shards") && - getWinningPlan(explainRes.queryPlanner).shards.length > 0 && - getWinningPlan(explainRes.queryPlanner).shards[0].hasOwnProperty("collation")) { - return getWinningPlan(explainRes.queryPlanner).shards[0].collation; + const winningPlan = getWinningPlan(explainRes.queryPlanner); + if (winningPlan.hasOwnProperty("shards") && winningPlan.shards.length > 0 && + winningPlan.shards[0].hasOwnProperty("collation")) { + return winningPlan.shards[0].collation; } return null; @@ -687,7 +694,8 @@ coll.drop(); assert.commandWorked(db.createCollection(coll.getName(), {collation: {locale: "en_US"}})); explainRes = coll.explain("executionStats").find({_id: "foo"}).finish(); assert.commandWorked(explainRes); -planStage = getPlanStage(explainRes.executionStats.executionStages, "IDHACK"); +planStage = + getPlanStage(getWinningPlan(explainRes.queryPlanner), isSBEEnabled ? "IXSCAN" : "IDHACK"); assert.neq(null, planStage); // Find should return correct results for query containing $expr when no collation specified and @@ -729,8 +737,12 @@ if (db.getMongo().useReadCommands()) { explainRes = coll.explain("executionStats").find({_id: "foo"}).collation({locale: "en_US"}).finish(); assert.commandWorked(explainRes); - planStage = getPlanStage(explainRes.executionStats.executionStages, "IDHACK"); - assert.neq(null, planStage); + if (isSBEEnabled) { + planStage = getPlanStage(getWinningPlan(explainRes.queryPlanner), "IXSCAN"); + } else { + planStage = getPlanStage(explainRes.executionStats.executionStages, "IDHACK"); + } + assert.neq(null, planStage, explainRes); // Find on _id should not use idhack stage when query collation does not match collection // default. @@ -739,7 +751,11 @@ if (db.getMongo().useReadCommands()) { explainRes = coll.explain("executionStats").find({_id: "foo"}).collation({locale: "fr_CA"}).finish(); assert.commandWorked(explainRes); - planStage = getPlanStage(explainRes.executionStats.executionStages, "IDHACK"); + if (isSBEEnabled) { + planStage = getPlanStage(getWinningPlan(explainRes.queryPlanner), "IXSCAN"); + } else { + planStage = getPlanStage(explainRes.executionStats.executionStages, "IDHACK"); + } assert.eq(null, planStage); } @@ -831,7 +847,7 @@ assert.commandWorked(coll.createIndex({str: 1}, {collation: {locale: "fr_CA"}})) explainRes = coll.explain("executionStats").find({str: "foo"}).collation({locale: "fr_CA"}).finish(); assert.commandWorked(explainRes); -planStage = getPlanStage(explainRes.executionStats.executionStages, "IXSCAN"); +planStage = getPlanStage(getWinningPlan(explainRes.queryPlanner), "IXSCAN"); assert.neq(null, planStage); assert.eq(planStage.collation, { locale: "fr_CA", @@ -853,7 +869,7 @@ assert.commandWorked(db.createCollection(coll.getName(), {collation: {locale: "f assert.commandWorked(coll.createIndex({str: 1})); explainRes = coll.explain("executionStats").find({str: "foo"}).finish(); assert.commandWorked(explainRes); -planStage = getPlanStage(explainRes.executionStats.executionStages, "IXSCAN"); +planStage = getPlanStage(getWinningPlan(explainRes.queryPlanner), "IXSCAN"); assert.neq(null, planStage); assert.eq(planStage.collation, { locale: "fr_CA", diff --git a/jstests/core/command_let_variables.js b/jstests/core/command_let_variables.js index 05ecf99381e..208a0801530 100644 --- a/jstests/core/command_let_variables.js +++ b/jstests/core/command_let_variables.js @@ -2,7 +2,6 @@ // variables for use in expressions within the command. // @tags: [ // requires_fcv_48, -// sbe_incompatible, // # Does not work with legacy shellWriteMode. // requires_find_command, // ] diff --git a/jstests/core/constructors.js b/jstests/core/constructors.js index f574904d8a0..308baf405fd 100644 --- a/jstests/core/constructors.js +++ b/jstests/core/constructors.js @@ -3,7 +3,6 @@ // @tags: [ // does_not_support_stepdowns, // requires_non_retryable_commands, -// sbe_incompatible, // uses_map_reduce_with_temp_collections, // ] diff --git a/jstests/core/covered_index_sort_no_fetch_optimization.js b/jstests/core/covered_index_sort_no_fetch_optimization.js index 65411894d66..45f33767ac5 100644 --- a/jstests/core/covered_index_sort_no_fetch_optimization.js +++ b/jstests/core/covered_index_sort_no_fetch_optimization.js @@ -9,7 +9,6 @@ * assumes_unsharded_collection, * # Sort optimizations added for hashed indexes in 4.7 can generate a different plan. * requires_fcv_47, - * sbe_incompatible, * ] */ (function() { @@ -42,9 +41,10 @@ function assertExpectedResult(findCmd, expectedResult, isCovered, isBlockingSort const explainResult = assert.commandWorked(db.runCommand({explain: findCmd, verbosity: "executionStats"})); - assert.eq(isCovered, isIndexOnly(db, explainResult.queryPlanner.winningPlan), explainResult); + assert.eq( + isCovered, isIndexOnly(db, getWinningPlan(explainResult.queryPlanner)), explainResult); assert.eq(isBlockingSort, - planHasStage(db, explainResult.queryPlanner.winningPlan, "SORT"), + planHasStage(db, getWinningPlan(explainResult.queryPlanner), "SORT"), explainResult); } diff --git a/jstests/core/currentop_cursors.js b/jstests/core/currentop_cursors.js index 7ae86875e6e..ce59787cb6f 100644 --- a/jstests/core/currentop_cursors.js +++ b/jstests/core/currentop_cursors.js @@ -6,7 +6,6 @@ * assumes_read_concern_unchanged, * assumes_read_preference_unchanged, * requires_capped, - * sbe_incompatible, * ] */ diff --git a/jstests/core/dbref3.js b/jstests/core/dbref3.js index 6a91a56da2a..a60ec42c576 100644 --- a/jstests/core/dbref3.js +++ b/jstests/core/dbref3.js @@ -1,7 +1,6 @@ // Make sure we only make a DBRef object for objects where the first field is a string named $ref // and the second field is $id with any type. Only the first two fields matter for deciding if it // is a DBRef. See http://docs.mongodb.org/manual/reference/database-references/#dbrefs. - var t = db.dbref3; t.drop(); diff --git a/jstests/core/distinct_index1.js b/jstests/core/distinct_index1.js index 8d82d56ff36..0caf0e64fbc 100644 --- a/jstests/core/distinct_index1.js +++ b/jstests/core/distinct_index1.js @@ -2,7 +2,6 @@ * Analyzes execution stats for indexed distinct. * @tags: [ * assumes_balancer_off, - * sbe_incompatible, * ] */ (function() { @@ -79,6 +78,6 @@ assert.commandWorked(coll.dropIndexes()); assert.commandWorked(coll.createIndex({a: "hashed"})); explain = getDistinctExplainWithExecutionStats("a", {$or: [{a: 3}, {a: 5}]}); assert.eq(188, explain.executionStats.nReturned); -const indexScanStage = getPlanStage(explain.executionStats.executionStages, "IXSCAN"); +const indexScanStage = getPlanStage(getWinningPlan(explain.queryPlanner), "IXSCAN"); assert.eq("hashed", indexScanStage.keyPattern.a); })(); diff --git a/jstests/core/elemmatch_or_pushdown.js b/jstests/core/elemmatch_or_pushdown.js index 718b20bdbe4..2edef4d0678 100644 --- a/jstests/core/elemmatch_or_pushdown.js +++ b/jstests/core/elemmatch_or_pushdown.js @@ -1,9 +1,6 @@ /** * Tests that an $elemMatch-$or query is evaluated correctly. Designed to reproduce SERVER-33005 and * SERVER-38164. - * @tags: [ - * sbe_incompatible, - * ] */ (function() { "use strict"; diff --git a/jstests/core/exists9.js b/jstests/core/exists9.js index 3b245cd4188..c187bb3a101 100644 --- a/jstests/core/exists9.js +++ b/jstests/core/exists9.js @@ -1,7 +1,4 @@ // SERVER-393 Test exists with various empty array and empty object cases. -// @tags: [ -// sbe_incompatible, -// ] t = db.jstests_exists9; t.drop(); diff --git a/jstests/core/explain6.js b/jstests/core/explain6.js index f36640ce567..4f5e9fab082 100644 --- a/jstests/core/explain6.js +++ b/jstests/core/explain6.js @@ -1,3 +1,4 @@ +// TODO SERVER-52734: remove sbe_incompatible tag // @tags: [ // assumes_balancer_off, // requires_non_retryable_writes, diff --git a/jstests/core/explain_execution_error.js b/jstests/core/explain_execution_error.js index 4515a050edc..43ea960e8d3 100644 --- a/jstests/core/explain_execution_error.js +++ b/jstests/core/explain_execution_error.js @@ -1,7 +1,6 @@ // @tags: [ // assumes_balancer_off, // requires_getmore, -// sbe_incompatible, // ] // Test that even when the execution of a query fails, explain reports query diff --git a/jstests/core/explain_shell_helpers.js b/jstests/core/explain_shell_helpers.js index cad5fec9141..a9d5e23e9e6 100644 --- a/jstests/core/explain_shell_helpers.js +++ b/jstests/core/explain_shell_helpers.js @@ -6,7 +6,6 @@ * assumes_unsharded_collection, * does_not_support_stepdowns, * requires_fastcount, - * sbe_incompatible, * requires_fcv_47, * ] */ @@ -126,40 +125,40 @@ assert.commandWorked(explain); // .sort() explain = t.explain().find().sort({b: -1}).finish(); assert.commandWorked(explain); -assert(planHasStage(db, explain.queryPlanner.winningPlan, "SORT")); +assert(planHasStage(db, getWinningPlan(explain.queryPlanner), "SORT")); explain = t.find().sort({b: -1}).explain(); assert.commandWorked(explain); -assert(planHasStage(db, explain.queryPlanner.winningPlan, "SORT")); +assert(planHasStage(db, getWinningPlan(explain.queryPlanner), "SORT")); // .hint() explain = t.explain().find().hint({a: 1}).finish(); assert.commandWorked(explain); -assert(isIxscan(db, explain.queryPlanner.winningPlan)); +assert(isIxscan(db, getWinningPlan(explain.queryPlanner))); explain = t.explain().find().hint("a_1").finish(); assert.commandWorked(explain); -assert(isIxscan(db, explain.queryPlanner.winningPlan)); +assert(isIxscan(db, getWinningPlan(explain.queryPlanner))); explain = t.find().hint({a: 1}).explain(); assert.commandWorked(explain); -assert(isIxscan(db, explain.queryPlanner.winningPlan)); +assert(isIxscan(db, getWinningPlan(explain.queryPlanner))); explain = t.find().hint("a_1").explain(); assert.commandWorked(explain); -assert(isIxscan(db, explain.queryPlanner.winningPlan)); +assert(isIxscan(db, getWinningPlan(explain.queryPlanner))); // .min() explain = t.explain().find().min({a: 1}).hint({a: 1}).finish(); assert.commandWorked(explain); -assert(isIxscan(db, explain.queryPlanner.winningPlan)); +assert(isIxscan(db, getWinningPlan(explain.queryPlanner))); explain = t.find().min({a: 1}).hint({a: 1}).explain(); assert.commandWorked(explain); -assert(isIxscan(db, explain.queryPlanner.winningPlan)); +assert(isIxscan(db, getWinningPlan(explain.queryPlanner))); // .max() explain = t.explain().find().max({a: 1}).hint({a: 1}).finish(); assert.commandWorked(explain); -assert(isIxscan(db, explain.queryPlanner.winningPlan)); +assert(isIxscan(db, getWinningPlan(explain.queryPlanner))); explain = t.find().max({a: 1}).hint({a: 1}).explain(); assert.commandWorked(explain); -assert(isIxscan(db, explain.queryPlanner.winningPlan)); +assert(isIxscan(db, getWinningPlan(explain.queryPlanner))); // .allowDiskUse() explain = t.explain().find().allowDiskUse().finish(); @@ -243,7 +242,7 @@ assert("queryPlanner" in explain.stages[0].$cursor); // Basic count. explain = t.explain().count(); assert.commandWorked(explain); -assert(planHasStage(db, explain.queryPlanner.winningPlan, "RECORD_STORE_FAST_COUNT")); +assert(planHasStage(db, getWinningPlan(explain.queryPlanner), "RECORD_STORE_FAST_COUNT")); // Tests for applySkipLimit argument to .count. When we don't apply the skip, we // count one result. When we do apply the skip we count zero. @@ -263,15 +262,15 @@ assert.eq(0, stage.nCounted); // Count with hint. explain = t.explain().find({a: 3}).hint({a: 1}).count(); assert.commandWorked(explain); -assert(planHasStage(db, explain.queryPlanner.winningPlan, "COUNT")); -assert(planHasStage(db, explain.queryPlanner.winningPlan, "COUNT_SCAN")); +assert(planHasStage(db, getWinningPlan(explain.queryPlanner), "COUNT")); +assert(planHasStage(db, getWinningPlan(explain.queryPlanner), "COUNT_SCAN")); // Explainable count with hint. assert.commandWorked(t.createIndex({c: 1}, {sparse: true})); explain = t.explain().count({c: {$exists: false}}, {hint: "c_1"}); assert.commandWorked(explain); -assert(planHasStage(db, explain.queryPlanner.winningPlan, "IXSCAN")); -assert.eq(getPlanStage(explain.queryPlanner.winningPlan, "IXSCAN").indexName, "c_1"); +assert(planHasStage(db, getWinningPlan(explain.queryPlanner), "IXSCAN")); +assert.eq(getPlanStage(getWinningPlan(explain.queryPlanner), "IXSCAN").indexName, "c_1"); assert.commandWorked(t.dropIndex({c: 1})); // @@ -280,17 +279,17 @@ assert.commandWorked(t.dropIndex({c: 1})); explain = t.explain().distinct('_id'); assert.commandWorked(explain); -assert(planHasStage(db, explain.queryPlanner.winningPlan, "PROJECTION_COVERED")); -assert(planHasStage(db, explain.queryPlanner.winningPlan, "DISTINCT_SCAN")); +assert(planHasStage(db, getWinningPlan(explain.queryPlanner), "PROJECTION_COVERED")); +assert(planHasStage(db, getWinningPlan(explain.queryPlanner), "DISTINCT_SCAN")); explain = t.explain().distinct('a'); assert.commandWorked(explain); -assert(planHasStage(db, explain.queryPlanner.winningPlan, "PROJECTION_COVERED")); -assert(planHasStage(db, explain.queryPlanner.winningPlan, "DISTINCT_SCAN")); +assert(planHasStage(db, getWinningPlan(explain.queryPlanner), "PROJECTION_COVERED")); +assert(planHasStage(db, getWinningPlan(explain.queryPlanner), "DISTINCT_SCAN")); explain = t.explain().distinct('b'); assert.commandWorked(explain); -assert(planHasStage(db, explain.queryPlanner.winningPlan, "COLLSCAN")); +assert(planHasStage(db, getWinningPlan(explain.queryPlanner), "COLLSCAN")); // // .remove() diff --git a/jstests/core/explain_sort_type.js b/jstests/core/explain_sort_type.js index 239b08bb566..df4d91c0bbf 100644 --- a/jstests/core/explain_sort_type.js +++ b/jstests/core/explain_sort_type.js @@ -8,7 +8,6 @@ * assumes_unsharded_collection, * # This test uses a non-retryable multi-update command. * requires_non_retryable_writes, - * sbe_incompatible, * ] */ (function() { @@ -41,7 +40,8 @@ assert.eq( ], coll.find().sort({b: 1, a: 1}).toArray()); explain = coll.find().sort({b: 1, a: 1}).explain(); -sortStage = getPlanStage(explain.queryPlanner.winningPlan, "SORT"); +let winningPlan = getWinningPlan(explain.queryPlanner); +sortStage = getPlanStage(winningPlan, "SORT"); assert.neq(null, sortStage, explain); assert.eq("simple", sortStage.type, explain); @@ -57,7 +57,8 @@ assert.eq( ], coll.find({}, {key: {$meta: "sortKey"}}).sort({b: 1, a: 1}).toArray()); explain = coll.find({}, {key: {$meta: "sortKey"}}).sort({b: 1, a: 1}).explain(); -sortStage = getPlanStage(explain.queryPlanner.winningPlan, "SORT"); +winningPlan = getWinningPlan(explain.queryPlanner); +sortStage = getPlanStage(winningPlan, "SORT"); assert.neq(null, sortStage, explain); assert.eq("simple", sortStage.type, explain); @@ -67,9 +68,10 @@ assert.eq([{a: 1, b: 1}, {a: 2, b: 1}, {a: 1, b: 2}, {a: 2, b: 2}, {a: 1, b: 3}, coll.find({a: {$gt: 0}}, {_id: 0, a: 1, b: 1}).sort({b: 1, a: 1}).toArray()); explain = coll.find({a: {$gt: 0}}, {_id: 0, a: 1, b: 1}).sort({b: 1, a: 1}).explain(); // Verify that the plan involves an IXSCAN but no fetch. -assert.neq(null, getPlanStage(explain.queryPlanner.winningPlan, "IXSCAN"), explain); -assert.eq(null, getPlanStage(explain.queryPlanner.winningPlan, "FETCH"), explain); -sortStage = getPlanStage(explain.queryPlanner.winningPlan, "SORT"); +winningPlan = getWinningPlan(explain.queryPlanner); +assert.neq(null, getPlanStage(winningPlan, "IXSCAN"), explain); +assert.eq(null, getPlanStage(winningPlan, "FETCH"), explain); +sortStage = getPlanStage(winningPlan, "SORT"); assert.neq(null, sortStage, explain); assert.eq("default", sortStage.type, explain); @@ -94,7 +96,8 @@ explain = coll.find({$text: {$search: "keyword"}}, {_id: 0, a: 1, b: 1, score: {$meta: "textScore"}}) .sort({b: 1, a: 1}) .explain(); -sortStage = getPlanStage(explain.queryPlanner.winningPlan, "SORT"); +winningPlan = getWinningPlan(explain.queryPlanner); +sortStage = getPlanStage(winningPlan, "SORT"); assert.neq(null, sortStage, explain); assert.eq("default", sortStage.type, explain); }()); diff --git a/jstests/core/explode_for_sort_fetch.js b/jstests/core/explode_for_sort_fetch.js index 798ff0e2996..e968eb9853a 100644 --- a/jstests/core/explode_for_sort_fetch.js +++ b/jstests/core/explode_for_sort_fetch.js @@ -121,4 +121,4 @@ const testCases = [ }, ]; testCases.forEach(executeQueryTestCase); -}());
\ No newline at end of file +}()); diff --git a/jstests/core/expr_or_pushdown.js b/jstests/core/expr_or_pushdown.js index 5c09bb63efd..e2605e08c91 100644 --- a/jstests/core/expr_or_pushdown.js +++ b/jstests/core/expr_or_pushdown.js @@ -1,9 +1,6 @@ /** * Test that an $expr predicated which is eligible for being indexed with an $or pushdown executes * as expected. - * @tags: [ - * sbe_incompatible, - * ] */ (function() { "use strict"; diff --git a/jstests/core/fts1.js b/jstests/core/fts1.js index 0bcd46b3f04..496420c4c60 100644 --- a/jstests/core/fts1.js +++ b/jstests/core/fts1.js @@ -2,7 +2,6 @@ // collection. // @tags: [ // assumes_no_implicit_index_creation, -// sbe_incompatible, // ] (function() { "use strict"; diff --git a/jstests/core/fts2.js b/jstests/core/fts2.js index 7629d313b00..79be057fed8 100644 --- a/jstests/core/fts2.js +++ b/jstests/core/fts2.js @@ -1,9 +1,3 @@ - -/** - * @tags: [ - * sbe_incompatible, - * ] - */ load("jstests/libs/fts.js"); t = db.text2; diff --git a/jstests/core/fts3.js b/jstests/core/fts3.js index 32aa3fb002a..9b89cda029c 100644 --- a/jstests/core/fts3.js +++ b/jstests/core/fts3.js @@ -1,9 +1,3 @@ - -/** - * @tags: [ - * sbe_incompatible, - * ] - */ load("jstests/libs/fts.js"); t = db.text3; diff --git a/jstests/core/fts4.js b/jstests/core/fts4.js index ea8055eeb11..bb19fba2221 100644 --- a/jstests/core/fts4.js +++ b/jstests/core/fts4.js @@ -1,9 +1,3 @@ - -/** - * @tags: [ - * sbe_incompatible, - * ] - */ load("jstests/libs/fts.js"); t = db.text4; diff --git a/jstests/core/fts5.js b/jstests/core/fts5.js index aa689a46ed9..28d9b48d957 100644 --- a/jstests/core/fts5.js +++ b/jstests/core/fts5.js @@ -1,9 +1,3 @@ - -/** - * @tags: [ - * sbe_incompatible, - * ] - */ load("jstests/libs/fts.js"); t = db.text5; diff --git a/jstests/core/fts_blog.js b/jstests/core/fts_blog.js index 2b0fe26e095..5208c166258 100644 --- a/jstests/core/fts_blog.js +++ b/jstests/core/fts_blog.js @@ -7,9 +7,6 @@ t.save({_id: 3, title: "knives are Fun", text: "this is a new blog i am writing. // default weight is 1 // specify weights if you want a field to be more meaningull -// @tags: [ -// sbe_incompatible, -// ] t.createIndex({"title": "text", text: "text"}, {weights: {title: 10}}); res = t.find({"$text": {"$search": "blog"}}, {score: {"$meta": "textScore"}}).sort({ diff --git a/jstests/core/fts_blogwild.js b/jstests/core/fts_blogwild.js index 881c486edad..29a2508bf07 100644 --- a/jstests/core/fts_blogwild.js +++ b/jstests/core/fts_blogwild.js @@ -2,7 +2,6 @@ // collection. // @tags: [ // assumes_no_implicit_index_creation, -// sbe_incompatible, // ] t = db.text_blogwild; diff --git a/jstests/core/fts_casesensitive.js b/jstests/core/fts_casesensitive.js index b4a730a46b5..411ffade50d 100644 --- a/jstests/core/fts_casesensitive.js +++ b/jstests/core/fts_casesensitive.js @@ -1,7 +1,4 @@ // Integration tests for {$caseSensitive: true} option to $text query operator. -// @tags: [ -// sbe_incompatible, -// ] load('jstests/libs/fts.js'); var coll = db.fts_casesensitive; diff --git a/jstests/core/fts_diacritic_and_caseinsensitive.js b/jstests/core/fts_diacritic_and_caseinsensitive.js index 1b8a2d0d1e0..22ad5fb724c 100644 --- a/jstests/core/fts_diacritic_and_caseinsensitive.js +++ b/jstests/core/fts_diacritic_and_caseinsensitive.js @@ -1,7 +1,4 @@ // Integration tests for no case or diacritic options to $text query operator. -// @tags: [ -// sbe_incompatible, -// ] load('jstests/libs/fts.js'); diff --git a/jstests/core/fts_diacritic_and_casesensitive.js b/jstests/core/fts_diacritic_and_casesensitive.js index 124ec9c092d..ba11781b8fd 100644 --- a/jstests/core/fts_diacritic_and_casesensitive.js +++ b/jstests/core/fts_diacritic_and_casesensitive.js @@ -1,8 +1,5 @@ // Integration tests for {$diacriticSensitive: true, $caseSensitive: true} option to $text query // operator. -// @tags: [ -// sbe_incompatible, -// ] load('jstests/libs/fts.js'); @@ -54,4 +51,4 @@ assert.eq([], "\"próximo Vôo\" -\"único Médico\"", null, {$diacriticSensitive: true, $caseSensitive: true})); -})();
\ No newline at end of file +})(); diff --git a/jstests/core/fts_diacriticsensitive.js b/jstests/core/fts_diacriticsensitive.js index 2396860e0db..23bc79df168 100644 --- a/jstests/core/fts_diacriticsensitive.js +++ b/jstests/core/fts_diacriticsensitive.js @@ -1,7 +1,4 @@ // Integration tests for {$diacriticSensitive: true} option to $text query operator. -// @tags: [ -// sbe_incompatible, -// ] load('jstests/libs/fts.js'); diff --git a/jstests/core/fts_explain.js b/jstests/core/fts_explain.js index 9b87cedcc51..8e18393d15a 100644 --- a/jstests/core/fts_explain.js +++ b/jstests/core/fts_explain.js @@ -2,7 +2,6 @@ // collection. // @tags: [ // assumes_no_implicit_index_creation, -// sbe_incompatible, // ] // Test $text explain. SERVER-12037. diff --git a/jstests/core/fts_index_version2.js b/jstests/core/fts_index_version2.js index 1e579ba12cb..c55b15aacd0 100644 --- a/jstests/core/fts_index_version2.js +++ b/jstests/core/fts_index_version2.js @@ -1,7 +1,4 @@ // Integration tests for version 2 text index, ensuring that it maintains old behavior. -// @tags: [ -// sbe_incompatible, -// ] load('jstests/libs/fts.js'); diff --git a/jstests/core/fts_index_wildcard_and_weight.js b/jstests/core/fts_index_wildcard_and_weight.js index 72631070ff3..0004eb2f48a 100644 --- a/jstests/core/fts_index_wildcard_and_weight.js +++ b/jstests/core/fts_index_wildcard_and_weight.js @@ -1,9 +1,5 @@ // Test that on a text index that matches all fields does not use a weight from a named field. // This test was designed to reproduce SERVER-45363. -// -// @tags: [ -// sbe_incompatible, -// ] (function() { "use strict"; var coll = db.getCollection(jsTestName()); diff --git a/jstests/core/fts_partition1.js b/jstests/core/fts_partition1.js index efc148da675..ec569a4a355 100644 --- a/jstests/core/fts_partition1.js +++ b/jstests/core/fts_partition1.js @@ -1,8 +1,3 @@ -/** - * @tags: [ - * sbe_incompatible, - * ] - */ load("jstests/libs/fts.js"); t = db.text_parition1; diff --git a/jstests/core/fts_phrase.js b/jstests/core/fts_phrase.js index dfe9d3692af..1a3d7470326 100644 --- a/jstests/core/fts_phrase.js +++ b/jstests/core/fts_phrase.js @@ -1,9 +1,3 @@ - -/** - * @tags: [ - * sbe_incompatible, - * ] - */ t = db.text_phrase; t.drop(); diff --git a/jstests/core/fts_projection.js b/jstests/core/fts_projection.js index ee355f988b2..3d08cb953f0 100644 --- a/jstests/core/fts_projection.js +++ b/jstests/core/fts_projection.js @@ -1,7 +1,4 @@ // Test $text with $textScore projection. -// @tags: [ -// sbe_incompatible, -// ] (function() { "use strict"; diff --git a/jstests/core/fts_score_sort.js b/jstests/core/fts_score_sort.js index 97d5daf7f0a..b9103ad0c6b 100644 --- a/jstests/core/fts_score_sort.js +++ b/jstests/core/fts_score_sort.js @@ -1,7 +1,4 @@ // Test sorting with text score metadata. -// @tags: [ -// sbe_incompatible, -// ] (function() { "use strict"; diff --git a/jstests/core/fts_spanish.js b/jstests/core/fts_spanish.js index b2371e79959..988b55cbb80 100644 --- a/jstests/core/fts_spanish.js +++ b/jstests/core/fts_spanish.js @@ -1,8 +1,3 @@ -/** - * @tags: [ - * sbe_incompatible, - * ] - */ (function() { "use strict"; diff --git a/jstests/core/function_string_representations.js b/jstests/core/function_string_representations.js index 5f722d6bd4a..9d79bb9c8d4 100644 --- a/jstests/core/function_string_representations.js +++ b/jstests/core/function_string_representations.js @@ -1,6 +1,5 @@ // @tags: [ // does_not_support_stepdowns, -// sbe_incompatible, // uses_map_reduce_with_temp_collections, // ] diff --git a/jstests/core/geo10.js b/jstests/core/geo10.js index b330ce52911..45463711406 100644 --- a/jstests/core/geo10.js +++ b/jstests/core/geo10.js @@ -2,7 +2,6 @@ // collection. // @tags: [ // assumes_no_implicit_index_creation, -// sbe_incompatible, // ] // Test for SERVER-2746 diff --git a/jstests/core/geo2.js b/jstests/core/geo2.js index b0552e2f773..34588acac9e 100644 --- a/jstests/core/geo2.js +++ b/jstests/core/geo2.js @@ -1,7 +1,6 @@ // @tags: [ // operations_longer_than_stepdown_interval_in_txns, // requires_fastcount, -// sbe_incompatible, // ] t = db.geo2; diff --git a/jstests/core/geo3.js b/jstests/core/geo3.js index 40a3d9a5e75..7e54fd7dc5f 100644 --- a/jstests/core/geo3.js +++ b/jstests/core/geo3.js @@ -1,7 +1,6 @@ // @tags: [ // operations_longer_than_stepdown_interval_in_txns, // requires_fastcount, -// sbe_incompatible, // ] (function() { diff --git a/jstests/core/geo6.js b/jstests/core/geo6.js index 0ee06508ea2..8d32c066c88 100644 --- a/jstests/core/geo6.js +++ b/jstests/core/geo6.js @@ -1,8 +1,3 @@ -/** - * @tags: [ - * sbe_incompatible, - * ] - */ t = db.geo6; t.drop(); diff --git a/jstests/core/geo9.js b/jstests/core/geo9.js index 4204c842987..6b1bfb60631 100644 --- a/jstests/core/geo9.js +++ b/jstests/core/geo9.js @@ -1,8 +1,3 @@ -/** - * @tags: [ - * sbe_incompatible, - * ] - */ t = db.geo9; t.drop(); diff --git a/jstests/core/geo_2d_explain.js b/jstests/core/geo_2d_explain.js index 109c5618795..36adad19a6c 100644 --- a/jstests/core/geo_2d_explain.js +++ b/jstests/core/geo_2d_explain.js @@ -1,6 +1,5 @@ // @tags: [ // assumes_balancer_off, -// sbe_incompatible, // ] var t = db.geo_2d_explain; diff --git a/jstests/core/geo_2d_trailing_fields.js b/jstests/core/geo_2d_trailing_fields.js index 238c2caefaa..aa66832281d 100644 --- a/jstests/core/geo_2d_trailing_fields.js +++ b/jstests/core/geo_2d_trailing_fields.js @@ -1,7 +1,4 @@ // Tests for predicates which can use the trailing field of a 2d index. -// @tags: [ -// sbe_incompatible, -// ] (function() { "use strict"; diff --git a/jstests/core/geo_allowedcomparisons.js b/jstests/core/geo_allowedcomparisons.js index 01795941533..2f689f4be68 100644 --- a/jstests/core/geo_allowedcomparisons.js +++ b/jstests/core/geo_allowedcomparisons.js @@ -1,7 +1,4 @@ // A test for what geometries can interact with what other geometries. -// @tags: [ -// sbe_incompatible, -// ] t = db.geo_allowedcomparisons; // Any GeoJSON object can intersect with any geojson object. diff --git a/jstests/core/geo_array0.js b/jstests/core/geo_array0.js index 8a4e81283f8..0c9dc096afb 100644 --- a/jstests/core/geo_array0.js +++ b/jstests/core/geo_array0.js @@ -2,7 +2,6 @@ // collection. // @tags: [ // assumes_no_implicit_index_creation, -// sbe_incompatible, // ] // Make sure the very basics of geo arrays are sane by creating a few multi location docs diff --git a/jstests/core/geo_array2.js b/jstests/core/geo_array2.js index 2a7a1303e0c..7da56a576eb 100644 --- a/jstests/core/geo_array2.js +++ b/jstests/core/geo_array2.js @@ -1,7 +1,4 @@ // Check the semantics of near calls with multiple locations -// @tags: [ -// sbe_incompatible, -// ] t = db.geoarray2; t.drop(); diff --git a/jstests/core/geo_big_polygon2.js b/jstests/core/geo_big_polygon2.js index 53e0631e791..e0b119c7847 100644 --- a/jstests/core/geo_big_polygon2.js +++ b/jstests/core/geo_big_polygon2.js @@ -1,7 +1,6 @@ // @tags: [ // requires_fastcount, // requires_non_retryable_writes, -// sbe_incompatible, // ] // diff --git a/jstests/core/geo_big_polygon3.js b/jstests/core/geo_big_polygon3.js index cd4591dd66a..8877c73fb3a 100644 --- a/jstests/core/geo_big_polygon3.js +++ b/jstests/core/geo_big_polygon3.js @@ -2,7 +2,6 @@ // does_not_support_stepdowns, // requires_fastcount, // requires_non_retryable_writes, -// sbe_incompatible, // ] // diff --git a/jstests/core/geo_borders.js b/jstests/core/geo_borders.js index 01989a445bc..e9bc9ab70ab 100644 --- a/jstests/core/geo_borders.js +++ b/jstests/core/geo_borders.js @@ -4,9 +4,6 @@ t.drop(); epsilon = 0.0001; // For these tests, *required* that step ends exactly on max -// @tags: [ -// sbe_incompatible, -// ] min = -1; max = 1; step = 1; diff --git a/jstests/core/geo_box1.js b/jstests/core/geo_box1.js index 28fe85c83cf..d0c4ff50bdf 100644 --- a/jstests/core/geo_box1.js +++ b/jstests/core/geo_box1.js @@ -1,6 +1,5 @@ // @tags: [ // requires_getmore, -// sbe_incompatible, // ] t = db.geo_box1; diff --git a/jstests/core/geo_box1_noindex.js b/jstests/core/geo_box1_noindex.js index 4c813d17fa0..879f17e3002 100644 --- a/jstests/core/geo_box1_noindex.js +++ b/jstests/core/geo_box1_noindex.js @@ -1,6 +1,5 @@ // @tags: [ // requires_getmore, -// sbe_incompatible, // ] // SERVER-7343: allow $within without a geo index. diff --git a/jstests/core/geo_box2.js b/jstests/core/geo_box2.js index e4e51ec9e10..7120cfd3e4a 100644 --- a/jstests/core/geo_box2.js +++ b/jstests/core/geo_box2.js @@ -1,9 +1,3 @@ - -/** - * @tags: [ - * sbe_incompatible, - * ] - */ t = db.geo_box2; t.drop(); diff --git a/jstests/core/geo_center_sphere1.js b/jstests/core/geo_center_sphere1.js index cbef0b4302d..6b77e099b56 100644 --- a/jstests/core/geo_center_sphere1.js +++ b/jstests/core/geo_center_sphere1.js @@ -1,7 +1,6 @@ // @tags: [ // assumes_balancer_off, // requires_fastcount, -// sbe_incompatible, // ] t = db.geo_center_sphere1; diff --git a/jstests/core/geo_center_sphere2.js b/jstests/core/geo_center_sphere2.js index 2b5e8be5cab..1c59850d841 100644 --- a/jstests/core/geo_center_sphere2.js +++ b/jstests/core/geo_center_sphere2.js @@ -1,6 +1,5 @@ // @tags: [ // requires_getmore, -// sbe_incompatible, // ] // diff --git a/jstests/core/geo_circle1.js b/jstests/core/geo_circle1.js index 0df085bcb4d..bd0bbc11563 100644 --- a/jstests/core/geo_circle1.js +++ b/jstests/core/geo_circle1.js @@ -1,7 +1,6 @@ // @tags: [ // assumes_balancer_off, // requires_fastcount, -// sbe_incompatible, // ] t = db.geo_circle1; diff --git a/jstests/core/geo_circle1_noindex.js b/jstests/core/geo_circle1_noindex.js index cafa251cb4a..6c3135855a5 100644 --- a/jstests/core/geo_circle1_noindex.js +++ b/jstests/core/geo_circle1_noindex.js @@ -1,7 +1,4 @@ // SERVER-7343: allow $within without a geo index. -// @tags: [ -// sbe_incompatible, -// ] t = db.geo_circle1_noindex; t.drop(); diff --git a/jstests/core/geo_circle2.js b/jstests/core/geo_circle2.js index 6be02377259..d7947f96502 100644 --- a/jstests/core/geo_circle2.js +++ b/jstests/core/geo_circle2.js @@ -1,9 +1,3 @@ - -/** - * @tags: [ - * sbe_incompatible, - * ] - */ t = db.geo_circle2; t.drop(); diff --git a/jstests/core/geo_circle3.js b/jstests/core/geo_circle3.js index e931e96783d..da7a9af6b34 100644 --- a/jstests/core/geo_circle3.js +++ b/jstests/core/geo_circle3.js @@ -1,7 +1,4 @@ // SERVER-848 and SERVER-1191. -// @tags: [ -// sbe_incompatible, -// ] db.places.drop(); n = 0; diff --git a/jstests/core/geo_circle4.js b/jstests/core/geo_circle4.js index 04ce685db38..c2194142795 100644 --- a/jstests/core/geo_circle4.js +++ b/jstests/core/geo_circle4.js @@ -1,7 +1,4 @@ // Reported as server-848. -// @tags: [ -// sbe_incompatible, -// ] function test(index) { db.server848.drop(); diff --git a/jstests/core/geo_distinct.js b/jstests/core/geo_distinct.js index 9dce21e9368..f4c9eca312f 100644 --- a/jstests/core/geo_distinct.js +++ b/jstests/core/geo_distinct.js @@ -4,7 +4,6 @@ // // @tags: [ // requires_fastcount, -// sbe_incompatible, // ] (function() { diff --git a/jstests/core/geo_exactfetch.js b/jstests/core/geo_exactfetch.js index 93b0b7afcda..43ef46fb558 100644 --- a/jstests/core/geo_exactfetch.js +++ b/jstests/core/geo_exactfetch.js @@ -1,7 +1,4 @@ // SERVER-7322 -// @tags: [ -// sbe_incompatible, -// ] t = db.geo_exactfetch; t.drop(); diff --git a/jstests/core/geo_max.js b/jstests/core/geo_max.js index d77d2ad8513..03771ea34d4 100644 --- a/jstests/core/geo_max.js +++ b/jstests/core/geo_max.js @@ -1,9 +1,6 @@ // Test where points are on _max (180) // Using GeoNearRandom because this test needs a lot of points in the index. // If there aren't enough points the test passes even if the code is broken. -// @tags: [ -// sbe_incompatible, -// ] load("jstests/libs/geo_near_random.js"); var test = new GeoNearRandomTest("geo_near_max"); diff --git a/jstests/core/geo_mindistance.js b/jstests/core/geo_mindistance.js index 8994892c77d..35ce8065ae4 100644 --- a/jstests/core/geo_mindistance.js +++ b/jstests/core/geo_mindistance.js @@ -2,7 +2,6 @@ // @tags: [ // requires_fastcount, // requires_getmore, -// sbe_incompatible, // ] (function() { diff --git a/jstests/core/geo_mindistance_boundaries.js b/jstests/core/geo_mindistance_boundaries.js index 7024cfa2ec9..0d46d60780d 100644 --- a/jstests/core/geo_mindistance_boundaries.js +++ b/jstests/core/geo_mindistance_boundaries.js @@ -1,8 +1,5 @@ /**Test boundary conditions for $minDistance option for $near and $nearSphere * queries. SERVER-9395. - * @tags: [ - * sbe_incompatible, - * ] */ var t = db.geo_mindistance_boundaries; t.drop(); diff --git a/jstests/core/geo_multinest0.js b/jstests/core/geo_multinest0.js index b76c18dbd5c..746a530e19b 100644 --- a/jstests/core/geo_multinest0.js +++ b/jstests/core/geo_multinest0.js @@ -2,7 +2,6 @@ // collection. // @tags: [ // assumes_no_implicit_index_creation, -// sbe_incompatible, // ] // Make sure nesting of location arrays also works. diff --git a/jstests/core/geo_multinest1.js b/jstests/core/geo_multinest1.js index a3fb424829e..b6aa53cae16 100644 --- a/jstests/core/geo_multinest1.js +++ b/jstests/core/geo_multinest1.js @@ -2,7 +2,6 @@ // collection. // @tags: [ // assumes_no_implicit_index_creation, -// sbe_incompatible, // ] // Test distance queries with interleaved distances diff --git a/jstests/core/geo_near_random1.js b/jstests/core/geo_near_random1.js index 52dc1e34cbb..1573e72c1f8 100644 --- a/jstests/core/geo_near_random1.js +++ b/jstests/core/geo_near_random1.js @@ -1,7 +1,4 @@ // this tests all points -// @tags: [ -// sbe_incompatible, -// ] load("jstests/libs/geo_near_random.js"); var test = new GeoNearRandomTest("geo_near_random1"); @@ -39,4 +36,4 @@ test.testPt([0, 0], opts); test.testPt(test.mkPt(), opts); test.testPt(test.mkPt(), opts); test.testPt(test.mkPt(), opts); -test.testPt(test.mkPt(), opts);
\ No newline at end of file +test.testPt(test.mkPt(), opts); diff --git a/jstests/core/geo_near_random2.js b/jstests/core/geo_near_random2.js index 4ffa95cffae..950c74904d3 100644 --- a/jstests/core/geo_near_random2.js +++ b/jstests/core/geo_near_random2.js @@ -1,7 +1,4 @@ // this tests 1% of all points -// @tags: [ -// sbe_incompatible, -// ] load("jstests/libs/geo_near_random.js"); var test = new GeoNearRandomTest("geo_near_random2"); @@ -43,4 +40,4 @@ test.testPt([0, 0], opts); test.testPt(test.mkPt(0.8), opts); test.testPt(test.mkPt(0.8), opts); test.testPt(test.mkPt(0.8), opts); -test.testPt(test.mkPt(0.8), opts);
\ No newline at end of file +test.testPt(test.mkPt(0.8), opts); diff --git a/jstests/core/geo_nearwithin.js b/jstests/core/geo_nearwithin.js index 6ded21dbd83..78f66dc6181 100644 --- a/jstests/core/geo_nearwithin.js +++ b/jstests/core/geo_nearwithin.js @@ -1,7 +1,4 @@ // Test $near + $within. -// @tags: [ -// sbe_incompatible, -// ] (function() { t = db.geo_nearwithin; t.drop(); diff --git a/jstests/core/geo_operator_crs.js b/jstests/core/geo_operator_crs.js index 6118c4efcc7..2f22e501a41 100644 --- a/jstests/core/geo_operator_crs.js +++ b/jstests/core/geo_operator_crs.js @@ -1,6 +1,5 @@ // @tags: [ // requires_non_retryable_writes, -// sbe_incompatible, // ] // diff --git a/jstests/core/geo_or.js b/jstests/core/geo_or.js index d571e3ad6e3..cee91d4929d 100644 --- a/jstests/core/geo_or.js +++ b/jstests/core/geo_or.js @@ -1,7 +1,4 @@ // multiple geo clauses with $or -// @tags: [ -// sbe_incompatible, -// ] t = db.geoor; diff --git a/jstests/core/geo_poly_edge.js b/jstests/core/geo_poly_edge.js index eee43bfc55c..8608af36615 100644 --- a/jstests/core/geo_poly_edge.js +++ b/jstests/core/geo_poly_edge.js @@ -1,9 +1,6 @@ // // Tests polygon edge cases // -// @tags: [ -// sbe_incompatible, -// ] var coll = db.getCollection('jstests_geo_poly_edge'); coll.drop(); diff --git a/jstests/core/geo_poly_line.js b/jstests/core/geo_poly_line.js index 49e394d140e..85dc9274158 100644 --- a/jstests/core/geo_poly_line.js +++ b/jstests/core/geo_poly_line.js @@ -1,7 +1,4 @@ // Test that weird polygons work SERVER-3725 -// @tags: [ -// sbe_incompatible, -// ] t = db.geo_polygon5; t.drop(); diff --git a/jstests/core/geo_polygon3.js b/jstests/core/geo_polygon3.js index 2fb259332aa..fe62bee1f14 100644 --- a/jstests/core/geo_polygon3.js +++ b/jstests/core/geo_polygon3.js @@ -1,9 +1,6 @@ // // Tests for polygon querying with varying levels of accuracy // -// @tags: [ -// sbe_incompatible, -// ] (function() { "use strict"; diff --git a/jstests/core/geo_queryoptimizer.js b/jstests/core/geo_queryoptimizer.js index 17b3c5997f2..199cedf5330 100644 --- a/jstests/core/geo_queryoptimizer.js +++ b/jstests/core/geo_queryoptimizer.js @@ -1,8 +1,3 @@ -/** - * @tags: [ - * sbe_incompatible, - * ] - */ t = db.geo_qo1; t.drop(); diff --git a/jstests/core/geo_s2cursorlimitskip.js b/jstests/core/geo_s2cursorlimitskip.js index 3413314fd27..8933af99499 100644 --- a/jstests/core/geo_s2cursorlimitskip.js +++ b/jstests/core/geo_s2cursorlimitskip.js @@ -9,7 +9,6 @@ // requires_capped, // requires_getmore, // requires_profiling, -// sbe_incompatible, // ] var testDB = db.getSiblingDB("geo_s2cursorlimitskip"); diff --git a/jstests/core/geo_s2dedupnear.js b/jstests/core/geo_s2dedupnear.js index 0619d307bfa..ad1674f1e6e 100644 --- a/jstests/core/geo_s2dedupnear.js +++ b/jstests/core/geo_s2dedupnear.js @@ -1,8 +1,5 @@ // Make sure that we don't return several of the same result due to faulty // assumptions about the btree cursor. That is, don't return duplicate results. -// @tags: [ -// sbe_incompatible, -// ] t = db.geo_s2dedupnear; t.drop(); diff --git a/jstests/core/geo_s2descindex.js b/jstests/core/geo_s2descindex.js index c4ebb435a55..d5360aa7fb7 100644 --- a/jstests/core/geo_s2descindex.js +++ b/jstests/core/geo_s2descindex.js @@ -1,6 +1,5 @@ // @tags: [ // requires_non_retryable_writes, -// sbe_incompatible, // ] // diff --git a/jstests/core/geo_s2dupe_points.js b/jstests/core/geo_s2dupe_points.js index 18550b0bbbb..9f94f69caaa 100644 --- a/jstests/core/geo_s2dupe_points.js +++ b/jstests/core/geo_s2dupe_points.js @@ -2,9 +2,6 @@ // s2 rejects shapes with duplicate adjacent points as invalid, but they are // valid in GeoJSON. We store the duplicates, but internally remove them // before indexing or querying. -// @tags: [ -// sbe_incompatible, -// ] t = db.geo_s2dupe_points; t.drop(); t.createIndex({geo: "2dsphere"}); diff --git a/jstests/core/geo_s2explain.js b/jstests/core/geo_s2explain.js index 9ae76163485..ca51dd32920 100644 --- a/jstests/core/geo_s2explain.js +++ b/jstests/core/geo_s2explain.js @@ -1,8 +1,5 @@ // Test to check whether the number of intervals in a geoNear query equals // the number of inputStages it completes -// @tags: [ -// sbe_incompatible, -// ] var t = db.jstests_geo_s2explain; t.drop(); diff --git a/jstests/core/geo_s2index.js b/jstests/core/geo_s2index.js index 2afd3053cea..e110cb1ce04 100644 --- a/jstests/core/geo_s2index.js +++ b/jstests/core/geo_s2index.js @@ -2,9 +2,6 @@ t = db.geo_s2index; t.drop(); // We internally drop adjacent duplicate points in lines. -// @tags: [ -// sbe_incompatible, -// ] someline = { "type": "LineString", "coordinates": [[40, 5], [40, 5], [40, 5], [41, 6], [41, 6]] diff --git a/jstests/core/geo_s2intersection.js b/jstests/core/geo_s2intersection.js index 50f26a6aa83..3c841d85f50 100644 --- a/jstests/core/geo_s2intersection.js +++ b/jstests/core/geo_s2intersection.js @@ -4,9 +4,6 @@ t.createIndex({geo: "2dsphere"}); /**All the tests in this file are generally confirming intersections based upon * these three geo objects. - * @tags: [ - * sbe_incompatible, - * ] */ var canonLine = { name: 'canonLine', diff --git a/jstests/core/geo_s2largewithin.js b/jstests/core/geo_s2largewithin.js index 156b711bdff..e1eed8a2e6a 100644 --- a/jstests/core/geo_s2largewithin.js +++ b/jstests/core/geo_s2largewithin.js @@ -1,8 +1,5 @@ // If our $within is enormous, create a coarse covering for the search so it // doesn't take forever. -// @tags: [ -// sbe_incompatible, -// ] t = db.geo_s2largewithin; t.drop(); t.createIndex({geo: "2dsphere"}); diff --git a/jstests/core/geo_s2meridian.js b/jstests/core/geo_s2meridian.js index 5842000e998..99eb0c63dc4 100644 --- a/jstests/core/geo_s2meridian.js +++ b/jstests/core/geo_s2meridian.js @@ -6,9 +6,6 @@ t.createIndex({geo: "2dsphere"}); * Test 1: check that intersection works on the meridian. We insert a line * that crosses the meridian, and then run a geoIntersect with a line * that runs along the meridian. - * @tags: [ - * sbe_incompatible, - * ] */ meridianCrossingLine = { diff --git a/jstests/core/geo_s2multi.js b/jstests/core/geo_s2multi.js index 9f4208d51aa..858dfd1efa1 100644 --- a/jstests/core/geo_s2multi.js +++ b/jstests/core/geo_s2multi.js @@ -4,9 +4,6 @@ t.drop(); t.createIndex({geo: "2dsphere"}); // Let's try the examples in the GeoJSON spec. -// @tags: [ -// sbe_incompatible, -// ] multiPointA = { "type": "MultiPoint", "coordinates": [[100.0, 0.0], [101.0, 1.0]] diff --git a/jstests/core/geo_s2near.js b/jstests/core/geo_s2near.js index 2cd1df5cbbc..cd548fc3ff5 100644 --- a/jstests/core/geo_s2near.js +++ b/jstests/core/geo_s2near.js @@ -1,6 +1,5 @@ // @tags: [ // requires_getmore, -// sbe_incompatible, // ] // Test 2dsphere near search, called via find and $geoNear. diff --git a/jstests/core/geo_s2nearComplex.js b/jstests/core/geo_s2nearComplex.js index 40bc9b72445..22fe3112499 100644 --- a/jstests/core/geo_s2nearComplex.js +++ b/jstests/core/geo_s2nearComplex.js @@ -1,7 +1,6 @@ // @tags: [ // requires_getmore, // requires_non_retryable_writes, -// sbe_incompatible, // ] var t = db.get_s2nearcomplex; diff --git a/jstests/core/geo_s2near_equator_opposite.js b/jstests/core/geo_s2near_equator_opposite.js index 4b028baf43c..223eb50a0b5 100644 --- a/jstests/core/geo_s2near_equator_opposite.js +++ b/jstests/core/geo_s2near_equator_opposite.js @@ -1,9 +1,6 @@ // Tests geo near with 2 points diametrically opposite to each other // on the equator // First reported in SERVER-11830 as a regression in 2.5 -// @tags: [ -// sbe_incompatible, -// ] (function() { var t = db.geos2nearequatoropposite; diff --git a/jstests/core/geo_s2nearwithin.js b/jstests/core/geo_s2nearwithin.js index eb334e89aff..9a777310c5c 100644 --- a/jstests/core/geo_s2nearwithin.js +++ b/jstests/core/geo_s2nearwithin.js @@ -1,7 +1,4 @@ // Test $geoNear + $within. -// @tags: [ -// sbe_incompatible, -// ] (function() { t = db.geo_s2nearwithin; t.drop(); diff --git a/jstests/core/geo_s2nongeoarray.js b/jstests/core/geo_s2nongeoarray.js index 5fb5c59f1af..f5830e8702d 100644 --- a/jstests/core/geo_s2nongeoarray.js +++ b/jstests/core/geo_s2nongeoarray.js @@ -1,8 +1,5 @@ // Explode arrays when indexing non-geo fields in 2dsphere, and make sure that // we find them with queries. -// @tags: [ -// sbe_incompatible, -// ] t = db.geo_s2nongeoarray; oldPoint = [40, 5]; diff --git a/jstests/core/geo_s2oddshapes.js b/jstests/core/geo_s2oddshapes.js index 9ebe6be7ed3..db30d431caa 100644 --- a/jstests/core/geo_s2oddshapes.js +++ b/jstests/core/geo_s2oddshapes.js @@ -1,9 +1,6 @@ // Verify that odd polygons (huge or "narrow") behave as we expect. // Note that since 2dsphere is spherical, polygons that seem narrow are actually // rather wide if their latitude (or longitude) range is large. -// @tags: [ -// sbe_incompatible, -// ] var t = db.geo_s2oddshapes; t.drop(); t.createIndex({geo: "2dsphere"}); diff --git a/jstests/core/geo_s2ordering.js b/jstests/core/geo_s2ordering.js index 9e53cafb981..9afb1a8fa7c 100644 --- a/jstests/core/geo_s2ordering.js +++ b/jstests/core/geo_s2ordering.js @@ -5,7 +5,6 @@ // @tags: [ // assumes_balancer_off, // operations_longer_than_stepdown_interval_in_txns, -// sbe_incompatible, // ] (function() { "use strict"; diff --git a/jstests/core/geo_s2overlappingpolys.js b/jstests/core/geo_s2overlappingpolys.js index 3cc1f254a37..980b985f425 100644 --- a/jstests/core/geo_s2overlappingpolys.js +++ b/jstests/core/geo_s2overlappingpolys.js @@ -1,8 +1,3 @@ -/** - * @tags: [ - * sbe_incompatible, - * ] - */ var t = db.geo_s2overlappingpolys; t.drop(); diff --git a/jstests/core/geo_s2polywithholes.js b/jstests/core/geo_s2polywithholes.js index e37606465f6..1d337e9bf1d 100644 --- a/jstests/core/geo_s2polywithholes.js +++ b/jstests/core/geo_s2polywithholes.js @@ -1,8 +1,3 @@ -/** - * @tags: [ - * sbe_incompatible, - * ] - */ var t = db.geo_s2weirdpolys; t.drop(); t.createIndex({geo: "2dsphere"}); diff --git a/jstests/core/geo_s2twofields.js b/jstests/core/geo_s2twofields.js index 160b5f513e1..9f769f6897f 100644 --- a/jstests/core/geo_s2twofields.js +++ b/jstests/core/geo_s2twofields.js @@ -4,7 +4,6 @@ // @tags: [ // operations_longer_than_stepdown_interval_in_txns, // requires_fastcount, -// sbe_incompatible, // ] (function() { diff --git a/jstests/core/geo_s2within.js b/jstests/core/geo_s2within.js index 4f908a4f303..04915c77dcb 100644 --- a/jstests/core/geo_s2within.js +++ b/jstests/core/geo_s2within.js @@ -1,7 +1,4 @@ // Test some cases that might be iffy with $within, mostly related to polygon w/holes. -// @tags: [ -// sbe_incompatible, -// ] t = db.geo_s2within; t.drop(); t.createIndex({geo: "2dsphere"}); diff --git a/jstests/core/geo_s2within_line_polygon_sphere.js b/jstests/core/geo_s2within_line_polygon_sphere.js index f18595c5d6e..8cafa602ec4 100644 --- a/jstests/core/geo_s2within_line_polygon_sphere.js +++ b/jstests/core/geo_s2within_line_polygon_sphere.js @@ -1,7 +1,4 @@ // Tests for $geowithin $centerSphere operator with LineString and Polygon. -// @tags: [ -// sbe_incompatible, -// ] (function() { function testGeoWithinCenterSphereLinePolygon(coll) { @@ -241,4 +238,4 @@ testGeoWithinCenterSphereLinePolygon(coll); // Test $geowithin $centerSphere for LineString and Polygon with 2dsphere index. assert.commandWorked(coll.createIndex({geoField: "2dsphere"})); testGeoWithinCenterSphereLinePolygon(coll); -})();
\ No newline at end of file +})(); diff --git a/jstests/core/geo_small_large.js b/jstests/core/geo_small_large.js index 94d5298081e..9d165c418ae 100644 --- a/jstests/core/geo_small_large.js +++ b/jstests/core/geo_small_large.js @@ -1,7 +1,4 @@ // SERVER-2386, general geo-indexing using very large and very small bounds -// @tags: [ -// sbe_incompatible, -// ] load("jstests/libs/geo_near_random.js"); diff --git a/jstests/core/geo_sort1.js b/jstests/core/geo_sort1.js index 3e9ee494812..4d32c2f4ae2 100644 --- a/jstests/core/geo_sort1.js +++ b/jstests/core/geo_sort1.js @@ -1,8 +1,3 @@ -/** - * @tags: [ - * sbe_incompatible, - * ] - */ t = db.geo_sort1; t.drop(); diff --git a/jstests/core/geo_uniqueDocs.js b/jstests/core/geo_uniqueDocs.js index b6eaf4e0501..c15c1a35c99 100644 --- a/jstests/core/geo_uniqueDocs.js +++ b/jstests/core/geo_uniqueDocs.js @@ -1,8 +1,5 @@ // Test uniqueDocs option for $within queries and the $geoNear aggregation stage. SERVER-3139 // SERVER-12120 uniqueDocs is deprecated. Server always returns unique documents. -// @tags: [ -// sbe_incompatible, -// ] collName = 'geo_uniqueDocs_test'; t = db.geo_uniqueDocs_test; diff --git a/jstests/core/geo_uniqueDocs2.js b/jstests/core/geo_uniqueDocs2.js index 1486023b73f..ab586d50a88 100644 --- a/jstests/core/geo_uniqueDocs2.js +++ b/jstests/core/geo_uniqueDocs2.js @@ -1,6 +1,5 @@ // @tags: [ // requires_non_retryable_writes, -// sbe_incompatible, // ] // Additional checks for geo uniqueDocs and includeLocs SERVER-3139. diff --git a/jstests/core/geo_update_btree2.js b/jstests/core/geo_update_btree2.js index e37dbb190e1..962d8b524f4 100644 --- a/jstests/core/geo_update_btree2.js +++ b/jstests/core/geo_update_btree2.js @@ -3,7 +3,6 @@ // does_not_support_stepdowns, // requires_getmore, // requires_non_retryable_writes, -// sbe_incompatible, // ] // Tests whether the geospatial search is stable under btree updates diff --git a/jstests/core/geo_update_dedup.js b/jstests/core/geo_update_dedup.js index 3938204c70e..3191fa0df33 100644 --- a/jstests/core/geo_update_dedup.js +++ b/jstests/core/geo_update_dedup.js @@ -2,7 +2,6 @@ // @tags: [ // assumes_unsharded_collection, // requires_non_retryable_writes, -// sbe_incompatible, // ] // Test that updates with geo queries which match diff --git a/jstests/core/geo_validate.js b/jstests/core/geo_validate.js index 0518740c02e..3f810d73c4a 100644 --- a/jstests/core/geo_validate.js +++ b/jstests/core/geo_validate.js @@ -1,9 +1,6 @@ // // Test to make sure that invalid geo options are caught // -// @tags: [ -// sbe_incompatible, -// ] var coll = db.geo_validate; coll.drop(); diff --git a/jstests/core/geo_withinquery.js b/jstests/core/geo_withinquery.js index 4b6f5110d9d..13f20c1433f 100644 --- a/jstests/core/geo_withinquery.js +++ b/jstests/core/geo_withinquery.js @@ -1,6 +1,5 @@ // @tags: [ // requires_getmore, -// sbe_incompatible, // ] // SERVER-7343: allow $within without a geo index. diff --git a/jstests/core/geoa.js b/jstests/core/geoa.js index 52a9d79db3b..78cf6c960c9 100644 --- a/jstests/core/geoa.js +++ b/jstests/core/geoa.js @@ -1,8 +1,3 @@ -/** - * @tags: [ - * sbe_incompatible, - * ] - */ t = db.geoa; t.drop(); diff --git a/jstests/core/geob.js b/jstests/core/geob.js index b1093172618..2d5c8e368ff 100644 --- a/jstests/core/geob.js +++ b/jstests/core/geob.js @@ -1,8 +1,3 @@ -/** - * @tags: [ - * sbe_incompatible, - * ] - */ (function() { "use strict"; var t = db.geob; diff --git a/jstests/core/geoc.js b/jstests/core/geoc.js index 2c0948582c7..8875cd44614 100644 --- a/jstests/core/geoc.js +++ b/jstests/core/geoc.js @@ -1,6 +1,5 @@ // @tags: [ // requires_getmore, -// sbe_incompatible, // ] t = db.geoc; diff --git a/jstests/core/geod.js b/jstests/core/geod.js index 47b067809f8..8586d64e398 100644 --- a/jstests/core/geod.js +++ b/jstests/core/geod.js @@ -5,9 +5,6 @@ t.save({loc: [0.5, 0]}); t.createIndex({loc: "2d"}); // do a few geoNears with different maxDistances. The first iteration // should match no points in the dataset. -// @tags: [ -// sbe_incompatible, -// ] dists = [.49, .51, 1.0]; for (idx in dists) { b = db.geod diff --git a/jstests/core/geof.js b/jstests/core/geof.js index 31e5439b158..1f1d9e0cc67 100644 --- a/jstests/core/geof.js +++ b/jstests/core/geof.js @@ -2,9 +2,6 @@ t = db.geof; t.drop(); // corners (dist ~0.98) -// @tags: [ -// sbe_incompatible, -// ] t.insert({loc: [0.7, 0.7]}); t.insert({loc: [0.7, -0.7]}); t.insert({loc: [-0.7, 0.7]}); diff --git a/jstests/core/geonear_cmd_input_validation.js b/jstests/core/geonear_cmd_input_validation.js index 04f5e73fed0..5b247759db1 100644 --- a/jstests/core/geonear_cmd_input_validation.js +++ b/jstests/core/geonear_cmd_input_validation.js @@ -1,9 +1,6 @@ // // Test input validation for geoNear command. // -// @tags: [ -// sbe_incompatible, -// ] var t = db.geonear_cmd_input_validation; t.drop(); t.createIndex({loc: "2dsphere"}); diff --git a/jstests/core/geonear_key.js b/jstests/core/geonear_key.js index 4621e173f0e..1ecce018b08 100644 --- a/jstests/core/geonear_key.js +++ b/jstests/core/geonear_key.js @@ -1,8 +1,5 @@ /** * Tests for the 'key' field accepted by the $geoNear aggregation stage. - * @tags: [ - * sbe_incompatible, - * ] */ (function() { "use strict"; diff --git a/jstests/core/grow_hash_table.js b/jstests/core/grow_hash_table.js index 18f588aae64..800311497fb 100644 --- a/jstests/core/grow_hash_table.js +++ b/jstests/core/grow_hash_table.js @@ -8,7 +8,6 @@ // // @tags: [ // operations_longer_than_stepdown_interval_in_txns, -// sbe_incompatible, // ] var testDB = db.getSiblingDB('grow_hash_table'); diff --git a/jstests/core/hashed_index_sort.js b/jstests/core/hashed_index_sort.js index 8bac29774b6..2b9c72e8aff 100644 --- a/jstests/core/hashed_index_sort.js +++ b/jstests/core/hashed_index_sort.js @@ -14,12 +14,6 @@ load("jstests/libs/analyze_plan.js"); // For assertStagesForExplainOfCommand(). -// The explain output depends on which execution engine is enabled. -// TODO Remove when SERVER-51823 lands. -const isSBEEnabled = (() => { - const getParam = db.adminCommand({getParameter: 1, featureFlagSBE: 1}); - return getParam.hasOwnProperty("featureFlagSBE") && getParam.featureFlagSBE.value; -})(); const coll = db.hashed_index_sort; coll.drop(); @@ -107,7 +101,7 @@ validateFindCmdOutputAndPlan({ {a: 1, b: 3, c: 4, d: -2}, {a: 1, b: 4, c: 5, d: -3}, ], - expectedStages: ["IXSCAN", isSBEEnabled ? "SORT_SIMPLE" : "SORT"] + expectedStages: ["IXSCAN", "SORT"] }); /** @@ -169,7 +163,7 @@ validateFindCmdOutputAndPlan({ filter: {}, project: {_id: 0, a: 1, b: 1}, sort: {a: 1, b: -1, c: 1}, - expectedStages: [isSBEEnabled ? "SORT_SIMPLE" : "SORT", "COLLSCAN"], + expectedStages: ["SORT", "COLLSCAN"], }); // Verify that a list of exact match predicates on range field (prefix) and sort with an immediate @@ -191,7 +185,7 @@ validateFindCmdOutputAndPlan({ project: {_id: 0, d: 1, b: 1}, sort: {d: 1}, expectedOutput: [{b: 4, d: -3}, {b: 3, d: -2}, {b: 2, d: -1}, {b: 1, d: 0}, {b: 0, d: 1}], - expectedStages: ["IXSCAN", isSBEEnabled ? "SORT_DEFAULT" : "SORT"], + expectedStages: ["IXSCAN", "SORT"], stagesNotExpected: ["COLLSCAN", "FETCH"] }); @@ -201,6 +195,6 @@ validateFindCmdOutputAndPlan({ project: {_id: 0, c: 1}, sort: {c: 1}, expectedOutput: [{c: 2}], - expectedStages: ["IXSCAN", "FETCH", isSBEEnabled ? "SORT_SIMPLE" : "SORT"] + expectedStages: ["IXSCAN", "FETCH", "SORT"] }); })(); diff --git a/jstests/core/hidden_index.js b/jstests/core/hidden_index.js index 80e124ef5e7..344a808fab6 100644 --- a/jstests/core/hidden_index.js +++ b/jstests/core/hidden_index.js @@ -21,7 +21,7 @@ let coll = assertDropAndRecreateCollection(db, collName); function numOfUsedIXSCAN(query) { const explain = assert.commandWorked(coll.find(query).explain()); - const ixScans = getPlanStages(explain.queryPlanner.winningPlan, "IXSCAN"); + const ixScans = getPlanStages(getWinningPlan(explain.queryPlanner), "IXSCAN"); return ixScans.length; } diff --git a/jstests/core/id_sbe.js b/jstests/core/id_sbe.js deleted file mode 100644 index b00249fab20..00000000000 --- a/jstests/core/id_sbe.js +++ /dev/null @@ -1,82 +0,0 @@ -// TODO: Enable "idhack.js" under SBE mode and remove this test once SERVER-51823 is fixed. -// @tags: [ -// assumes_balancer_off, -// requires_non_retryable_writes, -// ] -(function() { -"use strict"; - -const t = db.id_sbe; -t.drop(); - -// Include helpers for analyzing explain output. -load("jstests/libs/analyze_plan.js"); - -assert.commandWorked(t.insert({_id: {x: 1}, z: 1})); -assert.commandWorked(t.insert({_id: {x: 2}, z: 2})); -assert.commandWorked(t.insert({_id: {x: 3}, z: 3})); -assert.commandWorked(t.insert({_id: 1, z: 4})); -assert.commandWorked(t.insert({_id: 2, z: 5})); -assert.commandWorked(t.insert({_id: 3, z: 6})); - -assert.eq(2, t.findOne({_id: {x: 2}}).z); -assert.eq(2, t.find({_id: {$gte: 2}}).count()); -assert.eq(2, t.find({_id: {$gte: 2}}).itcount()); - -t.update({_id: {x: 2}}, {$set: {z: 7}}); -assert.eq(7, t.findOne({_id: {x: 2}}).z); - -t.update({_id: {$gte: 2}}, {$set: {z: 8}}, false, true); -assert.eq(4, t.findOne({_id: 1}).z); -assert.eq(8, t.findOne({_id: 2}).z); -assert.eq(8, t.findOne({_id: 3}).z); - -const query = { - _id: {x: 2} -}; -let explain = t.find(query).explain(true); -assert.eq(1, explain.executionStats.nReturned); -assert.eq(1, explain.executionStats.totalKeysExamined); - -// -// Non-covered projection that use _ids. -// - -t.drop(); -assert.commandWorked(t.insert({_id: 0, a: 0, b: [{c: 1}, {c: 2}]})); -assert.commandWorked(t.insert({_id: 1, a: 1, b: [{c: 3}, {c: 4}]})); - -// Simple inclusion. -assert.eq({_id: 1, a: 1}, t.find({_id: 1}, {a: 1}).next()); -assert.eq({a: 1}, t.find({_id: 1}, {_id: 0, a: 1}).next()); -assert.eq({_id: 0, a: 0}, t.find({_id: 0}, {_id: 1, a: 1}).next()); - -// Non-simple: exclusion. -assert.eq({_id: 1, a: 1}, t.find({_id: 1}, {b: 0}).next()); -assert.eq({_id: 0}, t.find({_id: 0}, {a: 0, b: 0}).next()); - -// Non-simple: dotted fields. -assert.eq({b: [{c: 1}, {c: 2}]}, t.find({_id: 0}, {_id: 0, "b.c": 1}).next()); -assert.eq({_id: 1}, t.find({_id: 1}, {"foo.bar": 1}).next()); - -// Non-simple: elemMatch projection. -assert.eq({_id: 1, b: [{c: 4}]}, t.find({_id: 1}, {b: {$elemMatch: {c: 4}}}).next()); - -// Non-simple: .returnKey(). -assert.eq({_id: 1}, t.find({_id: 1}).returnKey().next()); - -// Non-simple: .returnKey() overrides other projections. -assert.eq({_id: 1}, t.find({_id: 1}, {a: 1}).returnKey().next()); - -// Test that equality queries on _id with min() or max() require hint(). -let err = assert.throws(() => t.find({_id: 2}).min({_id: 1}).itcount()); -assert.commandFailedWithCode(err, 51173); -err = assert.throws(() => t.find({_id: 2}).max({_id: 3}).itcount()); -assert.commandFailedWithCode(err, 51173); - -// Test that equality queries on _id respect min() and max(). -assert.eq({_id: 1}, t.find({_id: 1}).hint({_id: 1}).min({_id: 0}).returnKey().next()); -assert.eq({_id: 1}, t.find({_id: 1}).hint({_id: 1}).min({_id: 0}).max({_id: 2}).returnKey().next()); -assert.eq(0, t.find({_id: 1}).hint({_id: 1}).max({_id: 0}).itcount()); -assert.eq(0, t.find({_id: 1}).hint({_id: 1}).min({_id: 2}).itcount()); -})(); diff --git a/jstests/core/index_bounds_object.js b/jstests/core/index_bounds_object.js index 8faac1b5d8a..255fb55f117 100644 --- a/jstests/core/index_bounds_object.js +++ b/jstests/core/index_bounds_object.js @@ -2,7 +2,6 @@ // @tags: [ // assumes_unsharded_collection, // requires_non_retryable_writes, -// sbe_incompatible, // ] (function() { "use strict"; @@ -56,8 +55,8 @@ assertCoveredQueryAndCount({collection: coll, query: {a: {$lte: {}}}, project: p // Adding a document containing an array makes the index multi-key which can never be used for a // covered query. assert.commandWorked(coll.insert({a: []})); -assert(!isIndexOnly(db, coll.find({a: {$gt: {}}}, proj).explain().queryPlanner.winningPlan)); -assert(!isIndexOnly(db, coll.find({a: {$gte: {}}}, proj).explain().queryPlanner.winningPlan)); -assert(!isIndexOnly(db, coll.find({a: {$lt: {}}}, proj).explain().queryPlanner.winningPlan)); -assert(!isIndexOnly(db, coll.find({a: {$lte: {}}}, proj).explain().queryPlanner.winningPlan)); +assert(!isIndexOnly(db, getWinningPlan(coll.find({a: {$gt: {}}}, proj).explain().queryPlanner))); +assert(!isIndexOnly(db, getWinningPlan(coll.find({a: {$gte: {}}}, proj).explain().queryPlanner))); +assert(!isIndexOnly(db, getWinningPlan(coll.find({a: {$lt: {}}}, proj).explain().queryPlanner))); +assert(!isIndexOnly(db, getWinningPlan(coll.find({a: {$lte: {}}}, proj).explain().queryPlanner))); })(); diff --git a/jstests/core/index_bounds_pipe.js b/jstests/core/index_bounds_pipe.js index 8989d249b8a..fffb203f793 100644 --- a/jstests/core/index_bounds_pipe.js +++ b/jstests/core/index_bounds_pipe.js @@ -1,6 +1,7 @@ /** * Tests the tightness of index bounds when attempting to match a regex that contains escaped and * non-escaped pipe '|' characters. + * TODO SERVER-52734: remove sbe_incompatible tag * @tags: [ * sbe_incompatible, * ] @@ -36,7 +37,7 @@ function assertIndexBoundsAndResult(params) { // Check that the query uses correct index bounds. When run against a sharded cluster, there // may be multiple index scan stages, but each should have the same index bounds. - const ixscans = getPlanStages(explain.queryPlanner.winningPlan, 'IXSCAN'); + const ixscans = getPlanStages(getWinningPlan(explain.queryPlanner), 'IXSCAN'); assert.gt(ixscans.length, 0, 'Plan unexpectedly missing IXSCAN stage: ' + tojson(explain)); for (let i = 0; i < ixscans.length; i++) { const ixscan = ixscans[i]; diff --git a/jstests/core/index_check2.js b/jstests/core/index_check2.js index 216ca7fb283..5172f991ac2 100644 --- a/jstests/core/index_check2.js +++ b/jstests/core/index_check2.js @@ -1,3 +1,4 @@ +// TODO SERVER-50737: remove sbe_incompatible tag // @tags: [ // assumes_balancer_off, // requires_getmore, diff --git a/jstests/core/index_decimal.js b/jstests/core/index_decimal.js index d7601b81bd7..01cd343b2a4 100644 --- a/jstests/core/index_decimal.js +++ b/jstests/core/index_decimal.js @@ -3,7 +3,6 @@ // order to apply the SHARDING_FILTER stage. // @tags: [ // assumes_unsharded_collection, -// sbe_incompatible, // ] // Test indexing of decimal numbers diff --git a/jstests/core/index_elemmatch2.js b/jstests/core/index_elemmatch2.js index d90606ff1ba..b0b7015d037 100644 --- a/jstests/core/index_elemmatch2.js +++ b/jstests/core/index_elemmatch2.js @@ -1,9 +1,6 @@ /** * Test that queries containing $elemMatch correctly use an index if each child expression is * compatible with the index. - * @tags: [ - * sbe_incompatible, - * ] */ (function() { "use strict"; @@ -22,7 +19,7 @@ assert.commandWorked(coll.createIndex({a: 1}, {sparse: true})); function assertIndexResults(coll, query, useIndex, nReturned) { const explainPlan = coll.find(query).explain("executionStats"); - assert.eq(isIxscan(db, explainPlan.queryPlanner.winningPlan), useIndex); + assert.eq(isIxscan(db, getWinningPlan(explainPlan.queryPlanner)), useIndex); assert.eq(explainPlan.executionStats.nReturned, nReturned); } diff --git a/jstests/core/index_large_and_small_dates.js b/jstests/core/index_large_and_small_dates.js index 66df2ac8661..b64cc83860d 100644 --- a/jstests/core/index_large_and_small_dates.js +++ b/jstests/core/index_large_and_small_dates.js @@ -4,9 +4,6 @@ const coll = db.index_dates; coll.drop(); // Min value for JS Date(). -// @tags: [ -// sbe_incompatible, -// ] const d1 = new Date(-8640000000000000); assert.commandWorked(coll.insert({_id: 1, d: d1})); // Max value for JS Date(). @@ -30,4 +27,4 @@ assert.commandWorked(coll.dropIndex({d: 1})); // Testing index version 2. assert.commandWorked(coll.createIndex({d: 1})); test(); -})();
\ No newline at end of file +})(); diff --git a/jstests/core/index_partial_2dsphere.js b/jstests/core/index_partial_2dsphere.js index 21f34bf932a..158a3ce3546 100644 --- a/jstests/core/index_partial_2dsphere.js +++ b/jstests/core/index_partial_2dsphere.js @@ -2,7 +2,6 @@ // a partial index filter. // @tags: [ // requires_non_retryable_writes, -// sbe_incompatible, // ] (function() { diff --git a/jstests/core/index_stats.js b/jstests/core/index_stats.js index 1d465e3f681..a23f54d6f33 100644 --- a/jstests/core/index_stats.js +++ b/jstests/core/index_stats.js @@ -9,7 +9,6 @@ // assumes_unsharded_collection, // does_not_support_stepdowns, // requires_non_retryable_writes, -// sbe_incompatible, // ] (function() { diff --git a/jstests/core/index_type_change.js b/jstests/core/index_type_change.js index d23984a132d..0fd2476c747 100644 --- a/jstests/core/index_type_change.js +++ b/jstests/core/index_type_change.js @@ -1,6 +1,7 @@ // Cannot implicitly shard accessed collections because of following errmsg: A single // update/delete on a sharded collection must contain an exact match on _id or contain the shard // key. +// TODO SERVER-52734: remove sbe_incompatible tag // @tags: [ // assumes_unsharded_collection, // sbe_incompatible, diff --git a/jstests/core/indexes_multiple_commands.js b/jstests/core/indexes_multiple_commands.js index abcb7b58500..ea57a0392be 100644 --- a/jstests/core/indexes_multiple_commands.js +++ b/jstests/core/indexes_multiple_commands.js @@ -2,7 +2,6 @@ // expected. // @tags: [ // assumes_no_implicit_collection_creation_after_drop, -// sbe_incompatible, // ] // Test that commands behave correctly under the presence of multiple indexes with the same key diff --git a/jstests/core/indexr.js b/jstests/core/indexr.js index de3afe8cdc1..d3ff5f7e02e 100644 --- a/jstests/core/indexr.js +++ b/jstests/core/indexr.js @@ -1,6 +1,5 @@ // @tags: [ // requires_non_retryable_writes, -// sbe_incompatible, // ] // Check multikey index cases with parallel nested fields SERVER-958. diff --git a/jstests/core/indexu.js b/jstests/core/indexu.js index 973fc0e4985..cb1bf88db87 100644 --- a/jstests/core/indexu.js +++ b/jstests/core/indexu.js @@ -1,3 +1,4 @@ +// TODO SERVER-49852: remove sbe_incompatible tag // @tags: [ // requires_non_retryable_writes, // sbe_incompatible, diff --git a/jstests/core/json_schema/additional_items.js b/jstests/core/json_schema/additional_items.js index fdab99cd64b..a13d5d5de37 100644 --- a/jstests/core/json_schema/additional_items.js +++ b/jstests/core/json_schema/additional_items.js @@ -1,6 +1,5 @@ // @tags: [ // requires_non_retryable_commands, -// sbe_incompatible, // ] /** diff --git a/jstests/core/json_schema/additional_properties.js b/jstests/core/json_schema/additional_properties.js index 9145d74016c..18227c8feee 100644 --- a/jstests/core/json_schema/additional_properties.js +++ b/jstests/core/json_schema/additional_properties.js @@ -1,6 +1,5 @@ // @tags: [ // requires_non_retryable_commands, -// sbe_incompatible, // ] /** diff --git a/jstests/core/json_schema/bsontype.js b/jstests/core/json_schema/bsontype.js index 08e0a925065..9424f718838 100644 --- a/jstests/core/json_schema/bsontype.js +++ b/jstests/core/json_schema/bsontype.js @@ -1,6 +1,5 @@ // @tags: [ // requires_non_retryable_commands, -// sbe_incompatible, // ] /** diff --git a/jstests/core/json_schema/dependencies.js b/jstests/core/json_schema/dependencies.js index d63ee75af54..18de1505080 100644 --- a/jstests/core/json_schema/dependencies.js +++ b/jstests/core/json_schema/dependencies.js @@ -1,6 +1,5 @@ // @tags: [ // requires_non_retryable_commands, -// sbe_incompatible, // ] /** diff --git a/jstests/core/json_schema/encrypt.js b/jstests/core/json_schema/encrypt.js index 1754b9490bb..32d93f43da4 100644 --- a/jstests/core/json_schema/encrypt.js +++ b/jstests/core/json_schema/encrypt.js @@ -3,7 +3,6 @@ * * @tags: [ * requires_non_retryable_commands, - * sbe_incompatible, * ] */ (function() { diff --git a/jstests/core/json_schema/items.js b/jstests/core/json_schema/items.js index b9fd63611cd..afef8df2ce0 100644 --- a/jstests/core/json_schema/items.js +++ b/jstests/core/json_schema/items.js @@ -1,6 +1,5 @@ // @tags: [ // requires_non_retryable_commands, -// sbe_incompatible, // ] /** diff --git a/jstests/core/json_schema/json_schema.js b/jstests/core/json_schema/json_schema.js index 45828fdcca8..7c73c1d5e75 100644 --- a/jstests/core/json_schema/json_schema.js +++ b/jstests/core/json_schema/json_schema.js @@ -2,7 +2,6 @@ // @tags: [ // assumes_no_implicit_collection_creation_after_drop, // requires_non_retryable_commands, -// sbe_incompatible, // ] /** @@ -13,6 +12,14 @@ load("jstests/libs/assert_schema_match.js"); +// Note that the "getParameter" command is expected to fail in versions of mongod that do not yet +// include the slot-based execution engine. When that happens, however, 'isSBEEnabled' still +// correctly evaluates to false. +const isSBEEnabled = (() => { + const getParam = db.adminCommand({getParameter: 1, featureFlagSBE: 1}); + return getParam.hasOwnProperty("featureFlagSBE") && getParam.featureFlagSBE.value; +})(); + let coll = db.jstests_json_schema; coll.drop(); @@ -336,8 +343,10 @@ assert.eq( assert.eq(1, coll.find({$or: [{$jsonSchema: {}, a: 1}, {b: 1}]}).itcount()); assert.eq(1, coll.find({$and: [{$jsonSchema: {}, a: 1}, {b: 1}]}).itcount()); -assert.eq(1, coll.find({$_internalSchemaMinProperties: 3, b: 2}).itcount()); -assert.eq(1, coll.find({$_internalSchemaMaxProperties: 3, b: 2}).itcount()); +if (!isSBEEnabled) { + assert.eq(1, coll.find({$_internalSchemaMinProperties: 3, b: 2}).itcount()); + assert.eq(1, coll.find({$_internalSchemaMaxProperties: 3, b: 2}).itcount()); +} assert.eq(1, coll.find({$alwaysTrue: 1, b: 2}).itcount()); assert.eq(0, coll.find({$alwaysFalse: 1, b: 2}).itcount()); }()); diff --git a/jstests/core/json_schema/logical_keywords.js b/jstests/core/json_schema/logical_keywords.js index 0b7727b49d8..533e1ffe2e2 100644 --- a/jstests/core/json_schema/logical_keywords.js +++ b/jstests/core/json_schema/logical_keywords.js @@ -1,6 +1,5 @@ // @tags: [ // requires_non_retryable_commands, -// sbe_incompatible, // ] /** diff --git a/jstests/core/json_schema/min_max_items.js b/jstests/core/json_schema/min_max_items.js index 8b276411edc..a4e7eb6c466 100644 --- a/jstests/core/json_schema/min_max_items.js +++ b/jstests/core/json_schema/min_max_items.js @@ -1,6 +1,5 @@ // @tags: [ // requires_non_retryable_commands, -// sbe_incompatible, // ] /** diff --git a/jstests/core/json_schema/min_max_properties.js b/jstests/core/json_schema/min_max_properties.js index cba210d9c68..163c7228361 100644 --- a/jstests/core/json_schema/min_max_properties.js +++ b/jstests/core/json_schema/min_max_properties.js @@ -1,6 +1,5 @@ // @tags: [ // requires_non_retryable_commands, -// sbe_incompatible, // ] /** diff --git a/jstests/core/json_schema/misc_validation.js b/jstests/core/json_schema/misc_validation.js index 50bb4fc998b..68f78c6e7c1 100644 --- a/jstests/core/json_schema/misc_validation.js +++ b/jstests/core/json_schema/misc_validation.js @@ -17,7 +17,6 @@ * requires_non_retryable_commands, * requires_non_retryable_writes, * requires_replication, - * sbe_incompatible, * ] */ (function() { diff --git a/jstests/core/json_schema/pattern_properties.js b/jstests/core/json_schema/pattern_properties.js index f09a030633a..14c82230fe5 100644 --- a/jstests/core/json_schema/pattern_properties.js +++ b/jstests/core/json_schema/pattern_properties.js @@ -1,6 +1,5 @@ // @tags: [ // requires_non_retryable_commands, -// sbe_incompatible, // ] /** diff --git a/jstests/core/json_schema/required.js b/jstests/core/json_schema/required.js index e3b62ddd1ba..bfa9df0de9b 100644 --- a/jstests/core/json_schema/required.js +++ b/jstests/core/json_schema/required.js @@ -1,6 +1,5 @@ // @tags: [ // requires_non_retryable_commands, -// sbe_incompatible, // ] /** diff --git a/jstests/core/json_schema/unique_items.js b/jstests/core/json_schema/unique_items.js index 4654f515465..7b1f2a4e7a9 100644 --- a/jstests/core/json_schema/unique_items.js +++ b/jstests/core/json_schema/unique_items.js @@ -1,6 +1,5 @@ // @tags: [ // requires_non_retryable_commands, -// sbe_incompatible, // ] /** diff --git a/jstests/core/map_reduce_validation.js b/jstests/core/map_reduce_validation.js index c59bceb99bf..953bc360626 100644 --- a/jstests/core/map_reduce_validation.js +++ b/jstests/core/map_reduce_validation.js @@ -2,7 +2,6 @@ // @tags: [ // assumes_no_implicit_collection_creation_after_drop, // does_not_support_stepdowns, -// sbe_incompatible, // uses_map_reduce_with_temp_collections, // ] (function() { diff --git a/jstests/core/merge_sort_collation.js b/jstests/core/merge_sort_collation.js index 25b8af93c24..5f25b4e0ae4 100644 --- a/jstests/core/merge_sort_collation.js +++ b/jstests/core/merge_sort_collation.js @@ -472,4 +472,4 @@ const testCases = [ ]; testCases.forEach(executeQueryTestCase); -}());
\ No newline at end of file +}()); diff --git a/jstests/core/mr_agg_explain.js b/jstests/core/mr_agg_explain.js index 7d1d11bb28a..e3d7a1be612 100644 --- a/jstests/core/mr_agg_explain.js +++ b/jstests/core/mr_agg_explain.js @@ -2,7 +2,6 @@ * Tests that running mapReduce with explain behaves as expected. * @tags: [ * incompatible_with_embedded, - * sbe_incompatible, * ] */ (function() { diff --git a/jstests/core/mr_bigobject.js b/jstests/core/mr_bigobject.js index a9b9bd03047..ed534f8fc67 100644 --- a/jstests/core/mr_bigobject.js +++ b/jstests/core/mr_bigobject.js @@ -4,7 +4,6 @@ // does_not_support_causal_consistency, // does_not_support_stepdowns, // requires_fastcount, -// sbe_incompatible, // uses_map_reduce_with_temp_collections, // ] (function() { diff --git a/jstests/core/mr_bigobject_replace.js b/jstests/core/mr_bigobject_replace.js index 20c2356e26f..e9fc2c0aba3 100644 --- a/jstests/core/mr_bigobject_replace.js +++ b/jstests/core/mr_bigobject_replace.js @@ -5,7 +5,6 @@ // # mapReduce does not support afterClusterTime. // does_not_support_causal_consistency, // does_not_support_stepdowns, -// sbe_incompatible, // uses_map_reduce_with_temp_collections, // ] diff --git a/jstests/core/mr_comments.js b/jstests/core/mr_comments.js index 4b2489d1df7..48441078ebb 100644 --- a/jstests/core/mr_comments.js +++ b/jstests/core/mr_comments.js @@ -3,7 +3,6 @@ // # mapReduce does not support afterClusterTime. // does_not_support_causal_consistency, // does_not_support_stepdowns, -// sbe_incompatible, // uses_map_reduce_with_temp_collections, // ] (function() { diff --git a/jstests/core/mr_compute_avg.js b/jstests/core/mr_compute_avg.js index 3f51d84b6b1..a0320679ea0 100644 --- a/jstests/core/mr_compute_avg.js +++ b/jstests/core/mr_compute_avg.js @@ -9,7 +9,6 @@ // # mapReduce does not support afterClusterTime. // does_not_support_causal_consistency, // does_not_support_stepdowns, -// sbe_incompatible, // uses_map_reduce_with_temp_collections, // ] (function() { diff --git a/jstests/core/mr_correctness.js b/jstests/core/mr_correctness.js index 815c20fc7e8..9dc6aaf1c4c 100644 --- a/jstests/core/mr_correctness.js +++ b/jstests/core/mr_correctness.js @@ -5,7 +5,6 @@ // does_not_support_stepdowns, // requires_fastcount, // requires_getmore, -// sbe_incompatible, // uses_map_reduce_with_temp_collections, // ] (function() { diff --git a/jstests/core/mr_fail_invalid_js.js b/jstests/core/mr_fail_invalid_js.js index 1361c72a51b..01b422c1fe3 100644 --- a/jstests/core/mr_fail_invalid_js.js +++ b/jstests/core/mr_fail_invalid_js.js @@ -4,7 +4,6 @@ // # mapReduce does not support afterClusterTime. // does_not_support_causal_consistency, // does_not_support_stepdowns, -// sbe_incompatible, // uses_map_reduce_with_temp_collections, // ] (function() { diff --git a/jstests/core/mr_killop.js b/jstests/core/mr_killop.js index d0626047ed9..925da1118b8 100644 --- a/jstests/core/mr_killop.js +++ b/jstests/core/mr_killop.js @@ -3,7 +3,6 @@ // # mapReduce does not support afterClusterTime. // does_not_support_causal_consistency, // does_not_support_stepdowns, -// sbe_incompatible, // uses_map_reduce_with_temp_collections, // uses_multiple_connections, // uses_parallel_shell, diff --git a/jstests/core/mr_merge.js b/jstests/core/mr_merge.js index 1f00a898e49..fa9d2c3d873 100644 --- a/jstests/core/mr_merge.js +++ b/jstests/core/mr_merge.js @@ -6,7 +6,6 @@ // # mapReduce does not support afterClusterTime. // does_not_support_causal_consistency, // does_not_support_stepdowns, -// sbe_incompatible, // uses_map_reduce_with_temp_collections, // ] (function() { diff --git a/jstests/core/mr_multikey_deduping.js b/jstests/core/mr_multikey_deduping.js index e3f729ef16f..f16ef8329a5 100644 --- a/jstests/core/mr_multikey_deduping.js +++ b/jstests/core/mr_multikey_deduping.js @@ -7,7 +7,6 @@ // # mapReduce does not support afterClusterTime. // does_not_support_causal_consistency, // does_not_support_stepdowns, -// sbe_incompatible, // uses_map_reduce_with_temp_collections, // ] diff --git a/jstests/core/mr_mutable_properties.js b/jstests/core/mr_mutable_properties.js index 213ac1fbd76..d7399fa337e 100644 --- a/jstests/core/mr_mutable_properties.js +++ b/jstests/core/mr_mutable_properties.js @@ -2,7 +2,6 @@ // # mapReduce does not support afterClusterTime. // does_not_support_causal_consistency, // does_not_support_stepdowns, -// sbe_incompatible, // ] // See SERVER-9448 diff --git a/jstests/core/mr_null_arguments.js b/jstests/core/mr_null_arguments.js index 9eeec78654d..5cca8210656 100644 --- a/jstests/core/mr_null_arguments.js +++ b/jstests/core/mr_null_arguments.js @@ -5,7 +5,6 @@ // # mapReduce does not support afterClusterTime. // does_not_support_causal_consistency, // does_not_support_stepdowns, -// sbe_incompatible, // uses_map_reduce_with_temp_collections, // ] (function() { diff --git a/jstests/core/mr_preserve_indexes.js b/jstests/core/mr_preserve_indexes.js index a4e33166937..dd4f47af171 100644 --- a/jstests/core/mr_preserve_indexes.js +++ b/jstests/core/mr_preserve_indexes.js @@ -3,7 +3,6 @@ // # mapReduce does not support afterClusterTime. // does_not_support_causal_consistency, // does_not_support_stepdowns, -// sbe_incompatible, // uses_map_reduce_with_temp_collections, // ] (function() { diff --git a/jstests/core/mr_reduce.js b/jstests/core/mr_reduce.js index 37ef489b9be..aded1cf471d 100644 --- a/jstests/core/mr_reduce.js +++ b/jstests/core/mr_reduce.js @@ -6,7 +6,6 @@ // # mapReduce does not support afterClusterTime. // does_not_support_causal_consistency, // does_not_support_stepdowns, -// sbe_incompatible, // uses_map_reduce_with_temp_collections, // ] (function() { diff --git a/jstests/core/mr_reduce_merge_other_db.js b/jstests/core/mr_reduce_merge_other_db.js index ec8069d3254..80edc601aa2 100644 --- a/jstests/core/mr_reduce_merge_other_db.js +++ b/jstests/core/mr_reduce_merge_other_db.js @@ -2,7 +2,6 @@ // # mapReduce does not support afterClusterTime. // does_not_support_causal_consistency, // does_not_support_stepdowns, -// sbe_incompatible, // uses_map_reduce_with_temp_collections, // ] (function() { diff --git a/jstests/core/mr_replace_into_other_db.js b/jstests/core/mr_replace_into_other_db.js index fe1ec71b70e..e85a0b6a3c6 100644 --- a/jstests/core/mr_replace_into_other_db.js +++ b/jstests/core/mr_replace_into_other_db.js @@ -3,7 +3,6 @@ // # mapReduce does not support afterClusterTime. // does_not_support_causal_consistency, // does_not_support_stepdowns, -// sbe_incompatible, // uses_map_reduce_with_temp_collections, // ] // diff --git a/jstests/core/mr_scope.js b/jstests/core/mr_scope.js index 04f7e77dbb1..017d39b9268 100644 --- a/jstests/core/mr_scope.js +++ b/jstests/core/mr_scope.js @@ -3,7 +3,6 @@ // # mapReduce does not support afterClusterTime. // does_not_support_causal_consistency, // does_not_support_stepdowns, -// sbe_incompatible, // uses_map_reduce_with_temp_collections, // ] (function() { diff --git a/jstests/core/mr_sort.js b/jstests/core/mr_sort.js index c1ce7d3861b..7ac07918898 100644 --- a/jstests/core/mr_sort.js +++ b/jstests/core/mr_sort.js @@ -5,7 +5,6 @@ // # mapReduce does not support afterClusterTime. // does_not_support_causal_consistency, // does_not_support_stepdowns, -// sbe_incompatible, // uses_map_reduce_with_temp_collections, // ] diff --git a/jstests/core/mr_stored.js b/jstests/core/mr_stored.js index 58f86d58730..3873bb27d70 100644 --- a/jstests/core/mr_stored.js +++ b/jstests/core/mr_stored.js @@ -6,7 +6,6 @@ // does_not_support_causal_consistency, // does_not_support_stepdowns, // requires_non_retryable_writes, -// sbe_incompatible, // uses_map_reduce_with_temp_collections, // ] /** diff --git a/jstests/core/mr_tolerates_js_exception.js b/jstests/core/mr_tolerates_js_exception.js index 5a1c0f2f69f..e291639cb92 100644 --- a/jstests/core/mr_tolerates_js_exception.js +++ b/jstests/core/mr_tolerates_js_exception.js @@ -7,7 +7,6 @@ * does_not_support_causal_consistency, * does_not_support_stepdowns, * requires_scripting, - * sbe_incompatible, * ] */ (function() { diff --git a/jstests/core/mr_use_this_object.js b/jstests/core/mr_use_this_object.js index b108d046efd..8c6061d0fa8 100644 --- a/jstests/core/mr_use_this_object.js +++ b/jstests/core/mr_use_this_object.js @@ -4,7 +4,6 @@ // # mapReduce does not support afterClusterTime. // does_not_support_causal_consistency, // does_not_support_stepdowns, -// sbe_incompatible, // uses_map_reduce_with_temp_collections, // ] (function() { diff --git a/jstests/core/multikey_geonear.js b/jstests/core/multikey_geonear.js index 4b1cd5eb482..7e77293fe49 100644 --- a/jstests/core/multikey_geonear.js +++ b/jstests/core/multikey_geonear.js @@ -1,8 +1,5 @@ // Test that we correct return results for compound 2d and 2dsphere indices in // both the multikey and non-multikey cases. -// @tags: [ -// sbe_incompatible, -// ] var t = db.jstests_multikey_geonear; t.drop(); diff --git a/jstests/core/operation_latency_histogram.js b/jstests/core/operation_latency_histogram.js index 6a22ae6faca..54291da9391 100644 --- a/jstests/core/operation_latency_histogram.js +++ b/jstests/core/operation_latency_histogram.js @@ -9,7 +9,6 @@ // assumes_read_preference_unchanged, // incompatible_with_embedded, // requires_collstats, -// sbe_incompatible, // ] // diff --git a/jstests/core/or4.js b/jstests/core/or4.js index e095eb9961c..a3f8e259019 100644 --- a/jstests/core/or4.js +++ b/jstests/core/or4.js @@ -3,7 +3,6 @@ // requires_fastcount, // requires_getmore, // requires_non_retryable_writes, -// sbe_incompatible, // ] load("jstests/aggregation/extras/utils.js"); // For resultsEq diff --git a/jstests/core/or6.js b/jstests/core/or6.js index 796be83549e..8865d62d4f3 100644 --- a/jstests/core/or6.js +++ b/jstests/core/or6.js @@ -1,5 +1,4 @@ // A few rooted $or cases. - var t = db.jstests_orq; t.drop(); diff --git a/jstests/core/or_inexact.js b/jstests/core/or_inexact.js index 0584be98d6d..82a845554b8 100644 --- a/jstests/core/or_inexact.js +++ b/jstests/core/or_inexact.js @@ -1,5 +1,6 @@ // Test $or with predicates that generate inexact bounds. The access planner // has special logic for such queries. +// TODO SERVER-52734: remove sbe_incompatible tag // @tags: [ // sbe_incompatible, // ] diff --git a/jstests/core/orj.js b/jstests/core/orj.js index deee0c4821c..766ea4c0c12 100644 --- a/jstests/core/orj.js +++ b/jstests/core/orj.js @@ -1,4 +1,5 @@ // Test nested $or clauses SERVER-2585 SERVER-3192 +// TODO SERVER-50737: remove sbe_incompatible tag // @tags: [ // sbe_incompatible, // ] @@ -161,4 +162,4 @@ function checkHinted(hint) { checkHinted({$natural: 1}); checkHinted({a: 1}); checkHinted({b: 1}); -checkHinted({a: 1, b: 1});
\ No newline at end of file +checkHinted({a: 1, b: 1}); diff --git a/jstests/core/plan_cache_list_plans.js b/jstests/core/plan_cache_list_plans.js index 354fa05a55c..13c28cfb1a8 100644 --- a/jstests/core/plan_cache_list_plans.js +++ b/jstests/core/plan_cache_list_plans.js @@ -12,7 +12,6 @@ // assumes_unsharded_collection, // does_not_support_stepdowns, // inspects_whether_plan_cache_entry_is_active, -// sbe_incompatible, // ] (function() { diff --git a/jstests/core/plan_cache_shell_helpers.js b/jstests/core/plan_cache_shell_helpers.js index da0510befed..aba0d20047e 100644 --- a/jstests/core/plan_cache_shell_helpers.js +++ b/jstests/core/plan_cache_shell_helpers.js @@ -10,7 +10,6 @@ // assumes_read_preference_unchanged, // assumes_unsharded_collection, // does_not_support_stepdowns, -// sbe_incompatible, // ] (function() { var coll = db.jstests_plan_cache_shell_helpers; diff --git a/jstests/core/plan_cache_stats_shard_and_host.js b/jstests/core/plan_cache_stats_shard_and_host.js index b96c47134e9..155ae113762 100644 --- a/jstests/core/plan_cache_stats_shard_and_host.js +++ b/jstests/core/plan_cache_stats_shard_and_host.js @@ -1,6 +1,7 @@ // Tests that the $planCacheStats aggregation metadata source returns the "shard" and "host" field // for each plan cache entry when appropriate. // +// TODO SERVER-50737: remove sbe_incompatible tag // @tags: [ // assumes_balancer_off, // assumes_read_concern_unchanged, diff --git a/jstests/core/profile_agg.js b/jstests/core/profile_agg.js index 9eed6e1687f..be2a5994a9e 100644 --- a/jstests/core/profile_agg.js +++ b/jstests/core/profile_agg.js @@ -1,3 +1,4 @@ +// TODO SERVER-50737: remove sbe_incompatible tag // @tags: [ // does_not_support_stepdowns, // requires_profiling, diff --git a/jstests/core/profile_distinct.js b/jstests/core/profile_distinct.js index 43ed5a2ae54..73f7eaa304f 100644 --- a/jstests/core/profile_distinct.js +++ b/jstests/core/profile_distinct.js @@ -1,3 +1,4 @@ +// TODO SERVER-50737: remove sbe_incompatible tag // @tags: [ // does_not_support_stepdowns, // requires_profiling, diff --git a/jstests/core/profile_find.js b/jstests/core/profile_find.js index 326cbd40f71..f9ca638f37e 100644 --- a/jstests/core/profile_find.js +++ b/jstests/core/profile_find.js @@ -1,3 +1,4 @@ +// TODO SERVER-50737: remove sbe_incompatible tag // @tags: [ // does_not_support_stepdowns, // requires_profiling, diff --git a/jstests/core/profile_query_hash.js b/jstests/core/profile_query_hash.js index 6a5484eb3bf..51b00d55996 100644 --- a/jstests/core/profile_query_hash.js +++ b/jstests/core/profile_query_hash.js @@ -5,7 +5,6 @@ // assumes_read_concern_unchanged, // does_not_support_stepdowns, // requires_profiling, -// sbe_incompatible, // ] (function() { "use strict"; diff --git a/jstests/core/projection_meta_index_key.js b/jstests/core/projection_meta_index_key.js index cff12d31721..01f6d3c7876 100644 --- a/jstests/core/projection_meta_index_key.js +++ b/jstests/core/projection_meta_index_key.js @@ -1,8 +1,5 @@ // Test that indexKey $meta projection works in find and aggregate commands and produces correct // result depending on whether index key metadata is available or not. -// @tags: [ -// sbe_incompatible, -// ] (function() { "use strict"; diff --git a/jstests/core/recursion.js b/jstests/core/recursion.js index 9a05bdcf9c9..32e4547fb75 100644 --- a/jstests/core/recursion.js +++ b/jstests/core/recursion.js @@ -4,7 +4,6 @@ // @tags: [ // does_not_support_stepdowns, // requires_non_retryable_commands, -// sbe_incompatible, // uses_map_reduce_with_temp_collections, // ] diff --git a/jstests/core/ref.js b/jstests/core/ref.js index d89eafab7d0..0d1160482fc 100644 --- a/jstests/core/ref.js +++ b/jstests/core/ref.js @@ -1,9 +1,3 @@ -// to run: -// ./mongo jstests/ref.js -// @tags: [ -// sbe_incompatible, -// ] - db.otherthings.drop(); db.things.drop(); diff --git a/jstests/core/regex3.js b/jstests/core/regex3.js index 158d0607647..986176679e5 100644 --- a/jstests/core/regex3.js +++ b/jstests/core/regex3.js @@ -1,3 +1,4 @@ +// TODO SERVER-52734: remove sbe_incompatible tag // @tags: [ // assumes_balancer_off, // sbe_incompatible, diff --git a/jstests/core/regex4.js b/jstests/core/regex4.js index 0e631082352..178f859e666 100644 --- a/jstests/core/regex4.js +++ b/jstests/core/regex4.js @@ -1,3 +1,4 @@ +// TODO SERVER-52734: remove sbe_incompatible tag // @tags: [ // assumes_balancer_off, // sbe_incompatible, diff --git a/jstests/core/regex6.js b/jstests/core/regex6.js index f21152d8c55..c35261762e0 100644 --- a/jstests/core/regex6.js +++ b/jstests/core/regex6.js @@ -1,6 +1,7 @@ // contributed by Andrew Kempe // This test makes assertions about how many keys are examined during query execution, which can // change depending on whether/how many documents are filtered out by the SHARDING_FILTER stage. +// TODO SERVER-52734: remove sbe_incompatible tag // @tags: [ // assumes_unsharded_collection, // sbe_incompatible, diff --git a/jstests/core/regex8.js b/jstests/core/regex8.js index d65a6836b26..af16a7f4ea0 100644 --- a/jstests/core/regex8.js +++ b/jstests/core/regex8.js @@ -1,5 +1,6 @@ /** + * TODO SERVER-52734: remove sbe_incompatible tag * @tags: [ * sbe_incompatible, * ] diff --git a/jstests/core/regexc.js b/jstests/core/regexc.js index e9e2ba613aa..7bd832a1254 100644 --- a/jstests/core/regexc.js +++ b/jstests/core/regexc.js @@ -1,4 +1,5 @@ // Multiple regular expressions using the same index +// TODO SERVER-52734: remove sbe_incompatible tag // @tags: [ // sbe_incompatible, // ] diff --git a/jstests/core/remove9.js b/jstests/core/remove9.js index 4962dd9a06f..0cded02cc2e 100644 --- a/jstests/core/remove9.js +++ b/jstests/core/remove9.js @@ -1,3 +1,4 @@ +// TODO SERVER-52734: remove sbe_incompatible tag // @tags: [ // requires_getmore, // requires_non_retryable_writes, diff --git a/jstests/core/rename_change_target_type.js b/jstests/core/rename_change_target_type.js index 4f210b72e67..a88759b0b65 100644 --- a/jstests/core/rename_change_target_type.js +++ b/jstests/core/rename_change_target_type.js @@ -1,8 +1,5 @@ // Test that a rename that overwrites its destination with an equivalent value of a different type // updates the type of the destination (SERVER-32109). -// @tags: [ -// sbe_incompatible, -// ] (function() { "use strict"; diff --git a/jstests/core/return_key.js b/jstests/core/return_key.js index 96c6284ebf4..58c48360597 100644 --- a/jstests/core/return_key.js +++ b/jstests/core/return_key.js @@ -3,7 +3,6 @@ // order to apply the SHARDING_FILTER stage. // @tags: [ // assumes_unsharded_collection, -// sbe_incompatible, // ] /** diff --git a/jstests/core/sample_rate.js b/jstests/core/sample_rate.js index 390606f1332..93c1e2f9d7d 100644 --- a/jstests/core/sample_rate.js +++ b/jstests/core/sample_rate.js @@ -2,7 +2,6 @@ * Test the $sampleRate match expression. * @tags: [ * requires_fcv_47, - * sbe_incompatible, * ] */ (function() { diff --git a/jstests/core/show_record_id.js b/jstests/core/show_record_id.js index 0f2df332354..3af12d74d61 100644 --- a/jstests/core/show_record_id.js +++ b/jstests/core/show_record_id.js @@ -1,6 +1,5 @@ // @tags: [ // requires_getmore, -// sbe_incompatible, // ] // Sanity check for the showRecordId option. diff --git a/jstests/core/single_field_hashed_index.js b/jstests/core/single_field_hashed_index.js index 1b5633adf18..010abf07da6 100644 --- a/jstests/core/single_field_hashed_index.js +++ b/jstests/core/single_field_hashed_index.js @@ -49,27 +49,27 @@ assert.eq(t.find({a: 3.1}).hint(indexSpec).toArray()[0].a, 3.1); // Make sure we're using the hashed index. let explain = t.find({a: 1}).explain(); -assert(isIxscan(db, explain.queryPlanner.winningPlan), "not using hashed index"); +assert(isIxscan(db, getWinningPlan(explain.queryPlanner)), "not using hashed index"); explain = t.find({c: 1}).explain(); -assert(!isIxscan(db, explain.queryPlanner.winningPlan), "using irrelevant hashed index"); +assert(!isIxscan(db, getWinningPlan(explain.queryPlanner)), "using irrelevant hashed index"); // Hash index used with a $in set membership predicate. explain = t.find({a: {$in: [1, 2]}}).explain(); printjson(explain); -assert(isIxscan(db, explain.queryPlanner.winningPlan), "not using hashed index"); +assert(isIxscan(db, getWinningPlan(explain.queryPlanner)), "not using hashed index"); // Hash index used with a singleton $and predicate conjunction. explain = t.find({$and: [{a: 1}]}).explain(); -assert(isIxscan(db, explain.queryPlanner.winningPlan), "not using hashed index"); +assert(isIxscan(db, getWinningPlan(explain.queryPlanner)), "not using hashed index"); // Hash index used with a non singleton $and predicate conjunction. explain = t.find({$and: [{a: {$in: [1, 2]}}, {a: {$gt: 1}}]}).explain(); -assert(isIxscan(db, explain.queryPlanner.winningPlan), "not using hashed index"); +assert(isIxscan(db, getWinningPlan(explain.queryPlanner)), "not using hashed index"); // Non-sparse hashed index can be used to satisfy {$exists: false}. explain = t.find({a: {$exists: false}}).explain(); -assert(isIxscan(db, explain.queryPlanner.winningPlan), explain); +assert(isIxscan(db, getWinningPlan(explain.queryPlanner)), explain); // Test creation of index based on hash of _id index. const indexSpec2 = { @@ -92,7 +92,7 @@ assert.eq(t.getIndexes().length, 4, "sparse index didn't get created"); // Sparse hashed indexes cannot be used to satisfy {$exists: false}. explain = t.find({b: {$exists: false}}).explain(); -assert(!isIxscan(db, explain.queryPlanner.winningPlan), explain); +assert(!isIxscan(db, getWinningPlan(explain.queryPlanner)), explain); // Test sparse index has smaller total items on after inserts. for (let i = 0; i < 10; i++) { @@ -115,4 +115,4 @@ assert.commandFailedWithCode(t.insert({field1: [{field2: {0: []}}]}), 16766); assert.commandFailedWithCode(t.insert({field1: {field2: {0: {field4: []}}}}), 16766); assert.commandWorked(t.insert({field1: {field2: {0: {otherField: []}}}})); assert.commandWorked(t.insert({field1: {field2: {0: {field4: 1}}}})); -})();
\ No newline at end of file +})(); diff --git a/jstests/core/sort5.js b/jstests/core/sort5.js index be40802ade4..88c48b3f66c 100644 --- a/jstests/core/sort5.js +++ b/jstests/core/sort5.js @@ -1,3 +1,8 @@ +// test compound sorting +// TODO SERVER-50370: remove sbe_incompatible tag +// @tags: [ +// sbe_incompatible, +// ] var t = db.sort5; t.drop(); @@ -6,11 +11,6 @@ t.save({_id: 7, x: 2, y: {a: 7, b: 3}}); t.save({_id: 2, x: 3, y: {a: 2, b: 3}}); t.save({_id: 9, x: 4, y: {a: 9, b: 3}}); -// test compound sorting -// @tags: [ -// sbe_incompatible, -// ] - assert.eq([4, 2, 3, 1], t.find().sort({"y.b": 1, "y.a": -1}).map(function(z) { return z.x; diff --git a/jstests/core/sort9.js b/jstests/core/sort9.js index 1cc514e970c..10065564eb4 100644 --- a/jstests/core/sort9.js +++ b/jstests/core/sort9.js @@ -1,4 +1,5 @@ // Unindexed array sorting SERVER-2884 +// TODO SERVER-50370: remove sbe_incompatible tag // @tags: [ // sbe_incompatible, // ] diff --git a/jstests/core/sort_array.js b/jstests/core/sort_array.js index 3b260163880..fccfe744a71 100644 --- a/jstests/core/sort_array.js +++ b/jstests/core/sort_array.js @@ -1,7 +1,6 @@ // @tags: [ // does_not_support_stepdowns, // requires_non_retryable_writes, -// sbe_incompatible, // ] /** diff --git a/jstests/core/sort_with_meta_operator.js b/jstests/core/sort_with_meta_operator.js index 30f17b8f84a..333de73a975 100644 --- a/jstests/core/sort_with_meta_operator.js +++ b/jstests/core/sort_with_meta_operator.js @@ -1,7 +1,4 @@ // Tests to validate the input for sort on '$meta' operator. -// @tags: [ -// sbe_incompatible, -// ] (function() { "use strict"; const coll = db.sort_with_meta_operator; @@ -60,4 +57,4 @@ assert.eq(coll.aggregate([{$sort: {p: {$meta: 'randVal'}, _id: {$meta: 'randVal' // Should still sort on the prefix 'p' when the later part is being sorted with 'randVal'. assert.eq(coll.aggregate([{$sort: {p: 1, _id: {$meta: 'randVal'}}}]).toArray(), [{_id: -1, p: -2}, {_id: -2, p: -1}, {_id: 1, p: 1}, {_id: 2, p: 2}]); -})();
\ No newline at end of file +})(); diff --git a/jstests/core/sortf.js b/jstests/core/sortf.js index adb54f38b9c..47c6a27ed9f 100644 --- a/jstests/core/sortf.js +++ b/jstests/core/sortf.js @@ -1,6 +1,5 @@ // @tags: [ // requires_getmore, -// sbe_incompatible, // ] // Unsorted plan on {a:1}, sorted plan on {b:1}. The unsorted plan exhausts its memory limit before diff --git a/jstests/core/sorth.js b/jstests/core/sorth.js index db1187eb0ec..81568dfeb29 100644 --- a/jstests/core/sorth.js +++ b/jstests/core/sorth.js @@ -1,5 +1,4 @@ // Tests for the $in/sort/limit optimization combined with inequality bounds. SERVER-5777 - (function() { "use strict"; diff --git a/jstests/core/sortl.js b/jstests/core/sortl.js index 7993c1e1220..23c2673b135 100644 --- a/jstests/core/sortl.js +++ b/jstests/core/sortl.js @@ -1,8 +1,5 @@ // Tests equality query on _id with a sort, intended to be tested on both mongos and mongod. For // SERVER-20641. -// @tags: [ -// sbe_incompatible, -// ] (function() { 'use strict'; diff --git a/jstests/core/sparse_index_supports_ne_null.js b/jstests/core/sparse_index_supports_ne_null.js index 0575418c757..433850341e0 100644 --- a/jstests/core/sparse_index_supports_ne_null.js +++ b/jstests/core/sparse_index_supports_ne_null.js @@ -19,7 +19,7 @@ coll.drop(); function checkQuery({query, shouldUseIndex, nResultsExpected, indexKeyPattern}) { const explain = assert.commandWorked(coll.find(query).explain()); - const ixScans = getPlanStages(explain.queryPlanner.winningPlan, "IXSCAN"); + const ixScans = getPlanStages(getWinningPlan(explain.queryPlanner), "IXSCAN"); if (shouldUseIndex) { assert.gte(ixScans.length, 1, explain); diff --git a/jstests/core/system_js_access.js b/jstests/core/system_js_access.js index 9395f98c238..2ca0e182a73 100644 --- a/jstests/core/system_js_access.js +++ b/jstests/core/system_js_access.js @@ -2,7 +2,6 @@ // @tags: [ // assumes_unsharded_collection, // requires_non_retryable_writes, -// sbe_incompatible, // ] (function() { diff --git a/jstests/core/text_covered_matching.js b/jstests/core/text_covered_matching.js index ffab962ea69..dec81c04323 100644 --- a/jstests/core/text_covered_matching.js +++ b/jstests/core/text_covered_matching.js @@ -36,7 +36,7 @@ assert.commandWorked(coll.insert({a: "hello world", b: 3, c: 3})); // - we return exactly one document. let explainResult = coll.find({$text: {$search: "hello"}, b: 1}).explain("executionStats"); assert.commandWorked(explainResult); -assert(planHasStage(db, explainResult.queryPlanner.winningPlan, "OR")); +assert(planHasStage(db, getWinningPlan(explainResult.queryPlanner), "OR")); assert.eq(explainResult.executionStats.totalKeysExamined, 2, "Unexpected number of keys examined: " + tojson(explainResult)); @@ -53,7 +53,7 @@ explainResult = coll.find({$text: {$search: "hello"}, b: 1}, {a: 1, b: 1, c: 1, textScore: {$meta: "textScore"}}) .explain("executionStats"); assert.commandWorked(explainResult); -assert(planHasStage(db, explainResult.queryPlanner.winningPlan, "TEXT_OR")); +assert(planHasStage(db, getWinningPlan(explainResult.queryPlanner), "TEXT_OR")); assert.eq(explainResult.executionStats.totalKeysExamined, 2, "Unexpected number of keys examined: " + tojson(explainResult)); @@ -76,7 +76,7 @@ assert.eq(explainResult.executionStats.nReturned, // - we return exactly one document. explainResult = coll.find({$text: {$search: "hello"}, c: 1}).explain("executionStats"); assert.commandWorked(explainResult); -assert(planHasStage(db, explainResult.queryPlanner.winningPlan, "OR")); +assert(planHasStage(db, getWinningPlan(explainResult.queryPlanner), "OR")); assert.eq(explainResult.executionStats.totalKeysExamined, 2, "Unexpected number of keys examined: " + tojson(explainResult)); @@ -121,7 +121,7 @@ assert.commandWorked(coll.insert({a: "hello world", b: {d: 3}, c: {e: 3}})); // - we return exactly one document. explainResult = coll.find({$text: {$search: "hello"}, "b.d": 1}).explain("executionStats"); assert.commandWorked(explainResult); -assert(planHasStage(db, explainResult.queryPlanner.winningPlan, "OR")); +assert(planHasStage(db, getWinningPlan(explainResult.queryPlanner), "OR")); assert.eq(explainResult.executionStats.totalKeysExamined, 2, "Unexpected number of keys examined: " + tojson(explainResult)); @@ -138,7 +138,7 @@ explainResult = coll.find({$text: {$search: "hello"}, "b.d": 1}, {a: 1, b: 1, c: 1, textScore: {$meta: "textScore"}}) .explain("executionStats"); assert.commandWorked(explainResult); -assert(planHasStage(db, explainResult.queryPlanner.winningPlan, "TEXT_OR")); +assert(planHasStage(db, getWinningPlan(explainResult.queryPlanner), "TEXT_OR")); assert.eq(explainResult.executionStats.totalKeysExamined, 2, "Unexpected number of keys examined: " + tojson(explainResult)); @@ -161,7 +161,7 @@ assert.eq(explainResult.executionStats.nReturned, // - we return exactly one document. explainResult = coll.find({$text: {$search: "hello"}, "c.e": 1}).explain("executionStats"); assert.commandWorked(explainResult); -assert(planHasStage(db, explainResult.queryPlanner.winningPlan, "OR")); +assert(planHasStage(db, getWinningPlan(explainResult.queryPlanner), "OR")); assert.eq(explainResult.executionStats.totalKeysExamined, 2, "Unexpected number of keys examined: " + tojson(explainResult)); diff --git a/jstests/core/txns/commands_not_allowed_in_txn.js b/jstests/core/txns/commands_not_allowed_in_txn.js index 256228e7d27..0231162e284 100644 --- a/jstests/core/txns/commands_not_allowed_in_txn.js +++ b/jstests/core/txns/commands_not_allowed_in_txn.js @@ -1,6 +1,5 @@ // Test commands that are not allowed in multi-document transactions. // @tags: [ -// sbe_incompatible, // uses_snapshot_read_concern, // uses_transactions, // ] diff --git a/jstests/core/type3.js b/jstests/core/type3.js index 1b57e9bb989..8b4858662dd 100644 --- a/jstests/core/type3.js +++ b/jstests/core/type3.js @@ -1,6 +1,5 @@ // @tags: [ // requires_non_retryable_writes, -// sbe_incompatible, // ] // Check query type bracketing SERVER-3222 diff --git a/jstests/core/type_array.js b/jstests/core/type_array.js index b1d1f639844..a10820729a6 100644 --- a/jstests/core/type_array.js +++ b/jstests/core/type_array.js @@ -1,3 +1,4 @@ +// TODO SERVER-49852: remove sbe_incompatible tag // @tags: [ // requires_non_retryable_writes, // sbe_incompatible, diff --git a/jstests/core/update6.js b/jstests/core/update6.js index 644855c6742..8a1950b8d02 100644 --- a/jstests/core/update6.js +++ b/jstests/core/update6.js @@ -3,7 +3,6 @@ // key. // @tags: [ // assumes_unsharded_collection, -// sbe_incompatible, // ] t = db.update6; diff --git a/jstests/core/update_arraymatch8.js b/jstests/core/update_arraymatch8.js index 88b9d3374e8..aa2e840b255 100644 --- a/jstests/core/update_arraymatch8.js +++ b/jstests/core/update_arraymatch8.js @@ -1,6 +1,7 @@ // Cannot implicitly shard accessed collections because of following errmsg: A single // update/delete on a sharded collection must contain an exact match on _id or contain the shard // key. +// TODO SERVER-49852: remove sbe_incompatible tag // @tags: [ // assumes_unsharded_collection, // sbe_incompatible, diff --git a/jstests/core/views/dbref_projection.js b/jstests/core/views/dbref_projection.js index f77cf8ded3d..1aa828c3807 100644 --- a/jstests/core/views/dbref_projection.js +++ b/jstests/core/views/dbref_projection.js @@ -4,7 +4,6 @@ * Legacy find() queries do not support views, so must use the find() command. * @tags: [ * requires_find_command, - * sbe_incompatible, * ] */ (function() { diff --git a/jstests/core/views/views_aggregation.js b/jstests/core/views/views_aggregation.js index 0921dc56cdc..f95d855ff01 100644 --- a/jstests/core/views/views_aggregation.js +++ b/jstests/core/views/views_aggregation.js @@ -6,7 +6,6 @@ * requires_find_command, * requires_getmore, * requires_non_retryable_commands, - * sbe_incompatible, * uses_$out, * ] */ diff --git a/jstests/core/views/views_all_commands.js b/jstests/core/views/views_all_commands.js index eb40cafa2a4..93d1843d40d 100644 --- a/jstests/core/views/views_all_commands.js +++ b/jstests/core/views/views_all_commands.js @@ -6,7 +6,6 @@ // requires_getmore, // requires_non_retryable_commands, // requires_non_retryable_writes, -// sbe_incompatible, // uses_map_reduce_with_temp_collections, // ] diff --git a/jstests/core/views/views_collation.js b/jstests/core/views/views_collation.js index accea6dcfae..13e501c920c 100644 --- a/jstests/core/views/views_collation.js +++ b/jstests/core/views/views_collation.js @@ -2,7 +2,6 @@ // does_not_support_stepdowns, // requires_fastcount, // requires_non_retryable_commands, -// sbe_incompatible, // ] /** diff --git a/jstests/core/views/views_count.js b/jstests/core/views/views_count.js index 5b8777feadf..0cdaad0eb46 100644 --- a/jstests/core/views/views_count.js +++ b/jstests/core/views/views_count.js @@ -2,7 +2,6 @@ // // @tags: [ // requires_fastcount, -// sbe_incompatible, // ] (function() { diff --git a/jstests/core/views/views_distinct.js b/jstests/core/views/views_distinct.js index fd9ba5830f0..0f25ac3beb1 100644 --- a/jstests/core/views/views_distinct.js +++ b/jstests/core/views/views_distinct.js @@ -1,7 +1,4 @@ // Test the distinct command with views. -// @tags: [ -// sbe_incompatible, -// ] (function() { "use strict"; diff --git a/jstests/core/wildcard_and_text_indexes.js b/jstests/core/wildcard_and_text_indexes.js index 9f77db13a00..5fa3d0520a2 100644 --- a/jstests/core/wildcard_and_text_indexes.js +++ b/jstests/core/wildcard_and_text_indexes.js @@ -2,7 +2,6 @@ * Tests that a {$**: 1} index can coexist with a {$**: 'text'} index in the same collection. * @tags: [ * assumes_balancer_off, - * sbe_incompatible, * ] */ (function() { @@ -23,7 +22,7 @@ coll.drop(); function assertWildcardQuery(query, expectedPath) { // Explain the query, and determine whether an indexed solution is available. const explainOutput = coll.find(query).explain("executionStats"); - const ixScans = getPlanStages(explainOutput.queryPlanner.winningPlan, "IXSCAN"); + const ixScans = getPlanStages(getWinningPlan(explainOutput.queryPlanner), "IXSCAN"); // Verify that the winning plan uses the $** index with the expected path. assert.eq(ixScans.length, FixtureHelpers.numberOfShardsForCollection(coll)); assert.docEq(ixScans[0].keyPattern, {"$_path": 1, [expectedPath]: 1}); @@ -53,7 +52,7 @@ for (let textIndex of [{'$**': 'text'}, {a: 1, '$**': 'text'}]) { // when the query filter contains a compound field in the $text index. const textQuery = Object.assign(textIndex.a ? {a: 1} : {}, {$text: {$search: 'banana'}}); let explainOut = assert.commandWorked(coll.find(textQuery).explain("executionStats")); - assert(planHasStage(coll.getDB(), explainOut.queryPlanner.winningPlan, "TEXT")); + assert(planHasStage(coll.getDB(), getWinningPlan(explainOut.queryPlanner), "TEXT")); assert.eq(getRejectedPlans(explainOut).length, 0); assert.eq(explainOut.executionStats.nReturned, 2); @@ -61,7 +60,7 @@ for (let textIndex of [{'$**': 'text'}, {a: 1, '$**': 'text'}]) { // where the query filter contains a field which is not present in the text index. explainOut = assert.commandWorked( coll.find(Object.assign({_fts: {$gt: 0, $lt: 4}}, textQuery)).explain("executionStats")); - assert(planHasStage(coll.getDB(), explainOut.queryPlanner.winningPlan, "TEXT")); + assert(planHasStage(coll.getDB(), getWinningPlan(explainOut.queryPlanner), "TEXT")); assert.eq(getRejectedPlans(explainOut).length, 0); assert.eq(explainOut.executionStats.nReturned, 2); @@ -71,7 +70,7 @@ for (let textIndex of [{'$**': 'text'}, {a: 1, '$**': 'text'}]) { assert.eq(getRejectedPlans(explainOut).length, 0); assert.eq(explainOut.executionStats.nReturned, 3); - const textOrWildcard = getPlanStages(explainOut.queryPlanner.winningPlan, "OR").shift(); + const textOrWildcard = getPlanStages(getWinningPlan(explainOut.queryPlanner), "OR").shift(); assert.eq(textOrWildcard.inputStages.length, 2); const textBranch = (textOrWildcard.inputStages[0].stage === "TEXT" ? 0 : 1); const wildcardBranch = (textBranch + 1) % 2; diff --git a/jstests/core/wildcard_index_basic_index_bounds.js b/jstests/core/wildcard_index_basic_index_bounds.js index 632b8a6b0eb..88e5b7eed52 100644 --- a/jstests/core/wildcard_index_basic_index_bounds.js +++ b/jstests/core/wildcard_index_basic_index_bounds.js @@ -7,7 +7,6 @@ * @tags: [ * assumes_balancer_off, * does_not_support_stepdowns, - * sbe_incompatible, * ] */ (function() { @@ -121,7 +120,7 @@ function runWildcardIndexTest(keyPattern, pathProjection, expectedPaths) { // Explain the query, and determine whether an indexed solution is available. const ixScans = - getPlanStages(coll.find(query).explain().queryPlanner.winningPlan, "IXSCAN"); + getPlanStages(getWinningPlan(coll.find(query).explain().queryPlanner), "IXSCAN"); // If we expect the current path to have been excluded based on the $** keyPattern // and projection, or if the current operation is not supported by $** indexes, @@ -161,7 +160,7 @@ function runWildcardIndexTest(keyPattern, pathProjection, expectedPaths) { const explainedOr = assert.commandWorked(coll.find({$or: multiFieldPreds}).explain()); // Obtain the list of index bounds from each individual IXSCAN stage across all shards. - const ixScanBounds = getPlanStages(explainedOr.queryPlanner.winningPlan, "IXSCAN") + const ixScanBounds = getPlanStages(getWinningPlan(explainedOr.queryPlanner), "IXSCAN") .map(elem => elem.indexBounds); // We should find that each branch of the $or has used a separate $** sub-index. In the @@ -180,15 +179,16 @@ function runWildcardIndexTest(keyPattern, pathProjection, expectedPaths) { // Perform an $and for this operation across all indexed fields; for instance: // {$and: [{a: {$gte: 50}}, {'b.c': {$gte: 50}}, {'b.d.e': {$gte: 50}}]}. const explainedAnd = coll.find({$and: multiFieldPreds}).explain(); - const winningIxScan = getPlanStages(explainedAnd.queryPlanner.winningPlan, "IXSCAN"); + const winningIxScan = getPlanStages(getWinningPlan(explainedAnd.queryPlanner), "IXSCAN"); // Extract information about the rejected plans. We should have one IXSCAN for each $** // candidate that wasn't the winner. Before SERVER-36521 banned them for $** indexes, a // number of AND_SORTED plans would also be generated here; we search for these in order // to verify that no such plans now exist. - const rejectedPlans = getRejectedPlans(explainedAnd); let rejectedIxScans = [], rejectedAndSorted = []; + const rejectedPlans = getRejectedPlans(explainedAnd); for (let rejectedPlan of rejectedPlans) { + rejectedPlan = getRejectedPlan(rejectedPlan); rejectedAndSorted = rejectedAndSorted.concat(getPlanStages(rejectedPlan, "AND_SORTED")); rejectedIxScans = rejectedIxScans.concat(getPlanStages(rejectedPlan, "IXSCAN")); } diff --git a/jstests/core/wildcard_index_count.js b/jstests/core/wildcard_index_count.js index 9ef64482f5d..36c12897bb1 100644 --- a/jstests/core/wildcard_index_count.js +++ b/jstests/core/wildcard_index_count.js @@ -7,7 +7,6 @@ // @tags: [ // assumes_unsharded_collection, // does_not_support_stepdowns, -// sbe_incompatible, // ] (function() { "use strict"; diff --git a/jstests/core/wildcard_index_covered_queries.js b/jstests/core/wildcard_index_covered_queries.js index eae1a14d6cb..96741b737e3 100644 --- a/jstests/core/wildcard_index_covered_queries.js +++ b/jstests/core/wildcard_index_covered_queries.js @@ -30,7 +30,7 @@ function assertWildcardProvidesCoveredSolution(query, proj, shouldFailToCover = // Obtain the explain output for the given query and projection. We run the explain with // 'executionStats' so that we can subsequently validate the number of documents examined. const explainOut = assert.commandWorked(coll.find(query, proj).explain("executionStats")); - const winningPlan = explainOut.queryPlanner.winningPlan; + const winningPlan = getWinningPlan(explainOut.queryPlanner); // Verify that the $** index provided the winning solution for this query. const ixScans = getPlanStages(winningPlan, "IXSCAN"); diff --git a/jstests/core/wildcard_index_distinct_scan.js b/jstests/core/wildcard_index_distinct_scan.js index 6c29e0867a2..1d86becf231 100644 --- a/jstests/core/wildcard_index_distinct_scan.js +++ b/jstests/core/wildcard_index_distinct_scan.js @@ -1,8 +1,5 @@ /** * Tests that a $** index can provide a DISTINCT_SCAN or indexed solution where appropriate. - * @tags: [ - * sbe_incompatible, - * ] */ (function() { "use strict"; @@ -46,7 +43,7 @@ function assertWildcardDistinctScan( assert.commandWorked(coll.dropIndexes()); // Confirm that the distinct runs with a COLLSCAN. - let winningPlan = coll.explain().distinct(distinctKey, query).queryPlanner.winningPlan; + let winningPlan = getWinningPlan(coll.explain().distinct(distinctKey, query).queryPlanner); assert(planHasStage(coll.getDB(), winningPlan, "COLLSCAN")); // Run the distinct and confirm that it produces the expected results. assertArrayEq(coll.distinct(distinctKey, query), expectedResults); @@ -65,7 +62,7 @@ function assertWildcardDistinctScan( // Explain the query, and determine whether an indexed solution is available. If // 'expectedPath' is null, then we do not expect the $** index to provide a plan. - winningPlan = coll.explain().distinct(distinctKey, query).queryPlanner.winningPlan; + winningPlan = getWinningPlan(coll.explain().distinct(distinctKey, query).queryPlanner); if (!expectedPath) { assert(planHasStage(coll.getDB(), winningPlan, "COLLSCAN")); assert.eq(expectedScanType, "COLLSCAN"); diff --git a/jstests/core/wildcard_index_multikey.js b/jstests/core/wildcard_index_multikey.js index 2ef2fa6da45..b55565f783e 100644 --- a/jstests/core/wildcard_index_multikey.js +++ b/jstests/core/wildcard_index_multikey.js @@ -97,11 +97,11 @@ function assertWildcardQuery(query, expectedPath, explainStats = {}) { // If we expect the current path to have been excluded based on the $** keyPattern // or projection, confirm that no indexed solution was found. if (!expectedPath) { - assert.gt(getPlanStages(explainOutput.queryPlanner.winningPlan, "COLLSCAN").length, 0); + assert.gt(getPlanStages(getWinningPlan(explainOutput.queryPlanner), "COLLSCAN").length, 0); return; } // Verify that the winning plan uses the $** index with the expected path. - const ixScans = getPlanStages(explainOutput.queryPlanner.winningPlan, "IXSCAN"); + const ixScans = getPlanStages(getWinningPlan(explainOutput.queryPlanner), "IXSCAN"); assert.eq(ixScans.length, FixtureHelpers.numberOfShardsForCollection(coll)); assert.docEq(ixScans[0].keyPattern, {"$_path": 1, [expectedPath]: 1}); // Verify that the results obtained from the $** index are identical to a COLLSCAN. @@ -236,7 +236,7 @@ const trimTestExplain = coll.find(trimTestQuery).explain("executionStats"); // Verify that the expected number of documents were matched, and the $** index was used. // Matched documents: [_id:2, _id:3, _id:5, _id:6] assert.eq(trimTestExplain.executionStats.nReturned, 4); -const trimTestIxScans = getPlanStages(trimTestExplain.queryPlanner.winningPlan, "IXSCAN"); +const trimTestIxScans = getPlanStages(getWinningPlan(trimTestExplain.queryPlanner), "IXSCAN"); for (let ixScan of trimTestIxScans) { assert.eq(ixScan.keyPattern["$_path"], 1); } diff --git a/jstests/core/wildcard_index_nonblocking_sort.js b/jstests/core/wildcard_index_nonblocking_sort.js index 18d5f120e16..7261378728d 100644 --- a/jstests/core/wildcard_index_nonblocking_sort.js +++ b/jstests/core/wildcard_index_nonblocking_sort.js @@ -26,7 +26,7 @@ function checkQueryHasSameResultsWhenUsingIdIndex(query, sort, projection) { function checkQueryUsesSortType(query, sort, projection, isBlocking) { const explain = assert.commandWorked(coll.find(query, projection).sort(sort).explain()); - const plan = explain.queryPlanner.winningPlan; + const plan = getWinningPlan(explain.queryPlanner); const ixScans = getPlanStages(plan, "IXSCAN"); const sorts = getPlanStages(plan, "SORT"); diff --git a/jstests/core/wildcard_index_partial_index.js b/jstests/core/wildcard_index_partial_index.js index 730c3997051..55332fb583c 100644 --- a/jstests/core/wildcard_index_partial_index.js +++ b/jstests/core/wildcard_index_partial_index.js @@ -21,26 +21,26 @@ function testPartialWildcardIndex(indexKeyPattern, indexOptions) { // find() operations that should use the index. let explain = coll.explain("executionStats").find({x: 6, a: 1}).finish(); assert.eq(1, explain.executionStats.nReturned); - assert(isIxscan(db, explain.queryPlanner.winningPlan)); + assert(isIxscan(db, getWinningPlan(explain.queryPlanner))); explain = coll.explain("executionStats").find({x: {$gt: 1}, a: 1}).finish(); assert.eq(1, explain.executionStats.nReturned); - assert(isIxscan(db, explain.queryPlanner.winningPlan)); + assert(isIxscan(db, getWinningPlan(explain.queryPlanner))); explain = coll.explain("executionStats").find({x: 6, a: {$lte: 1}}).finish(); assert.eq(1, explain.executionStats.nReturned); - assert(isIxscan(db, explain.queryPlanner.winningPlan)); + assert(isIxscan(db, getWinningPlan(explain.queryPlanner))); // find() operations that should not use the index. explain = coll.explain("executionStats").find({x: 6, a: {$lt: 1.6}}).finish(); assert.eq(1, explain.executionStats.nReturned); - assert(isCollscan(db, explain.queryPlanner.winningPlan)); + assert(isCollscan(db, getWinningPlan(explain.queryPlanner))); explain = coll.explain("executionStats").find({x: 6}).finish(); assert.eq(1, explain.executionStats.nReturned); - assert(isCollscan(db, explain.queryPlanner.winningPlan)); + assert(isCollscan(db, getWinningPlan(explain.queryPlanner))); explain = coll.explain("executionStats").find({a: {$gte: 0}}).finish(); assert.eq(2, explain.executionStats.nReturned); - assert(isCollscan(db, explain.queryPlanner.winningPlan)); + assert(isCollscan(db, getWinningPlan(explain.queryPlanner))); } // Case where the partial filter expression is on a field in the index. diff --git a/jstests/core/wildcard_index_projection.js b/jstests/core/wildcard_index_projection.js index f460852165d..4ed3f7c837b 100644 --- a/jstests/core/wildcard_index_projection.js +++ b/jstests/core/wildcard_index_projection.js @@ -2,7 +2,6 @@ * Tests that a wildcard index with an exclusion projection but including _id field gets saved * properly. Exercises the fix for SERVER-52814. * @tags: [ - * sbe_incompatible, * requires_fcv_49, * ] */ @@ -11,6 +10,7 @@ "use strict"; load("jstests/libs/fixture_helpers.js"); // For isMongos. +load("jstests/libs/analyze_plan.js"); // For getRejectedPlan helper to analyze explain() output. const collName = jsTestName(); const coll = db[collName]; @@ -42,11 +42,11 @@ const plannerRes = getExplainObj(explainResFull); // For a query on _id we expect that the IDHACK plan will be selected. However, we should also // observe a rejected plan which uses the wildcard index to resolve _id. In a sharded cluster we // may also need to skip the _id: hashed index. -let indexStage = plannerRes.rejectedPlans[0].inputStage; +let indexStage = getRejectedPlan(plannerRes.rejectedPlans[0]).inputStage; if (sharded) { if (indexStage.keyPattern._id === "hashed") { assert.eq(plannerRes.rejectedPlans.length, 2, plannerRes.rejectedPlans); - indexStage = plannerRes.rejectedPlans[1].inputStage; + indexStage = getRejectedPlan(plannerRes.rejectedPlans[1]).inputStage; } } else { assert.eq(plannerRes.rejectedPlans.length, 1, plannerRes.rejectedPlans); @@ -57,7 +57,7 @@ assert.eq(indexStage.keyPattern, {"$_path": 1, "_id": 1}, indexStage); // Ensure we use the index for _id if we supply a hint. const hintExplainRes = coll.find({_id: {$eq: 1}}).hint("$**_1").explain(); -const winningPlan = getExplainObj(hintExplainRes).winningPlan; +const winningPlan = getWinningPlan(getExplainObj(hintExplainRes)); assert.eq(winningPlan.inputStage.stage, "IXSCAN", winningPlan.inputStage); assert.eq(winningPlan.inputStage.keyPattern, {$_path: 1, _id: 1}, winningPlan.inputStage); diff --git a/jstests/core/wildcard_index_type.js b/jstests/core/wildcard_index_type.js index d56cfcf8234..d9623a47ba9 100644 --- a/jstests/core/wildcard_index_type.js +++ b/jstests/core/wildcard_index_type.js @@ -1,5 +1,6 @@ /** * Test $** support for the $type operator. + * TODO SERVER-52734: remove sbe_incompatible tag * @tags: [ * sbe_incompatible, * ] diff --git a/jstests/libs/analyze_plan.js b/jstests/libs/analyze_plan.js index fda996dfe56..53159c47f88 100644 --- a/jstests/libs/analyze_plan.js +++ b/jstests/libs/analyze_plan.js @@ -16,6 +16,16 @@ function getWinningPlan(queryPlanner) { } /** + * Returns an element of explain output which represents a rejected candidate plan. + */ +function getRejectedPlan(rejectedPlan) { + // The 'queryPlan' format is used when the SBE engine is turned on. If this field is present, + // it will hold a serialized winning plan, otherwise it will be stored in the 'rejectedPlan' + // element itself. + return rejectedPlan.hasOwnProperty("queryPlan") ? rejectedPlan.queryPlan : rejectedPlan; +} + +/** * Given the root stage of explain's JSON representation of a query plan ('root'), returns all * subdocuments whose stage is 'stage'. Returns an empty array if the plan does not have the * requested stage. diff --git a/jstests/libs/sbe_assert_error_override.js b/jstests/libs/sbe_assert_error_override.js index 8dde30b3a00..3b110d1ed2d 100644 --- a/jstests/libs/sbe_assert_error_override.js +++ b/jstests/libs/sbe_assert_error_override.js @@ -32,6 +32,9 @@ const equivalentErrorCodesList = [ [16608, 4848401], [16609, 5073101], [16610, 4848403], + [16611, 5154000], + [16612, 4974202], + [16554, 4974203], [16555, 5073102], [28664, 5153400], [28680, 4903701], diff --git a/src/mongo/db/matcher/expression_parser.cpp b/src/mongo/db/matcher/expression_parser.cpp index 7ef37bc2e02..434955fcf95 100644 --- a/src/mongo/db/matcher/expression_parser.cpp +++ b/src/mongo/db/matcher/expression_parser.cpp @@ -491,7 +491,6 @@ StatusWithMatchExpression parseExpr(StringData name, if ((allowedFeatures & MatchExpressionParser::AllowedFeatures::kExpr) == 0u) { return {Status(ErrorCodes::QueryFeatureNotAllowed, "$expr is not allowed in this context")}; } - return {std::make_unique<ExprMatchExpression>( std::move(elem), expCtx, @@ -620,6 +619,10 @@ StatusWithMatchExpression parseType(StringData name, str::stream() << name << " must match at least one type")}; } + if constexpr (std::is_same_v<T, InternalSchemaTypeExpression> || + std::is_same_v<T, InternalSchemaBinDataEncryptedTypeExpression>) { + expCtx->sbeCompatible = false; + } return {std::make_unique<T>( name, std::move(typeSet.getValue()), @@ -734,7 +737,8 @@ StatusWithMatchExpression parseBitTest(StringData name, return {std::move(bitTestMatchExpression)}; } -StatusWithMatchExpression parseInternalSchemaFmod(StringData name, BSONElement elem) { +StatusWithMatchExpression parseInternalSchemaFmod( + StringData name, BSONElement elem, const boost::intrusive_ptr<ExpressionContext>& expCtx) { StringData path(name); if (elem.type() != BSONType::Array) return {ErrorCodes::BadValue, @@ -763,6 +767,7 @@ StatusWithMatchExpression parseInternalSchemaFmod(StringData name, BSONElement e return {ErrorCodes::BadValue, str::stream() << path << " has too many elements"}; } + expCtx->sbeCompatible = false; return {std::make_unique<InternalSchemaFmodMatchExpression>( name, d.numberDecimal(), r.numberDecimal())}; } @@ -785,6 +790,7 @@ StatusWithMatchExpression parseInternalSchemaRootDocEq( str::stream() << InternalSchemaRootDocEqMatchExpression::kName << " must be an object, found type " << elem.type())}; } + expCtx->sbeCompatible = false; auto rootDocEq = std::make_unique<InternalSchemaRootDocEqMatchExpression>(elem.embeddedObject()); return {std::move(rootDocEq)}; @@ -795,13 +801,14 @@ StatusWithMatchExpression parseInternalSchemaRootDocEq( * of type 'T' that gets initialized with the resulting integer. */ template <class T> -StatusWithMatchExpression parseInternalSchemaSingleIntegerArgument(StringData name, - BSONElement elem) { +StatusWithMatchExpression parseInternalSchemaSingleIntegerArgument( + StringData name, BSONElement elem, const boost::intrusive_ptr<ExpressionContext>& expCtx) { auto parsedInt = elem.parseIntegerElementToNonNegativeLong(); if (!parsedInt.isOK()) { return parsedInt.getStatus(); } + expCtx->sbeCompatible = false; return {std::make_unique<T>(name, parsedInt.getValue())}; } @@ -821,6 +828,7 @@ StatusWithMatchExpression parseTopLevelInternalSchemaSingleIntegerArgument( if (!parsedInt.isOK()) { return parsedInt.getStatus(); } + expCtx->sbeCompatible = false; return {std::make_unique<T>(parsedInt.getValue())}; } @@ -1055,6 +1063,7 @@ StatusWithMatchExpression parseInternalSchemaAllowedProperties( return properties.getStatus(); } + expCtx->sbeCompatible = false; return {std::make_unique<InternalSchemaAllowedPropertiesMatchExpression>( std::move(properties.getValue()), namePlaceholder.getValue(), @@ -1110,6 +1119,7 @@ StatusWithMatchExpression parseInternalSchemaMatchArrayIndex( return expressionWithPlaceholder.getStatus(); } + expCtx->sbeCompatible = false; return {std::make_unique<InternalSchemaMatchArrayIndexMatchExpression>( path, index.getValue(), std::move(expressionWithPlaceholder.getValue()))}; } @@ -1126,6 +1136,7 @@ StatusWithMatchExpression parseGeo(StringData name, return parseStatus; } auto operatorName = section.firstElementFieldName(); + expCtx->sbeCompatible = false; return {std::make_unique<GeoMatchExpression>( name, gq.release(), @@ -1144,6 +1155,7 @@ StatusWithMatchExpression parseGeo(StringData name, if (!status.isOK()) { return status; } + expCtx->sbeCompatible = false; return {std::make_unique<GeoNearMatchExpression>(name, nq.release(), section)}; } } @@ -1179,6 +1191,9 @@ StatusWithMatchExpression parseTreeTopLevel( temp->add(sub.getValue().release()); } + if constexpr (std::is_same_v<T, InternalSchemaXorMatchExpression>) { + expCtx->sbeCompatible = false; + } return {std::move(temp)}; } @@ -1382,6 +1397,7 @@ StatusWithMatchExpression parseInternalSchemaFixedArityArgument( ++position; } + expCtx->sbeCompatible = false; return {std::make_unique<T>(std::move(expressions))}; } @@ -1428,7 +1444,8 @@ StatusWithMatchExpression parseNot(StringData name, theAnd.release(), doc_validation_error::createAnnotation(expCtx, "$not", BSONObj()))}; } -StatusWithMatchExpression parseInternalSchemaBinDataSubType(StringData name, BSONElement e) { +StatusWithMatchExpression parseInternalSchemaBinDataSubType( + StringData name, BSONElement e, const boost::intrusive_ptr<ExpressionContext>& expCtx) { if (!e.isNumber()) { return Status(ErrorCodes::FailedToParse, str::stream() << InternalSchemaBinDataSubTypeExpression::kName @@ -1450,6 +1467,7 @@ StatusWithMatchExpression parseInternalSchemaBinDataSubType(StringData name, BSO << " value must represent BinData subtype: " << valueAsInt.getValue()); } + expCtx->sbeCompatible = false; return {std::make_unique<InternalSchemaBinDataSubTypeExpression>( name, static_cast<BinDataType>(valueAsInt.getValue()))}; } @@ -1759,16 +1777,16 @@ StatusWithMatchExpression parseSubField(const BSONObj& context, } case PathAcceptingKeyword::INTERNAL_SCHEMA_FMOD: - return parseInternalSchemaFmod(name, e); + return parseInternalSchemaFmod(name, e, expCtx); case PathAcceptingKeyword::INTERNAL_SCHEMA_MIN_ITEMS: { return parseInternalSchemaSingleIntegerArgument<InternalSchemaMinItemsMatchExpression>( - name, e); + name, e, expCtx); } case PathAcceptingKeyword::INTERNAL_SCHEMA_MAX_ITEMS: { return parseInternalSchemaSingleIntegerArgument<InternalSchemaMaxItemsMatchExpression>( - name, e); + name, e, expCtx); } case PathAcceptingKeyword::INTERNAL_SCHEMA_OBJECT_MATCH: { @@ -1786,6 +1804,7 @@ StatusWithMatchExpression parseSubField(const BSONObj& context, return parsedSubObjExpr; } + expCtx->sbeCompatible = false; return {std::make_unique<InternalSchemaObjectMatchExpression>( name, std::move(parsedSubObjExpr.getValue()), @@ -1798,17 +1817,18 @@ StatusWithMatchExpression parseSubField(const BSONObj& context, str::stream() << name << " must be a boolean of value true"}; } + expCtx->sbeCompatible = false; return {std::make_unique<InternalSchemaUniqueItemsMatchExpression>(name)}; } case PathAcceptingKeyword::INTERNAL_SCHEMA_MIN_LENGTH: { return parseInternalSchemaSingleIntegerArgument<InternalSchemaMinLengthMatchExpression>( - name, e); + name, e, expCtx); } case PathAcceptingKeyword::INTERNAL_SCHEMA_MAX_LENGTH: { return parseInternalSchemaSingleIntegerArgument<InternalSchemaMaxLengthMatchExpression>( - name, e); + name, e, expCtx); } case PathAcceptingKeyword::INTERNAL_SCHEMA_MATCH_ARRAY_INDEX: { @@ -1876,6 +1896,8 @@ StatusWithMatchExpression parseSubField(const BSONObj& context, if (!exprWithPlaceholder.isOK()) { return exprWithPlaceholder.getStatus(); } + + expCtx->sbeCompatible = false; return {std::make_unique<InternalSchemaAllElemMatchFromIndexMatchExpression>( name, parsedIndex.getValue(), std::move(exprWithPlaceholder.getValue()))}; } @@ -1885,6 +1907,7 @@ StatusWithMatchExpression parseSubField(const BSONObj& context, } case PathAcceptingKeyword::INTERNAL_SCHEMA_EQ: { + expCtx->sbeCompatible = false; return {std::make_unique<InternalSchemaEqMatchExpression>(name, e)}; } @@ -1893,7 +1916,7 @@ StatusWithMatchExpression parseSubField(const BSONObj& context, } case PathAcceptingKeyword::INTERNAL_SCHEMA_BIN_DATA_SUBTYPE: { - return parseInternalSchemaBinDataSubType(name, e); + return parseInternalSchemaBinDataSubType(name, e, expCtx); } } diff --git a/src/mongo/db/matcher/schema/json_schema_parser.cpp b/src/mongo/db/matcher/schema/json_schema_parser.cpp index ec980d71ebc..c972c05c602 100644 --- a/src/mongo/db/matcher/schema/json_schema_parser.cpp +++ b/src/mongo/db/matcher/schema/json_schema_parser.cpp @@ -1885,6 +1885,7 @@ StatusWithMatchExpression JSONSchemaParser::parse( doc_validation_error::createAnnotation(expCtx, "$jsonSchema", oldAnnotation)); } } + expCtx->sbeCompatible = false; return translation; } catch (const DBException& ex) { return {ex.toStatus()}; diff --git a/src/mongo/db/pipeline/expression.cpp b/src/mongo/db/pipeline/expression.cpp index 545be1a8a9d..4f2e60a5db1 100644 --- a/src/mongo/db/pipeline/expression.cpp +++ b/src/mongo/db/pipeline/expression.cpp @@ -1438,7 +1438,9 @@ ExpressionDateFromString::ExpressionDateFromString(ExpressionContext* const expC _timeZone(_children[1]), _format(_children[2]), _onNull(_children[3]), - _onError(_children[4]) {} + _onError(_children[4]) { + expCtx->sbeCompatible = false; +} intrusive_ptr<Expression> ExpressionDateFromString::optimize() { _dateString = _dateString->optimize(); @@ -1756,7 +1758,9 @@ ExpressionDateToString::ExpressionDateToString(ExpressionContext* const expCtx, _format(_children[0]), _date(_children[1]), _timeZone(_children[2]), - _onNull(_children[3]) {} + _onNull(_children[3]) { + expCtx->sbeCompatible = false; +} intrusive_ptr<Expression> ExpressionDateToString::optimize() { _date = _date->optimize(); @@ -2097,7 +2101,9 @@ const char* ExpressionExp::getOpName() const { ExpressionObject::ExpressionObject(ExpressionContext* const expCtx, std::vector<boost::intrusive_ptr<Expression>> _children, vector<pair<string, intrusive_ptr<Expression>&>>&& expressions) - : Expression(expCtx, std::move(_children)), _expressions(std::move(expressions)) {} + : Expression(expCtx, std::move(_children)), _expressions(std::move(expressions)) { + expCtx->sbeCompatible = false; +} boost::intrusive_ptr<ExpressionObject> ExpressionObject::create( ExpressionContext* const expCtx, @@ -2684,7 +2690,9 @@ ExpressionMap::ExpressionMap(ExpressionContext* const expCtx, _varName(varName), _varId(varId), _input(_children[0]), - _each(_children[1]) {} + _each(_children[1]) { + expCtx->sbeCompatible = false; +} intrusive_ptr<Expression> ExpressionMap::optimize() { // TODO handle when _input is constant @@ -2821,7 +2829,9 @@ intrusive_ptr<Expression> ExpressionMeta::parse(ExpressionContext* const expCtx, } ExpressionMeta::ExpressionMeta(ExpressionContext* const expCtx, MetaType metaType) - : Expression(expCtx), _metaType(metaType) {} + : Expression(expCtx), _metaType(metaType) { + expCtx->sbeCompatible = false; +} Value ExpressionMeta::serialize(bool explain) const { const auto nameIter = kMetaTypeToMetaName.find(_metaType); @@ -6101,7 +6111,9 @@ ExpressionConvert::ExpressionConvert(ExpressionContext* const expCtx, _input(_children[0]), _to(_children[1]), _onError(_children[2]), - _onNull(_children[3]) {} + _onNull(_children[3]) { + expCtx->sbeCompatible = false; +} intrusive_ptr<Expression> ExpressionConvert::parse(ExpressionContext* const expCtx, BSONElement expr, @@ -6702,7 +6714,9 @@ REGISTER_EXPRESSION(rand, ExpressionRandom::parse); static thread_local PseudoRandom threadLocalRNG(SecureRandom().nextInt64()); -ExpressionRandom::ExpressionRandom(ExpressionContext* const expCtx) : Expression(expCtx) {} +ExpressionRandom::ExpressionRandom(ExpressionContext* const expCtx) : Expression(expCtx) { + expCtx->sbeCompatible = false; +} intrusive_ptr<Expression> ExpressionRandom::parse(ExpressionContext* const expCtx, BSONElement exprElement, diff --git a/src/mongo/db/pipeline/expression.h b/src/mongo/db/pipeline/expression.h index b2c657b8068..ff9680769d4 100644 --- a/src/mongo/db/pipeline/expression.h +++ b/src/mongo/db/pipeline/expression.h @@ -433,7 +433,9 @@ class ExpressionFromAccumulator : public ExpressionVariadic<ExpressionFromAccumulator<AccumulatorState>> { public: explicit ExpressionFromAccumulator(ExpressionContext* const expCtx) - : ExpressionVariadic<ExpressionFromAccumulator<AccumulatorState>>(expCtx) {} + : ExpressionVariadic<ExpressionFromAccumulator<AccumulatorState>>(expCtx) { + expCtx->sbeCompatible = false; + } Value evaluate(const Document& root, Variables* variables) const final { AccumulatorState accum(this->getExpressionContext()); @@ -870,7 +872,9 @@ public: class ExpressionArray final : public ExpressionVariadic<ExpressionArray> { public: explicit ExpressionArray(ExpressionContext* const expCtx) - : ExpressionVariadic<ExpressionArray>(expCtx) {} + : ExpressionVariadic<ExpressionArray>(expCtx) { + expCtx->sbeCompatible = false; + } ExpressionArray(ExpressionContext* const expCtx, std::vector<boost::intrusive_ptr<Expression>>&& children) @@ -943,7 +947,9 @@ public: class ExpressionObjectToArray final : public ExpressionFixedArity<ExpressionObjectToArray, 1> { public: explicit ExpressionObjectToArray(ExpressionContext* const expCtx) - : ExpressionFixedArity<ExpressionObjectToArray, 1>(expCtx) {} + : ExpressionFixedArity<ExpressionObjectToArray, 1>(expCtx) { + expCtx->sbeCompatible = false; + } Value evaluate(const Document& root, Variables* variables) const final; const char* getOpName() const final; @@ -956,7 +962,9 @@ public: class ExpressionArrayToObject final : public ExpressionFixedArity<ExpressionArrayToObject, 1> { public: explicit ExpressionArrayToObject(ExpressionContext* const expCtx) - : ExpressionFixedArity<ExpressionArrayToObject, 1>(expCtx) {} + : ExpressionFixedArity<ExpressionArrayToObject, 1>(expCtx) { + expCtx->sbeCompatible = false; + } ExpressionArrayToObject(ExpressionContext* const expCtx, ExpressionVector&& children) : ExpressionFixedArity<ExpressionArrayToObject, 1>(expCtx, std::move(children)) {} @@ -1629,7 +1637,9 @@ public: boost::intrusive_ptr<Expression> date, boost::intrusive_ptr<Expression> timeZone = nullptr) : DateExpressionAcceptingTimeZone<ExpressionHour>( - expCtx, "$hour", std::move(date), std::move(timeZone)) {} + expCtx, "$hour", std::move(date), std::move(timeZone)) { + expCtx->sbeCompatible = false; + } Value evaluateDate(Date_t date, const TimeZone& timeZone) const final { return Value(timeZone.dateParts(date).hour); @@ -1659,7 +1669,9 @@ public: class ExpressionIn final : public ExpressionFixedArity<ExpressionIn, 2> { public: explicit ExpressionIn(ExpressionContext* const expCtx) - : ExpressionFixedArity<ExpressionIn, 2>(expCtx) {} + : ExpressionFixedArity<ExpressionIn, 2>(expCtx) { + expCtx->sbeCompatible = false; + } ExpressionIn(ExpressionContext* const expCtx, ExpressionVector&& children) : ExpressionFixedArity<ExpressionIn, 2>(expCtx, std::move(children)) {} @@ -1677,7 +1689,9 @@ public: class ExpressionIndexOfArray : public ExpressionRangedArity<ExpressionIndexOfArray, 2, 4> { public: explicit ExpressionIndexOfArray(ExpressionContext* const expCtx) - : ExpressionRangedArity<ExpressionIndexOfArray, 2, 4>(expCtx) {} + : ExpressionRangedArity<ExpressionIndexOfArray, 2, 4>(expCtx) { + expCtx->sbeCompatible = false; + } ExpressionIndexOfArray(ExpressionContext* const expCtx, ExpressionVector&& children) : ExpressionRangedArity<ExpressionIndexOfArray, 2, 4>(expCtx, std::move(children)) {} @@ -1910,7 +1924,9 @@ public: boost::intrusive_ptr<Expression> date, boost::intrusive_ptr<Expression> timeZone = nullptr) : DateExpressionAcceptingTimeZone<ExpressionMillisecond>( - expCtx, "$millisecond", std::move(date), std::move(timeZone)) {} + expCtx, "$millisecond", std::move(date), std::move(timeZone)) { + expCtx->sbeCompatible = false; + } Value evaluateDate(Date_t date, const TimeZone& timeZone) const final { return Value(timeZone.dateParts(date).millisecond); @@ -1928,7 +1944,9 @@ public: boost::intrusive_ptr<Expression> date, boost::intrusive_ptr<Expression> timeZone = nullptr) : DateExpressionAcceptingTimeZone<ExpressionMinute>( - expCtx, "$minute", std::move(date), std::move(timeZone)) {} + expCtx, "$minute", std::move(date), std::move(timeZone)) { + expCtx->sbeCompatible = false; + } Value evaluateDate(Date_t date, const TimeZone& timeZone) const final { return Value(timeZone.dateParts(date).minute); @@ -1986,7 +2004,9 @@ public: boost::intrusive_ptr<Expression> date, boost::intrusive_ptr<Expression> timeZone = nullptr) : DateExpressionAcceptingTimeZone<ExpressionMonth>( - expCtx, "$month", std::move(date), std::move(timeZone)) {} + expCtx, "$month", std::move(date), std::move(timeZone)) { + expCtx->sbeCompatible = false; + } Value evaluateDate(Date_t date, const TimeZone& timeZone) const final { return Value(timeZone.dateParts(date).month); @@ -2098,7 +2118,9 @@ public: class ExpressionPow final : public ExpressionFixedArity<ExpressionPow, 2> { public: explicit ExpressionPow(ExpressionContext* const expCtx) - : ExpressionFixedArity<ExpressionPow, 2>(expCtx) {} + : ExpressionFixedArity<ExpressionPow, 2>(expCtx) { + expCtx->sbeCompatible = false; + } ExpressionPow(ExpressionContext* const expCtx, ExpressionVector&& children) : ExpressionFixedArity<ExpressionPow, 2>(expCtx, std::move(children)) {} @@ -2119,7 +2141,9 @@ private: class ExpressionRange final : public ExpressionRangedArity<ExpressionRange, 2, 3> { public: explicit ExpressionRange(ExpressionContext* const expCtx) - : ExpressionRangedArity<ExpressionRange, 2, 3>(expCtx) {} + : ExpressionRangedArity<ExpressionRange, 2, 3>(expCtx) { + expCtx->sbeCompatible = false; + } Value evaluate(const Document& root, Variables* variables) const final; const char* getOpName() const final; @@ -2143,7 +2167,9 @@ public: _initial(_children[1]), _in(_children[2]), _thisVar(thisVar), - _valueVar(valueVar) {} + _valueVar(valueVar) { + expCtx->sbeCompatible = false; + } Value evaluate(const Document& root, Variables* variables) const final; boost::intrusive_ptr<Expression> optimize() final; @@ -2221,7 +2247,13 @@ protected: class ExpressionReplaceAll final : public ExpressionReplaceBase { public: - using ExpressionReplaceBase::ExpressionReplaceBase; + ExpressionReplaceAll(ExpressionContext* const expCtx, + boost::intrusive_ptr<Expression> input, + boost::intrusive_ptr<Expression> find, + boost::intrusive_ptr<Expression> replacement) + : ExpressionReplaceBase(expCtx, input, find, replacement) { + expCtx->sbeCompatible = false; + } static boost::intrusive_ptr<Expression> parse(ExpressionContext* const expCtx, BSONElement expr, @@ -2246,7 +2278,9 @@ public: boost::intrusive_ptr<Expression> date, boost::intrusive_ptr<Expression> timeZone = nullptr) : DateExpressionAcceptingTimeZone<ExpressionSecond>( - expCtx, "$second", std::move(date), std::move(timeZone)) {} + expCtx, "$second", std::move(date), std::move(timeZone)) { + expCtx->sbeCompatible = false; + } Value evaluateDate(Date_t date, const TimeZone& timeZone) const final { return Value(timeZone.dateParts(date).second); @@ -2277,7 +2311,9 @@ public: class ExpressionSetEquals final : public ExpressionVariadic<ExpressionSetEquals> { public: explicit ExpressionSetEquals(ExpressionContext* const expCtx) - : ExpressionVariadic<ExpressionSetEquals>(expCtx) {} + : ExpressionVariadic<ExpressionSetEquals>(expCtx) { + expCtx->sbeCompatible = false; + } ExpressionSetEquals(ExpressionContext* const expCtx, ExpressionVector&& children) : ExpressionVariadic<ExpressionSetEquals>(expCtx, std::move(children)) {} @@ -2319,7 +2355,9 @@ public: class ExpressionSetIsSubset : public ExpressionFixedArity<ExpressionSetIsSubset, 2> { public: explicit ExpressionSetIsSubset(ExpressionContext* const expCtx) - : ExpressionFixedArity<ExpressionSetIsSubset, 2>(expCtx) {} + : ExpressionFixedArity<ExpressionSetIsSubset, 2>(expCtx) { + expCtx->sbeCompatible = false; + } ExpressionSetIsSubset(ExpressionContext* const expCtx, ExpressionVector&& children) : ExpressionFixedArity<ExpressionSetIsSubset, 2>(expCtx, std::move(children)) {} @@ -2363,7 +2401,9 @@ public: class ExpressionSize final : public ExpressionFixedArity<ExpressionSize, 1> { public: explicit ExpressionSize(ExpressionContext* const expCtx) - : ExpressionFixedArity<ExpressionSize, 1>(expCtx) {} + : ExpressionFixedArity<ExpressionSize, 1>(expCtx) { + expCtx->sbeCompatible = false; + } Value evaluate(const Document& root, Variables* variables) const final; const char* getOpName() const final; @@ -2377,7 +2417,9 @@ public: class ExpressionReverseArray final : public ExpressionFixedArity<ExpressionReverseArray, 1> { public: explicit ExpressionReverseArray(ExpressionContext* const expCtx) - : ExpressionFixedArity<ExpressionReverseArray, 1>(expCtx) {} + : ExpressionFixedArity<ExpressionReverseArray, 1>(expCtx) { + expCtx->sbeCompatible = false; + } Value evaluate(const Document& root, Variables* variables) const final; const char* getOpName() const final; @@ -2391,7 +2433,9 @@ public: class ExpressionSlice final : public ExpressionRangedArity<ExpressionSlice, 2, 3> { public: explicit ExpressionSlice(ExpressionContext* const expCtx) - : ExpressionRangedArity<ExpressionSlice, 2, 3>(expCtx) {} + : ExpressionRangedArity<ExpressionSlice, 2, 3>(expCtx) { + expCtx->sbeCompatible = false; + } ExpressionSlice(ExpressionContext* const expCtx, ExpressionVector&& children) : ExpressionRangedArity<ExpressionSlice, 2, 3>(expCtx, std::move(children)) {} @@ -2423,7 +2467,9 @@ public: class ExpressionRound final : public ExpressionRangedArity<ExpressionRound, 1, 2> { public: explicit ExpressionRound(ExpressionContext* const expCtx) - : ExpressionRangedArity<ExpressionRound, 1, 2>(expCtx) {} + : ExpressionRangedArity<ExpressionRound, 1, 2>(expCtx) { + expCtx->sbeCompatible = false; + } ExpressionRound(ExpressionContext* const expCtx, ExpressionVector&& children) : ExpressionRangedArity<ExpressionRound, 1, 2>(expCtx, std::move(children)) {} @@ -2470,7 +2516,9 @@ public: class ExpressionStrcasecmp final : public ExpressionFixedArity<ExpressionStrcasecmp, 2> { public: explicit ExpressionStrcasecmp(ExpressionContext* const expCtx) - : ExpressionFixedArity<ExpressionStrcasecmp, 2>(expCtx) {} + : ExpressionFixedArity<ExpressionStrcasecmp, 2>(expCtx) { + expCtx->sbeCompatible = false; + } ExpressionStrcasecmp(ExpressionContext* const expCtx, ExpressionVector&& children) : ExpressionFixedArity<ExpressionStrcasecmp, 2>(expCtx, std::move(children)) {} @@ -2486,7 +2534,9 @@ public: class ExpressionSubstrBytes final : public ExpressionFixedArity<ExpressionSubstrBytes, 3> { public: explicit ExpressionSubstrBytes(ExpressionContext* const expCtx) - : ExpressionFixedArity<ExpressionSubstrBytes, 3>(expCtx) {} + : ExpressionFixedArity<ExpressionSubstrBytes, 3>(expCtx) { + expCtx->sbeCompatible = false; + } ExpressionSubstrBytes(ExpressionContext* const expCtx, ExpressionVector&& children) : ExpressionFixedArity<ExpressionSubstrBytes, 3>(expCtx, std::move(children)) {} @@ -2502,7 +2552,9 @@ public: class ExpressionSubstrCP final : public ExpressionFixedArity<ExpressionSubstrCP, 3> { public: explicit ExpressionSubstrCP(ExpressionContext* const expCtx) - : ExpressionFixedArity<ExpressionSubstrCP, 3>(expCtx) {} + : ExpressionFixedArity<ExpressionSubstrCP, 3>(expCtx) { + expCtx->sbeCompatible = false; + } ExpressionSubstrCP(ExpressionContext* const expCtx, ExpressionVector&& children) : ExpressionFixedArity<ExpressionSubstrCP, 3>(expCtx, std::move(children)) {} @@ -2518,7 +2570,9 @@ public: class ExpressionStrLenBytes final : public ExpressionFixedArity<ExpressionStrLenBytes, 1> { public: explicit ExpressionStrLenBytes(ExpressionContext* const expCtx) - : ExpressionFixedArity<ExpressionStrLenBytes, 1>(expCtx) {} + : ExpressionFixedArity<ExpressionStrLenBytes, 1>(expCtx) { + expCtx->sbeCompatible = false; + } ExpressionStrLenBytes(ExpressionContext* const expCtx, ExpressionVector&& children) : ExpressionFixedArity<ExpressionStrLenBytes, 1>(expCtx, std::move(children)) {} @@ -2535,7 +2589,9 @@ public: class ExpressionBinarySize final : public ExpressionFixedArity<ExpressionBinarySize, 1> { public: ExpressionBinarySize(ExpressionContext* const expCtx) - : ExpressionFixedArity<ExpressionBinarySize, 1>(expCtx) {} + : ExpressionFixedArity<ExpressionBinarySize, 1>(expCtx) { + expCtx->sbeCompatible = false; + } Value evaluate(const Document& root, Variables* variables) const final; const char* getOpName() const final; @@ -2549,7 +2605,9 @@ public: class ExpressionStrLenCP final : public ExpressionFixedArity<ExpressionStrLenCP, 1> { public: explicit ExpressionStrLenCP(ExpressionContext* const expCtx) - : ExpressionFixedArity<ExpressionStrLenCP, 1>(expCtx) {} + : ExpressionFixedArity<ExpressionStrLenCP, 1>(expCtx) { + expCtx->sbeCompatible = false; + } ExpressionStrLenCP(ExpressionContext* const expCtx, ExpressionVector&& children) : ExpressionFixedArity<ExpressionStrLenCP, 1>(expCtx, std::move(children)) {} @@ -2565,7 +2623,9 @@ public: class ExpressionSubtract final : public ExpressionFixedArity<ExpressionSubtract, 2> { public: explicit ExpressionSubtract(ExpressionContext* const expCtx) - : ExpressionFixedArity<ExpressionSubtract, 2>(expCtx) {} + : ExpressionFixedArity<ExpressionSubtract, 2>(expCtx) { + expCtx->sbeCompatible = false; + } ExpressionSubtract(ExpressionContext* const expCtx, ExpressionVector&& children) : ExpressionFixedArity<ExpressionSubtract, 2>(expCtx, std::move(children)) {} @@ -2663,7 +2723,9 @@ public: _trimType(trimType), _name(name.toString()), _input(_children[0]), - _characters(_children[1]) {} + _characters(_children[1]) { + expCtx->sbeCompatible = false; + } Value evaluate(const Document& root, Variables* variables) const final; boost::intrusive_ptr<Expression> optimize() final; @@ -2716,7 +2778,9 @@ private: class ExpressionTrunc final : public ExpressionRangedArity<ExpressionTrunc, 1, 2> { public: explicit ExpressionTrunc(ExpressionContext* const expCtx) - : ExpressionRangedArity<ExpressionTrunc, 1, 2>(expCtx) {} + : ExpressionRangedArity<ExpressionTrunc, 1, 2>(expCtx) { + expCtx->sbeCompatible = false; + } ExpressionTrunc(ExpressionContext* const expCtx, ExpressionVector&& children) : ExpressionRangedArity<ExpressionTrunc, 1, 2>(expCtx, std::move(children)) {} @@ -2735,7 +2799,9 @@ public: class ExpressionType final : public ExpressionFixedArity<ExpressionType, 1> { public: explicit ExpressionType(ExpressionContext* const expCtx) - : ExpressionFixedArity<ExpressionType, 1>(expCtx) {} + : ExpressionFixedArity<ExpressionType, 1>(expCtx) { + expCtx->sbeCompatible = false; + } ExpressionType(ExpressionContext* const expCtx, ExpressionVector&& children) : ExpressionFixedArity<ExpressionType, 1>(expCtx, std::move(children)) {} @@ -2767,7 +2833,9 @@ public: boost::intrusive_ptr<Expression> date, boost::intrusive_ptr<Expression> timeZone = nullptr) : DateExpressionAcceptingTimeZone<ExpressionWeek>( - expCtx, "$week", std::move(date), std::move(timeZone)) {} + expCtx, "$week", std::move(date), std::move(timeZone)) { + expCtx->sbeCompatible = false; + } Value evaluateDate(Date_t date, const TimeZone& timeZone) const final { return Value(timeZone.week(date)); @@ -2785,7 +2853,9 @@ public: boost::intrusive_ptr<Expression> date, boost::intrusive_ptr<Expression> timeZone = nullptr) : DateExpressionAcceptingTimeZone<ExpressionIsoWeekYear>( - expCtx, "$isoWeekYear", std::move(date), std::move(timeZone)) {} + expCtx, "$isoWeekYear", std::move(date), std::move(timeZone)) { + expCtx->sbeCompatible = false; + } Value evaluateDate(Date_t date, const TimeZone& timeZone) const final { return Value(timeZone.isoYear(date)); @@ -2822,7 +2892,9 @@ public: boost::intrusive_ptr<Expression> date, boost::intrusive_ptr<Expression> timeZone = nullptr) : DateExpressionAcceptingTimeZone<ExpressionIsoWeek>( - expCtx, "$isoWeek", std::move(date), std::move(timeZone)) {} + expCtx, "$isoWeek", std::move(date), std::move(timeZone)) { + expCtx->sbeCompatible = false; + } Value evaluateDate(Date_t date, const TimeZone& timeZone) const final { return Value(timeZone.isoWeek(date)); @@ -2840,7 +2912,9 @@ public: boost::intrusive_ptr<Expression> date, boost::intrusive_ptr<Expression> timeZone = nullptr) : DateExpressionAcceptingTimeZone<ExpressionYear>( - expCtx, "$year", std::move(date), std::move(timeZone)) {} + expCtx, "$year", std::move(date), std::move(timeZone)) { + expCtx->sbeCompatible = false; + } Value evaluateDate(Date_t date, const TimeZone& timeZone) const final { return Value(timeZone.dateParts(date).year); @@ -2862,7 +2936,9 @@ public: : Expression(expCtx, std::move(children)), _useLongestLength(useLongestLength), _inputs(std::move(inputs)), - _defaults(std::move(defaults)) {} + _defaults(std::move(defaults)) { + expCtx->sbeCompatible = false; + } Value evaluate(const Document& root, Variables* variables) const final; boost::intrusive_ptr<Expression> optimize() final; @@ -3136,7 +3212,9 @@ class ExpressionToHashedIndexKey : public Expression { public: ExpressionToHashedIndexKey(ExpressionContext* const expCtx, boost::intrusive_ptr<Expression> inputExpression) - : Expression(expCtx, {inputExpression}){}; + : Expression(expCtx, {inputExpression}) { + expCtx->sbeCompatible = false; + }; static boost::intrusive_ptr<Expression> parse(ExpressionContext* const expCtx, BSONElement expr, diff --git a/src/mongo/db/pipeline/expression_context.h b/src/mongo/db/pipeline/expression_context.h index 33696061ecc..af83dbd31a7 100644 --- a/src/mongo/db/pipeline/expression_context.h +++ b/src/mongo/db/pipeline/expression_context.h @@ -365,6 +365,10 @@ public: // construction. const bool mayDbProfile = true; + // True if all expressions which use this expression context can be translated into equivalent + // SBE expressions. + bool sbeCompatible = true; + // API Parameters pulled from OperationContext upon object creation. // This may become stale if OperationContext changes after object creation. // Expressions should reach APIParameters with this variable instead of using the decorator. diff --git a/src/mongo/db/pipeline/expression_function.cpp b/src/mongo/db/pipeline/expression_function.cpp index 8f5074bb1c1..e28acaca61b 100644 --- a/src/mongo/db/pipeline/expression_function.cpp +++ b/src/mongo/db/pipeline/expression_function.cpp @@ -42,7 +42,9 @@ ExpressionFunction::ExpressionFunction(ExpressionContext* const expCtx, _passedArgs(_children[0]), _assignFirstArgToThis(assignFirstArgToThis), _funcSource(std::move(funcSource)), - _lang(std::move(lang)) {} + _lang(std::move(lang)) { + expCtx->sbeCompatible = false; +} Value ExpressionFunction::serialize(bool explain) const { MutableDocument d; diff --git a/src/mongo/db/pipeline/expression_js_emit.cpp b/src/mongo/db/pipeline/expression_js_emit.cpp index 6340a53e98f..44242fefcf3 100644 --- a/src/mongo/db/pipeline/expression_js_emit.cpp +++ b/src/mongo/db/pipeline/expression_js_emit.cpp @@ -94,7 +94,9 @@ ExpressionInternalJsEmit::ExpressionInternalJsEmit(ExpressionContext* const expC : Expression(expCtx, {std::move(thisRef)}), _emitState{{}, internalQueryMaxJsEmitBytes.load(), 0}, _thisRef(_children[0]), - _funcSource(std::move(funcSource)) {} + _funcSource(std::move(funcSource)) { + expCtx->sbeCompatible = false; +} void ExpressionInternalJsEmit::_doAddDependencies(mongo::DepsTracker* deps) const { _children[0]->addDependencies(deps); diff --git a/src/mongo/db/pipeline/expression_test_api_version.cpp b/src/mongo/db/pipeline/expression_test_api_version.cpp index 8a30407961b..8428d6d78ab 100644 --- a/src/mongo/db/pipeline/expression_test_api_version.cpp +++ b/src/mongo/db/pipeline/expression_test_api_version.cpp @@ -38,7 +38,9 @@ REGISTER_TEST_EXPRESSION(_testApiVersion, ExpressionTestApiVersion::parse); ExpressionTestApiVersion::ExpressionTestApiVersion(ExpressionContext* const expCtx, bool unstable, bool deprecated) - : Expression(expCtx), _unstable(unstable), _deprecated(deprecated) {} + : Expression(expCtx), _unstable(unstable), _deprecated(deprecated) { + expCtx->sbeCompatible = false; +} boost::intrusive_ptr<Expression> ExpressionTestApiVersion::parse(ExpressionContext* const expCtx, BSONElement expr, diff --git a/src/mongo/db/query/get_executor.cpp b/src/mongo/db/query/get_executor.cpp index ade2971399e..19e068ca39c 100644 --- a/src/mongo/db/query/get_executor.cpp +++ b/src/mongo/db/query/get_executor.cpp @@ -916,10 +916,6 @@ protected: std::unique_ptr<SlotBasedPrepareExecutionResult> buildIdHackPlan( const IndexDescriptor* descriptor, QueryPlannerParams* plannerParams) final { - uassert(4822862, - "Queries that require sort key metadata are not supported by SBE yet", - !_cq->metadataDeps()[DocumentMetadataFields::kSortKey]); - // Fall back to normal planning. return nullptr; } @@ -1106,6 +1102,25 @@ StatusWith<std::unique_ptr<PlanExecutor, PlanExecutor::Deleter>> getSlotBasedExe std::move(nss), std::move(yieldPolicy)); } + +// Checks if the given query can be executed with the SBE engine. +inline bool isQuerySbeCompatible(const CanonicalQuery* const cq, size_t plannerOptions) { + invariant(cq); + auto expCtx = cq->getExpCtxRaw(); + auto sortPattern = cq->getSortPattern(); + const bool allExpressionsSupported = expCtx && expCtx->sbeCompatible; + const bool isNotCount = !(plannerOptions & QueryPlannerParams::IS_COUNT); + // Specifying 'ntoreturn' in an OP_QUERY style find may result in a QuerySolution with + // ENSURE_SORTED node, which is currently not supported by SBE. + const bool doesNotNeedEnsureSorted = !cq->getQueryRequest().getNToReturn(); + const bool doesNotContainMetadataRequirements = cq->metadataDeps().none(); + const bool doesNotSortOnDottedPath = + !sortPattern || std::all_of(sortPattern->begin(), sortPattern->end(), [](auto&& part) { + return part.fieldPath && part.fieldPath->getPathLength() == 1; + }); + return allExpressionsSupported && isNotCount && doesNotNeedEnsureSorted && + doesNotContainMetadataRequirements && doesNotSortOnDottedPath; +} } // namespace StatusWith<std::unique_ptr<PlanExecutor, PlanExecutor::Deleter>> getExecutor( @@ -1114,7 +1129,8 @@ StatusWith<std::unique_ptr<PlanExecutor, PlanExecutor::Deleter>> getExecutor( std::unique_ptr<CanonicalQuery> canonicalQuery, PlanYieldPolicy::YieldPolicy yieldPolicy, size_t plannerOptions) { - return feature_flags::gSBE.isEnabledAndIgnoreFCV() + return feature_flags::gSBE.isEnabledAndIgnoreFCV() && + isQuerySbeCompatible(canonicalQuery.get(), plannerOptions) ? getSlotBasedExecutor( opCtx, collection, std::move(canonicalQuery), yieldPolicy, plannerOptions) : getClassicExecutor( diff --git a/src/mongo/db/query/plan_explainer_sbe.cpp b/src/mongo/db/query/plan_explainer_sbe.cpp index e993b2cf6c0..953eed0ffdf 100644 --- a/src/mongo/db/query/plan_explainer_sbe.cpp +++ b/src/mongo/db/query/plan_explainer_sbe.cpp @@ -117,7 +117,7 @@ void statsToBSON(const QuerySolutionNode* node, } case STAGE_LIMIT: { auto ln = static_cast<const LimitNode*>(node); - bob->appendNumber("limitAmount", ln->limit); + bob->appendIntOrLL("limitAmount", ln->limit); break; } case STAGE_PROJECTION_DEFAULT: @@ -129,7 +129,7 @@ void statsToBSON(const QuerySolutionNode* node, } case STAGE_SKIP: { auto sn = static_cast<const SkipNode*>(node); - bob->appendNumber("skipAmount", sn->skip); + bob->appendIntOrLL("skipAmount", sn->skip); break; } case STAGE_SORT_SIMPLE: @@ -334,6 +334,7 @@ std::string PlanExplainerSBE::getPlanSummary() const { } StringBuilder sb; + bool seenLeaf = false; std::queue<const QuerySolutionNode*> queue; queue.push(_solution->root()); @@ -341,56 +342,60 @@ std::string PlanExplainerSBE::getPlanSummary() const { auto node = queue.front(); queue.pop(); - sb << stageTypeToString(node->getType()); - - switch (node->getType()) { - case STAGE_COUNT_SCAN: { - auto csn = static_cast<const CountScanNode*>(node); - const KeyPattern keyPattern{csn->index.keyPattern}; - sb << " " << keyPattern; - break; - } - case STAGE_DISTINCT_SCAN: { - auto dn = static_cast<const DistinctNode*>(node); - const KeyPattern keyPattern{dn->index.keyPattern}; - sb << " " << keyPattern; - break; - } - case STAGE_GEO_NEAR_2D: { - auto geo2d = static_cast<const GeoNear2DNode*>(node); - const KeyPattern keyPattern{geo2d->index.keyPattern}; - sb << " " << keyPattern; - break; - } - case STAGE_GEO_NEAR_2DSPHERE: { - auto geo2dsphere = static_cast<const GeoNear2DSphereNode*>(node); - const KeyPattern keyPattern{geo2dsphere->index.keyPattern}; - sb << " " << keyPattern; - break; - } - case STAGE_IXSCAN: { - auto ixn = static_cast<const IndexScanNode*>(node); - const KeyPattern keyPattern{ixn->index.keyPattern}; - sb << " " << keyPattern; - break; + if (node->children.empty()) { + if (seenLeaf) { + sb << ", "; + } else { + seenLeaf = true; } - case STAGE_TEXT: { - auto tn = static_cast<const TextNode*>(node); - const KeyPattern keyPattern{tn->indexPrefix}; - sb << " " << keyPattern; - break; + + sb << stageTypeToString(node->getType()); + + switch (node->getType()) { + case STAGE_COUNT_SCAN: { + auto csn = static_cast<const CountScanNode*>(node); + const KeyPattern keyPattern{csn->index.keyPattern}; + sb << " " << keyPattern; + break; + } + case STAGE_DISTINCT_SCAN: { + auto dn = static_cast<const DistinctNode*>(node); + const KeyPattern keyPattern{dn->index.keyPattern}; + sb << " " << keyPattern; + break; + } + case STAGE_GEO_NEAR_2D: { + auto geo2d = static_cast<const GeoNear2DNode*>(node); + const KeyPattern keyPattern{geo2d->index.keyPattern}; + sb << " " << keyPattern; + break; + } + case STAGE_GEO_NEAR_2DSPHERE: { + auto geo2dsphere = static_cast<const GeoNear2DSphereNode*>(node); + const KeyPattern keyPattern{geo2dsphere->index.keyPattern}; + sb << " " << keyPattern; + break; + } + case STAGE_IXSCAN: { + auto ixn = static_cast<const IndexScanNode*>(node); + const KeyPattern keyPattern{ixn->index.keyPattern}; + sb << " " << keyPattern; + break; + } + case STAGE_TEXT: { + auto tn = static_cast<const TextNode*>(node); + const KeyPattern keyPattern{tn->indexPrefix}; + sb << " " << keyPattern; + break; + } + default: + break; } - default: - break; } for (auto&& child : node->children) { queue.push(child); } - - if (!queue.empty()) { - sb << ", "; - } } return sb.str(); diff --git a/src/mongo/db/query/sbe_stage_builder.cpp b/src/mongo/db/query/sbe_stage_builder.cpp index 8b358546f65..fc041266768 100644 --- a/src/mongo/db/query/sbe_stage_builder.cpp +++ b/src/mongo/db/query/sbe_stage_builder.cpp @@ -1403,8 +1403,8 @@ std::pair<std::unique_ptr<sbe::PlanStage>, PlanStageSlots> SlotBasedStageBuilder {STAGE_SORT_MERGE, &SlotBasedStageBuilder::buildSortMerge}, {STAGE_SHARDING_FILTER, &SlotBasedStageBuilder::buildShardFilter}}; - uassert(4822884, - str::stream() << "Can't build exec tree for node: " << root->toString(), + tassert(4822884, + str::stream() << "Unsupported QSN in SBE stage builder: " << root->toString(), kStageBuilders.find(root->getType()) != kStageBuilders.end()); // If this plan is for a tailable cursor scan, and we're not already in the process of building diff --git a/src/mongo/db/query/sbe_stage_builder_expression.cpp b/src/mongo/db/query/sbe_stage_builder_expression.cpp index d05ceb5bf34..a345e99d21f 100644 --- a/src/mongo/db/query/sbe_stage_builder_expression.cpp +++ b/src/mongo/db/query/sbe_stage_builder_expression.cpp @@ -3411,8 +3411,10 @@ private: } void unsupportedExpression(const char* op) const { - uasserted(ErrorCodes::InternalErrorNotSupported, - str::stream() << "Expression is not supported in SBE: " << op); + // We're guaranteed to not fire this assertion by implementing a mechanism in the upper + // layer which directs the query to the classic engine when an unsupported expression + // appears. + tasserted(5182300, str::stream() << "Unsupported expression in SBE stage builder: " << op); } ExpressionVisitorContext* _context; diff --git a/src/mongo/db/query/sbe_stage_builder_filter.cpp b/src/mongo/db/query/sbe_stage_builder_filter.cpp index 0befaabeb1d..5a3b9e21862 100644 --- a/src/mongo/db/query/sbe_stage_builder_filter.cpp +++ b/src/mongo/db/query/sbe_stage_builder_filter.cpp @@ -955,8 +955,11 @@ public: private: void unsupportedExpression(const MatchExpression* expr) const { - uasserted(4822878, - str::stream() << "Match expression is not supported in SBE: " + // We're guaranteed to not fire this assertion by implementing a mechanism in the upper + // layer which directs the query to the classic engine when an unsupported expression + // appears. + tasserted(4822878, + str::stream() << "Unsupported match expression in SBE stage builder: " << expr->matchType()); } diff --git a/src/mongo/db/query/stage_types.cpp b/src/mongo/db/query/stage_types.cpp index 2f37ba89e0f..b5f1f16c106 100644 --- a/src/mongo/db/query/stage_types.cpp +++ b/src/mongo/db/query/stage_types.cpp @@ -63,8 +63,8 @@ StringData stageTypeToString(StageType stageType) { {STAGE_RETURN_KEY, "RETURN_KEY"_sd}, {STAGE_SHARDING_FILTER, "SHARDING_FILTER"_sd}, {STAGE_SKIP, "SKIP"_sd}, - {STAGE_SORT_DEFAULT, "SORT_DEFAULT"_sd}, - {STAGE_SORT_SIMPLE, "SORT_SIMPLE"_sd}, + {STAGE_SORT_DEFAULT, "SORT"_sd}, + {STAGE_SORT_SIMPLE, "SORT"_sd}, {STAGE_SORT_KEY_GENERATOR, "SORT_KEY_GENERATOR"_sd}, {STAGE_SORT_MERGE, "SORT_MERGE"_sd}, {STAGE_SUBPLAN, "SUBPLAN"_sd}, |