diff options
author | James Wahlin <james@mongodb.com> | 2019-01-09 11:24:37 -0500 |
---|---|---|
committer | James Wahlin <james@mongodb.com> | 2019-01-14 09:56:29 -0500 |
commit | 9ed4ddae8b3c2aa7f876bdbfce00523c2b2a118c (patch) | |
tree | 31079958e83a399ba12c1349253f72cf305fcb65 | |
parent | 3b4c6a689a3fdaa923d427ae112ea599513ef8ce (diff) | |
download | mongo-9ed4ddae8b3c2aa7f876bdbfce00523c2b2a118c.tar.gz |
SERVER-38387 agg_out.js concurrency workload always fails to shard the output collection
-rw-r--r-- | jstests/concurrency/fsm_workloads/agg_out.js | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/jstests/concurrency/fsm_workloads/agg_out.js b/jstests/concurrency/fsm_workloads/agg_out.js index c57e615548d..4aeec1bf67a 100644 --- a/jstests/concurrency/fsm_workloads/agg_out.js +++ b/jstests/concurrency/fsm_workloads/agg_out.js @@ -64,6 +64,16 @@ var $config = extendWorkload($config, function($config, $super) { pipeline: [{$match: {flag: true}}, {$out: this.outputCollName}], cursor: {} }); + + const allowedErrorCodes = [ + ErrorCodes.CommandFailed, // indexes of target collection changed during processing. + 17017, // $out with mode replaceCollection is not supported to an existing *sharded* + // output collection. + 17152, // namespace is capped so it can't be used for $out. + 28769, // $out collection cannot be sharded. + ]; + assertWhenOwnDB.commandWorkedOrFailedWithCode(res, allowedErrorCodes); + if (res.ok) { const cursor = new DBCommandCursor(db, res); assertAlways.eq(0, cursor.itcount()); // No matter how many documents were in the @@ -128,9 +138,10 @@ var $config = extendWorkload($config, function($config, $super) { */ $config.states.shardCollection = function shardCollection(db, unusedCollName) { if (isMongos(db)) { - db.adminCommand({enableSharding: db.getName()}); - db.adminCommand( - {shardCollection: db[this.outputCollName].getFullName(), key: {_id: 'hashed'}}); + 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'}})); } }; |