diff options
author | Benety Goh <benety@mongodb.com> | 2020-07-17 15:26:30 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-09-09 18:52:51 +0000 |
commit | 5b6c64a1d0ee28ad04556cab8743ef9d73c8871a (patch) | |
tree | 7b3ceb42392c7a76454bf623056d3a621ecc0156 | |
parent | 18914660730f29d262906ee3cf5dc1d90426badf (diff) | |
download | mongo-5b6c64a1d0ee28ad04556cab8743ef9d73c8871a.tar.gz |
SERVER-49521 fix writeConcern for non-txn createIndexes commands in core/txns tests
(cherry picked from commit 2a4a2def40803f7dbdfa3ec21f0c178a5a16e259)
3 files changed, 14 insertions, 4 deletions
diff --git a/jstests/core/txns/noop_createIndexes_not_blocked_by_txn.js b/jstests/core/txns/noop_createIndexes_not_blocked_by_txn.js index 675db8b65f3..7bf28c77036 100644 --- a/jstests/core/txns/noop_createIndexes_not_blocked_by_txn.js +++ b/jstests/core/txns/noop_createIndexes_not_blocked_by_txn.js @@ -20,7 +20,8 @@ if (isMongos) { const createIndexesCommand = { createIndexes: collName, - indexes: [{key: {a: 1}, name: "a_1"}] + indexes: [{key: {a: 1}, name: "a_1"}], + writeConcern: {w: 'majority'}, }; assert.commandWorked(sessionDB.runCommand(createIndexesCommand)); diff --git a/jstests/core/txns/prepared_transactions_do_not_block_non_conflicting_ddl.js b/jstests/core/txns/prepared_transactions_do_not_block_non_conflicting_ddl.js index 0458f213960..1f13af52e0f 100644 --- a/jstests/core/txns/prepared_transactions_do_not_block_non_conflicting_ddl.js +++ b/jstests/core/txns/prepared_transactions_do_not_block_non_conflicting_ddl.js @@ -40,7 +40,8 @@ testSuccess(otherDBName, createCmd); jsTest.log("Test 'createIndexes'."); const createIndexesCmd = { createIndexes: collName, - indexes: [{key: {x: 1}, name: "x_1"}] + indexes: [{key: {x: 1}, name: "x_1"}], + writeConcern: {w: 'majority'}, }; testSuccess(otherDBName, createIndexesCmd); @@ -51,7 +52,11 @@ const dropIndexesCmd = { }; testSuccess(otherDBName, dropIndexesCmd); -sessionColl.createIndex({multiKeyField: 1}); +assert.commandWorked(sessionDB.runCommand({ + createIndexes: collName, + indexes: [{name: 'multiKeyField_1', key: {multiKeyField: 1}}], + writeConcern: {w: 'majority'}, +})); jsTest.log("Test 'insert' that enables multi-key index on the same collection."); const insertAndSetMultiKeyCmd = { insert: collName, diff --git a/jstests/core/txns/read_own_multikey_writes.js b/jstests/core/txns/read_own_multikey_writes.js index 9af97dc4baa..a807b7399f7 100644 --- a/jstests/core/txns/read_own_multikey_writes.js +++ b/jstests/core/txns/read_own_multikey_writes.js @@ -16,7 +16,11 @@ const sessionColl = sessionDb.getCollection(collName); assert.commandWorked(sessionDb.runCommand({create: collName})); assert.writeOK(sessionColl.insert({a: 1})); -assert.commandWorked(sessionColl.createIndex({a: 1})); +assert.commandWorked(sessionDb.runCommand({ + createIndexes: collName, + indexes: [{name: 'a_1', key: {a: 1}}], + writeConcern: {w: 'majority'}, +})); session.startTransaction(); assert.writeOK(sessionColl.update({}, {$set: {a: [1, 2, 3]}})); |