diff options
author | Gregory Wlodarek <gregory.wlodarek@mongodb.com> | 2020-02-14 18:40:50 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-02-15 15:21:43 +0000 |
commit | 2a21a10de4811ccf12bab99f754a36afacf95f2b (patch) | |
tree | 76aa50037164ebadb698ab79a21d974f8a59cd93 | |
parent | 5dc54d468de771439ed1ede394ad949502c0e99c (diff) | |
download | mongo-2a21a10de4811ccf12bab99f754a36afacf95f2b.tar.gz |
SERVER-37726 Concurrency suites creating and dropping indexes should expect the IndexBuildAborted error code
7 files changed, 37 insertions, 23 deletions
diff --git a/jstests/concurrency/fsm_workloads/create_index_background_unique.js b/jstests/concurrency/fsm_workloads/create_index_background_unique.js index 4b4c50fd18e..29edb076ee3 100644 --- a/jstests/concurrency/fsm_workloads/create_index_background_unique.js +++ b/jstests/concurrency/fsm_workloads/create_index_background_unique.js @@ -37,14 +37,16 @@ var $config = (function() { }); // Multi-statement Transactions can fail with SnapshotUnavailable if there are // pending catalog changes as of the transaction start (see SERVER-43018). - assertWorkedOrFailedHandleTxnErrors(res, - [ - ErrorCodes.IndexBuildAlreadyInProgress, - ErrorCodes.SnapshotUnavailable, - ErrorCodes.SnapshotTooOld, - ErrorCodes.NotMaster - ], - [ErrorCodes.NotMaster]); + assertWorkedOrFailedHandleTxnErrors( + res, + [ + ErrorCodes.IndexBuildAborted, + ErrorCodes.IndexBuildAlreadyInProgress, + ErrorCodes.SnapshotUnavailable, + ErrorCodes.SnapshotTooOld, + ErrorCodes.NotMaster + ], + [ErrorCodes.IndexBuildAborted, ErrorCodes.NotMaster]); } function dropIndex(db, collName) { diff --git a/jstests/concurrency/fsm_workloads/drop_index_during_replan.js b/jstests/concurrency/fsm_workloads/drop_index_during_replan.js index 3444b8eac33..c911079345d 100644 --- a/jstests/concurrency/fsm_workloads/drop_index_during_replan.js +++ b/jstests/concurrency/fsm_workloads/drop_index_during_replan.js @@ -46,7 +46,8 @@ var $config = (function() { db[collName].dropIndex({b: 1}); // Recreate the index that was dropped. - assertAlways.commandWorked(db[collName].createIndex({b: 1})); + assertAlways.commandWorkedOrFailedWithCode(db[collName].createIndex({b: 1}), + [ErrorCodes.IndexBuildAborted]); } }; diff --git a/jstests/concurrency/fsm_workloads/invalidated_cursors.js b/jstests/concurrency/fsm_workloads/invalidated_cursors.js index 9279ede24e1..1db6e8bc954 100644 --- a/jstests/concurrency/fsm_workloads/invalidated_cursors.js +++ b/jstests/concurrency/fsm_workloads/invalidated_cursors.js @@ -44,7 +44,10 @@ var $config = (function() { this.indexSpecs.forEach(indexSpec => { let res = db[collName].createIndex(indexSpec); - assertWorkedHandleTxnErrors(res, ErrorCodes.IndexBuildAlreadyInProgress); + assertWorkedOrFailedHandleTxnErrors( + res, + [ErrorCodes.IndexBuildAborted, ErrorCodes.IndexBuildAlreadyInProgress], + [ErrorCodes.IndexBuildAborted]); }); }, @@ -235,7 +238,8 @@ var $config = (function() { myDB[targetColl].dropIndex(indexSpec); // Re-create the index that was dropped. - assertAlways.commandWorked(myDB[targetColl].createIndex(indexSpec)); + assertAlways.commandWorkedOrFailedWithCode(myDB[targetColl].createIndex(indexSpec), + [ErrorCodes.IndexBuildAborted]); } }; diff --git a/jstests/concurrency/fsm_workloads/kill_rooted_or.js b/jstests/concurrency/fsm_workloads/kill_rooted_or.js index 0ceb1f71359..75e7d5984e7 100644 --- a/jstests/concurrency/fsm_workloads/kill_rooted_or.js +++ b/jstests/concurrency/fsm_workloads/kill_rooted_or.js @@ -61,12 +61,14 @@ var $config = (function() { // Recreate the index that was dropped. (See populateIndexes() for why we ignore the // CannotImplicitlyCreateCollection error.) let res = db[this.collName].createIndex(indexSpec); - assertWorkedOrFailedHandleTxnErrors(res, - [ - ErrorCodes.CannotImplicitlyCreateCollection, - ErrorCodes.IndexBuildAlreadyInProgress - ], - ErrorCodes.CannotImplicitlyCreateCollection); + assertWorkedOrFailedHandleTxnErrors( + res, + [ + ErrorCodes.CannotImplicitlyCreateCollection, + ErrorCodes.IndexBuildAborted, + ErrorCodes.IndexBuildAlreadyInProgress + ], + [ErrorCodes.CannotImplicitlyCreateCollection, ErrorCodes.IndexBuildAborted]); } }; diff --git a/jstests/concurrency/fsm_workloads/plan_cache_drop_database.js b/jstests/concurrency/fsm_workloads/plan_cache_drop_database.js index 58cc84f9582..c4cb0e01082 100644 --- a/jstests/concurrency/fsm_workloads/plan_cache_drop_database.js +++ b/jstests/concurrency/fsm_workloads/plan_cache_drop_database.js @@ -22,8 +22,10 @@ var $config = (function() { // Create two indexes to force plan caching: The {a: 1} index is // cached by the query planner because we query on a single value // of 'a' and a range of 'b' values. - assertAlways.commandWorked(coll.ensureIndex({a: 1})); - assertAlways.commandWorked(coll.ensureIndex({b: 1})); + assertAlways.commandWorkedOrFailedWithCode(coll.ensureIndex({a: 1}), + [ErrorCodes.IndexBuildAborted]); + assertAlways.commandWorkedOrFailedWithCode(coll.ensureIndex({b: 1}), + [ErrorCodes.IndexBuildAborted]); } var states = (function() { diff --git a/jstests/concurrency/fsm_workloads/secondary_reads_with_catalog_changes.js b/jstests/concurrency/fsm_workloads/secondary_reads_with_catalog_changes.js index 797b978ce98..ed0dc35f23c 100644 --- a/jstests/concurrency/fsm_workloads/secondary_reads_with_catalog_changes.js +++ b/jstests/concurrency/fsm_workloads/secondary_reads_with_catalog_changes.js @@ -33,9 +33,10 @@ var $config = extendWorkload($config, function($config, $super) { {x: 1}, {unique: true, background: Random.rand() < 0.5}); if (TestData.runInsideTransaction) { assertWhenOwnColl.commandWorkedOrFailedWithCode( - res, ErrorCodes.IndexBuildAlreadyInProgress); + res, [ErrorCodes.IndexBuildAborted, ErrorCodes.IndexBuildAlreadyInProgress]); } else { - assertWhenOwnColl.commandWorked(res); + assertWhenOwnColl.commandWorkedOrFailedWithCode(res, + [ErrorCodes.IndexBuildAborted]); } } }; 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 17f328ee8ed..3d293dca6ae 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 @@ -58,8 +58,10 @@ var $config = (function() { db[collName].dropIndex(this.shardKey); // Re-create the index that was dropped. - assertWorkedHandleTxnErrors(db[collName].createIndex(this.shardKey), - ErrorCodes.IndexBuildAlreadyInProgress); + assertWorkedOrFailedHandleTxnErrors( + db[collName].createIndex(this.shardKey), + [ErrorCodes.IndexBuildAborted, ErrorCodes.IndexBuildAlreadyInProgress], + [ErrorCodes.IndexBuildAborted]); } }; |