summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorJames Wahlin <james@mongodb.com>2019-01-18 11:51:13 -0500
committerJames Wahlin <james@mongodb.com>2019-01-18 14:02:51 -0500
commitaad17aeba520f5c421716cb2d740057be96ce61a (patch)
tree385547a72bf00396608521faf4b884aa0033d2c2 /jstests
parent1f5753e1573df693c6cfe1ba54c1845babf67364 (diff)
downloadmongo-aad17aeba520f5c421716cb2d740057be96ce61a.tar.gz
SERVER-39081 Fix createIndexes/shardCollection race condition in agg_out.js
Diffstat (limited to 'jstests')
-rw-r--r--jstests/concurrency/fsm_workloads/agg_out.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/jstests/concurrency/fsm_workloads/agg_out.js b/jstests/concurrency/fsm_workloads/agg_out.js
index 4aeec1bf67a..80ed675bca0 100644
--- a/jstests/concurrency/fsm_workloads/agg_out.js
+++ b/jstests/concurrency/fsm_workloads/agg_out.js
@@ -139,7 +139,6 @@ var $config = extendWorkload($config, function($config, $super) {
$config.states.shardCollection = function shardCollection(db, unusedCollName) {
if (isMongos(db)) {
assertWhenOwnDB.commandWorked(db.adminCommand({enableSharding: db.getName()}));
- assertWhenOwnDB.commandWorked(db[this.outputCollName].createIndex({_id: 'hashed'}));
assertWhenOwnDB.commandWorked(db.adminCommand(
{shardCollection: db[this.outputCollName].getFullName(), key: {_id: 'hashed'}}));
}
@@ -150,6 +149,10 @@ var $config = extendWorkload($config, function($config, $super) {
*/
$config.setup = function setup(db, collName, cluster) {
$super.setup.apply(this, [db, collName, cluster]);
+
+ // `shardCollection()` requires a shard key index to be in place on the output collection,
+ // as we may be sharding a non-empty collection.
+ assertWhenOwnDB.commandWorked(db[this.outputCollName].createIndex({_id: 'hashed'}));
};
return $config;