summaryrefslogtreecommitdiff
path: root/jstests/core/index_bounds_pipe.js
diff options
context:
space:
mode:
authorCharlie Swanson <charlie.swanson@mongodb.com>2018-01-11 14:00:27 -0500
committerCharlie Swanson <charlie.swanson@mongodb.com>2018-01-19 09:55:59 -0500
commit87c9442cc30d4101693bb8ccb6fd4509aa048558 (patch)
tree99ab7b36d89776693c09f271e4de4fd4f64846e3 /jstests/core/index_bounds_pipe.js
parent71ae3ed5b7e99ddb629ec64b85f4bd75b73aff17 (diff)
downloadmongo-87c9442cc30d4101693bb8ccb6fd4509aa048558.tar.gz
SERVER-31785 Use 2 shards in sharded jscore passthrough.
Diffstat (limited to 'jstests/core/index_bounds_pipe.js')
-rw-r--r--jstests/core/index_bounds_pipe.js18
1 files changed, 11 insertions, 7 deletions
diff --git a/jstests/core/index_bounds_pipe.js b/jstests/core/index_bounds_pipe.js
index e284d5c78f3..ee6cbd5b5f7 100644
--- a/jstests/core/index_bounds_pipe.js
+++ b/jstests/core/index_bounds_pipe.js
@@ -31,13 +31,17 @@
const explain = db.runCommand({explain: command});
assert.commandWorked(explain);
- // Check that the query uses correct index bounds.
- const ixscan = getPlanStage(explain.queryPlanner.winningPlan, 'IXSCAN');
- assert.neq(ixscan, null, 'Plan unexpectedly missing IXSCAN stage: ' + tojson(explain));
- assert.eq(ixscan.indexBounds._id,
- params.bounds,
- 'Expected bounds of ' + tojson(params.bounds) + ' but got ' +
- tojson(ixscan.indexBounds._id));
+ // 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');
+ assert.gt(ixscans.length, 0, 'Plan unexpectedly missing IXSCAN stage: ' + tojson(explain));
+ for (let i = 0; i < ixscans.length; i++) {
+ const ixscan = ixscans[i];
+ assert.eq(ixscan.indexBounds._id,
+ params.bounds,
+ `Expected bounds of ${tojson(params.bounds)} but got ${
+ tojson(ixscan.indexBounds._id)}. i=${i}, all output: ${tojson(explain)}`);
+ }
// Check that the query regex matches expected strings.
const results = db.runCommand(command);