diff options
author | Misha Tyulenev <misha.tyulenev@mongodb.com> | 2020-08-12 17:27:23 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-08-13 00:17:26 +0000 |
commit | d207e25f0d3b9622af48814d981578e99e8256b6 (patch) | |
tree | 65ba6a566655f520deddc01b91983844abfe8996 /jstests | |
parent | 7e861939b980d60914baba215f56d5a4c4cb1f21 (diff) | |
download | mongo-d207e25f0d3b9622af48814d981578e99e8256b6.tar.gz |
SERVER-49765 fail with MovePrimaryInProgress for dropIndexes
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/sharding/move_primary_with_writes.js | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/jstests/sharding/move_primary_with_writes.js b/jstests/sharding/move_primary_with_writes.js index 7f0a9b63bcf..18608b09bd4 100644 --- a/jstests/sharding/move_primary_with_writes.js +++ b/jstests/sharding/move_primary_with_writes.js @@ -1,6 +1,6 @@ /** * The failpoints used here are not defined in the previous release (4.4). - * @tags: [multiversion_incompatible] + * @tags: [multiversion_incompatible, does_not_support_stepdowns] */ (function() { 'use strict'; @@ -25,11 +25,11 @@ function createCollections() { let otherDb = st.getDB(otherDbName); const unshardedFooIndexes = [ - {key: {a: 1}, name: 'fooIndex_a'}, + {key: {a: 1}, name: 'unshardedFooIndex'}, {key: {c: 1}, name: 'fooTTL_c', expireAfterSeconds: 1800} ]; const shardedBarIndexes = [ - {key: {a: 1}, name: 'barIndex_a'}, + {key: {a: 1}, name: 'shardedBarIndex'}, {key: {c: 1}, name: 'barTTL_c', expireAfterSeconds: 1800} ]; @@ -136,6 +136,10 @@ function buildCommands(collName, shouldFail) { }, {command: {create: "testCollection"}, shouldFail: true}, { + command: {create: "testView", viewOn: collName, pipeline: [{$match: {}}]}, + shouldFail: false + }, + { command: {createIndexes: collName, indexes: [{key: {b: 1}, name: collName + "Idx_b"}]}, shouldFail: shouldFail }, @@ -143,7 +147,22 @@ function buildCommands(collName, shouldFail) { command: {collMod: collName, index: {keyPattern: {c: 1}, expireAfterSeconds: 3600}}, shouldFail: shouldFail }, - {command: {convertToCapped: "unshardedFoo", size: 1000000}, shouldFail: true} + { + command: {collMod: collName + "View", viewOn: collName, pipeline: [{$match: {_id: 1}}]}, + shouldFail: false + }, + {command: {convertToCapped: "unshardedFoo", size: 1000000}, shouldFail: true}, + {command: {dropIndexes: collName, index: collName + "Index"}, shouldFail: shouldFail}, + { + command: {drop: collName}, + shouldFail: true, + errorCodes: [ErrorCodes.LockBusy, ErrorCodes.InterruptedDueToReplStateChange] + }, + { + command: {dropDatabase: 1}, + shouldFail: true, + errorCodes: [ErrorCodes.LockBusy, ErrorCodes.InterruptedDueToReplStateChange] + }, ]; return commands; } @@ -182,8 +201,13 @@ function testMovePrimary(failpoint, fromShard, toShard, db, shouldFail, sharded) if (shouldFail && commandObj.shouldFail) { jsTestLog("running command: " + tojson(commandObj.command) + ",\nshoudFail: " + shouldFail); - assert.commandFailedWithCode(db.runCommand(commandObj.command), - ErrorCodes.MovePrimaryInProgress); + if (commandObj.hasOwnProperty("errorCodes")) { + assert.commandFailedWithCode(db.runCommand(commandObj.command), + commandObj.errorCodes); + } else { + assert.commandFailedWithCode(db.runCommand(commandObj.command), + ErrorCodes.MovePrimaryInProgress); + } } else if (!shouldFail && !commandObj.shouldFail) { jsTestLog("running command: " + tojson(commandObj.command) + ",\nshoudFail: " + shouldFail); |