summaryrefslogtreecommitdiff
path: root/jstests/sharding/query/agg_mongos_merge.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/sharding/query/agg_mongos_merge.js')
-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",