summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Nelson <lamont.nelson@mongodb.com>2019-11-27 20:28:42 +0000
committerevergreen <evergreen@mongodb.com>2019-11-27 20:28:42 +0000
commit05caeff5a904d494c7dc6c994ed67a9b6c30a008 (patch)
tree8f4afba85b8ea7c5d429bf71b37cd3d938a4b1b1
parent513ac2c75ec8a3c2400553db1aa1d0f977dbe9f2 (diff)
downloadmongo-05caeff5a904d494c7dc6c994ed67a9b6c30a008.tar.gz
SERVER-42781: ignore InvalidOptions exception
-rw-r--r--jstests/concurrency/fsm_workloads/sharded_moveChunk_drop_shard_key_index.js28
1 files changed, 21 insertions, 7 deletions
diff --git a/jstests/concurrency/fsm_workloads/sharded_moveChunk_drop_shard_key_index.js b/jstests/concurrency/fsm_workloads/sharded_moveChunk_drop_shard_key_index.js
index 2f4aa279970..17f328ee8ed 100644
--- a/jstests/concurrency/fsm_workloads/sharded_moveChunk_drop_shard_key_index.js
+++ b/jstests/concurrency/fsm_workloads/sharded_moveChunk_drop_shard_key_index.js
@@ -29,13 +29,27 @@ var $config = (function() {
var chunkBoundary = Random.randInt(this.numSplitPoints);
// We don't assert that the command succeeded when migrating a chunk because it's
- // possible another thread has already started migrating a chunk.
- db.adminCommand({
- moveChunk: db[collName].getFullName(),
- find: {key: chunkBoundary},
- to: shardName,
- _waitForDelete: true,
- });
+ // possible another thread has already started migrating a chunk. (see exception below)
+ try {
+ db.adminCommand({
+ moveChunk: db[collName].getFullName(),
+ find: {key: chunkBoundary},
+ to: shardName,
+ _waitForDelete: true,
+ });
+ } catch (ex) {
+ // SERVER-42781: if the runInsideTransaction TestOption is true
+ // then runCommandCheckForOperationNotSupportedInTransaction (in
+ // check_for_operation_not_supported_in_transaction.js) will assert that the command
+ // worked. We ignore the InvalidOptions error below since we can get this error due
+ // to concurrent moveChunks.
+ if (ex.code == ErrorCodes.InvalidOptions &&
+ ex.errmsg.valueOf() === "Destination shard cannot be the same as source") {
+ print(`ignored InvalidOptions exception: ${tojson(ex)}`);
+ } else {
+ throw ex;
+ }
+ }
},
dropIndex: function dropIndex(db, collName) {