summaryrefslogtreecommitdiff
path: root/jstests/sharding
diff options
context:
space:
mode:
authorBen Caimano <ben.caimano@10gen.com>2020-07-09 15:07:44 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-07-10 19:50:58 +0000
commit96cb86d41e4800b0f359a4d25dad2a6a94501e32 (patch)
tree0b76472d405cb7d06f308aa79243f60e0d139b08 /jstests/sharding
parent801fc9cb186ceb16abc2dd96ecc6f1749f1cde12 (diff)
downloadmongo-96cb86d41e4800b0f359a4d25dad2a6a94501e32.tar.gz
SERVER-33966 Removed Redundant Sort
Diffstat (limited to 'jstests/sharding')
-rw-r--r--jstests/sharding/query/agg_mongos_merge.js23
1 files changed, 15 insertions, 8 deletions
diff --git a/jstests/sharding/query/agg_mongos_merge.js b/jstests/sharding/query/agg_mongos_merge.js
index f36e81b6005..e917fd2a810 100644
--- a/jstests/sharding/query/agg_mongos_merge.js
+++ b/jstests/sharding/query/agg_mongos_merge.js
@@ -9,6 +9,7 @@
* @tags: [
* requires_sharding,
* requires_profiling,
+ * requires_fcv_46,
* ]
*/
@@ -339,14 +340,6 @@ function runTestCasesWhoseMergeLocationDependsOnAllowDiskUse(allowDiskUse) {
// All test cases should merge on mongoD if allowDiskUse is true, mongoS otherwise.
const assertMergeOnMongoX = (allowDiskUse ? assertMergeOnMongoD : assertMergeOnMongoS);
- // Test that a blocking $sort is only merged on mongoS if 'allowDiskUse' is not set.
- assertMergeOnMongoX({
- testName: "agg_mongos_merge_blocking_sort_no_disk_use",
- pipeline: [{$match: {_id: {$gte: -200, $lte: 200}}}, {$sort: {_id: -1}}, {$sort: {a: 1}}],
- allowDiskUse: allowDiskUse,
- expectedCount: 400
- });
-
// Test that $group is only merged on mongoS if 'allowDiskUse' is not set.
assertMergeOnMongoX({
testName: "agg_mongos_merge_group_allow_disk_use",
@@ -356,6 +349,20 @@ function runTestCasesWhoseMergeLocationDependsOnAllowDiskUse(allowDiskUse) {
expectedCount: 299
});
+ // Adjacent $sort stages will be coalesced and merge sort will occur on anyShard when disk use
+ // is allowed, and on mongos otherwise.
+ assertMergeOnMongoX({
+ testName: "agg_mongos_merge_blocking_sort_allow_disk_use",
+ pipeline: [
+ {$match: {_id: {$gte: -200, $lte: 200}}},
+ {$sort: {_id: 1}},
+ {$_internalSplitPipeline: {}},
+ {$sort: {a: 1}}
+ ],
+ allowDiskUse: allowDiskUse,
+ expectedCount: 400
+ });
+
// Test that a blocking $sample is only merged on mongoS if 'allowDiskUse' is not set.
assertMergeOnMongoX({
testName: "agg_mongos_merge_blocking_sample_allow_disk_use",