summaryrefslogtreecommitdiff
path: root/jstests/concurrency/fsm_workloads/agg_out.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/concurrency/fsm_workloads/agg_out.js')
-rw-r--r--jstests/concurrency/fsm_workloads/agg_out.js75
1 files changed, 15 insertions, 60 deletions
diff --git a/jstests/concurrency/fsm_workloads/agg_out.js b/jstests/concurrency/fsm_workloads/agg_out.js
index d320676a167..86ebca8801a 100644
--- a/jstests/concurrency/fsm_workloads/agg_out.js
+++ b/jstests/concurrency/fsm_workloads/agg_out.js
@@ -37,11 +37,10 @@ var $config = extendWorkload($config, function($config, $super) {
$config.transitions = {
query: {
- query: 0.63,
+ query: 0.68,
createIndexes: 0.1,
dropIndex: 0.1,
collMod: 0.1,
- movePrimary: 0.05,
// Converting the target collection to a capped collection or a sharded collection will
// cause all subsequent aggregations to fail, so give these a low probability to make
// sure they don't happen too early in the test.
@@ -49,7 +48,6 @@ var $config = extendWorkload($config, function($config, $super) {
shardCollection: 0.01,
},
createIndexes: {query: 1},
- movePrimary: {query: 1},
dropIndex: {query: 1},
collMod: {query: 1},
convertToCapped: {query: 1},
@@ -60,7 +58,6 @@ var $config = extendWorkload($config, function($config, $super) {
* Runs an aggregate with a $out into '$config.data.outputCollName'.
*/
$config.states.query = function query(db, collName) {
- jsTestLog(`Running query: coll=${collName} out=${this.outputCollName}`);
const res = db[collName].runCommand({
aggregate: collName,
pipeline: [{$match: {flag: true}}, {$out: this.outputCollName}],
@@ -68,27 +65,15 @@ var $config = extendWorkload($config, function($config, $super) {
});
const allowedErrorCodes = [
- // Indexes of target collection changed during processing.
- ErrorCodes.CommandFailed,
- // $out is not supported to an existing *sharded* output collection.
- ErrorCodes.IllegalOperation,
- // Namespace is capped so it can't be used for $out.
- 17152,
- // $out collection cannot be sharded.
- 28769,
- // $out can't be executed while there is a move primary in progress.
- ErrorCodes.MovePrimaryInProgress,
- // (SERVER-78850) Move primary coordinator drops donor collections when it is done.
- // This invalidates non - snapshot cursors, which causes $out to fail.
- // Locally it fails with explicit collection dropped error. When doing remote reads,
- // it fails with cursor not found error.
- ErrorCodes.CursorNotFound,
+ ErrorCodes.CommandFailed, // indexes of target collection changed during processing.
+ ErrorCodes.IllegalOperation, // $out 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) {
- // No matter how many documents were in the original input stream, $out should never
- // return any results.
const cursor = new DBCommandCursor(db, res);
assertAlways.eq(0, cursor.itcount()); // No matter how many documents were in the
// original input stream, $out should never
@@ -102,10 +87,7 @@ var $config = extendWorkload($config, function($config, $super) {
*/
$config.states.createIndexes = function createIndexes(db, unusedCollName) {
for (var i = 0; i < this.indexSpecs; ++i) {
- const indexSpecs = this.indexSpecs[i];
- jsTestLog(`Running createIndex: coll=${this.outputCollName} indexSpec=${indexSpecs}`);
- assertWhenOwnDB.commandWorkedOrFailedWithCode(
- db[this.outputCollName].createIndex(indexSpecs), ErrorCodes.MovePrimaryInProgress);
+ assertWhenOwnDB.commandWorked(db[this.outputCollName].createIndex(this.indexSpecs[i]));
}
};
@@ -114,7 +96,6 @@ var $config = extendWorkload($config, function($config, $super) {
*/
$config.states.dropIndex = function dropIndex(db, unusedCollName) {
const indexSpec = this.indexSpecs[Random.randInt(this.indexSpecs.length)];
- jsTestLog(`Running dropIndex: coll=${this.outputCollName} indexSpec=${indexSpec}`);
db[this.outputCollName].dropIndex(indexSpec);
};
@@ -126,39 +107,20 @@ var $config = extendWorkload($config, function($config, $super) {
// Change the validation level.
const validationLevels = ['off', 'strict', 'moderate'];
const newValidationLevel = validationLevels[Random.randInt(validationLevels.length)];
- jsTestLog(`Running collMod: coll=${this.outputCollName} validationLevel=${
- newValidationLevel}`);
-
assertWhenOwnDB.commandWorkedOrFailedWithCode(
db.runCommand({collMod: this.outputCollName, validationLevel: newValidationLevel}),
- [ErrorCodes.ConflictingOperationInProgress, ErrorCodes.MovePrimaryInProgress]);
+ ErrorCodes.ConflictingOperationInProgress);
} else {
// Change the validation action.
- const validationAction = Random.rand() > 0.5 ? 'warn' : 'error';
- jsTestLog(`Running collMod: coll=${this.outputCollName} validationAction=${
- validationAction}`);
-
assertWhenOwnDB.commandWorkedOrFailedWithCode(
- db.runCommand({collMod: this.outputCollName, validationAction: validationAction}),
- [ErrorCodes.ConflictingOperationInProgress, ErrorCodes.MovePrimaryInProgress]);
+ db.runCommand({
+ collMod: this.outputCollName,
+ validationAction: Random.rand() > 0.5 ? 'warn' : 'error'
+ }),
+ ErrorCodes.ConflictingOperationInProgress);
}
};
- $config.states.movePrimary = function movePrimary(db, collName) {
- if (!isMongos(db)) {
- return;
- }
- const toShard = this.shards[Random.randInt(this.shards.length)];
- jsTestLog(`Running movePrimary: db=${db} to=${toShard}`);
-
- assert.commandWorkedOrFailedWithCode(
- db.adminCommand({movePrimary: db.getName(), to: toShard}), [
- // Caused by a concurrent movePrimary operation on the same database but a different
- // destination shard.
- ErrorCodes.ConflictingOperationInProgress,
- ]);
- };
-
/**
* Converts '$config.data.outputCollName' to a capped collection. This is never undone, and all
* subsequent $out's to this collection should fail.
@@ -168,10 +130,8 @@ var $config = extendWorkload($config, function($config, $super) {
return; // convertToCapped can't be run against a mongos.
}
- jsTestLog(`Running convertToCapped: coll=${this.outputCollName}`);
- assertWhenOwnDB.commandWorkedOrFailedWithCode(
- db.runCommand({convertToCapped: this.outputCollName, size: 100000}),
- ErrorCodes.MovePrimaryInProgress);
+ assertWhenOwnDB.commandWorked(
+ db.runCommand({convertToCapped: this.outputCollName, size: 100000}));
};
/**
@@ -182,7 +142,6 @@ var $config = extendWorkload($config, function($config, $super) {
*/
$config.states.shardCollection = function shardCollection(db, unusedCollName) {
if (isMongos(db) && this.tid === 0) {
- jsTestLog(`Running shardCollection: coll=${this.outputCollName} key=${this.shardKey}`);
assertWhenOwnDB.commandWorked(db.adminCommand({enableSharding: db.getName()}));
assertWhenOwnDB.commandWorked(db.adminCommand(
{shardCollection: db[this.outputCollName].getFullName(), key: {_id: 'hashed'}}));
@@ -198,10 +157,6 @@ var $config = extendWorkload($config, function($config, $super) {
// `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'}));
-
- if (isMongos(db)) {
- this.shards = Object.keys(cluster.getSerializedCluster().shards);
- }
};
return $config;