summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJudah Schvimer <judah@mongodb.com>2018-10-19 10:47:04 -0400
committerJudah Schvimer <judah@mongodb.com>2018-10-19 10:47:04 -0400
commit79891b6a82a9c65f7314a2c0c138f703559f1a36 (patch)
treee9dbd003060ea54e26f0f91e679ec5f2f5a0096e
parentb6369bcb52320d8f73e0d654cbec952180dd269a (diff)
downloadmongo-79891b6a82a9c65f7314a2c0c138f703559f1a36.tar.gz
SERVER-37569 prevent map-reduce from checking out a session
-rw-r--r--jstests/core/txns/commands_not_allowed_in_txn.js4
-rw-r--r--jstests/core/txns/statement_ids_accepted.js19
-rw-r--r--src/mongo/db/service_entry_point_common.cpp1
3 files changed, 9 insertions, 15 deletions
diff --git a/jstests/core/txns/commands_not_allowed_in_txn.js b/jstests/core/txns/commands_not_allowed_in_txn.js
index 85eac3cdab1..e2c1cc23e78 100644
--- a/jstests/core/txns/commands_not_allowed_in_txn.js
+++ b/jstests/core/txns/commands_not_allowed_in_txn.js
@@ -95,7 +95,6 @@
{applyOps: [{op: "u", ns: testColl.getFullName(), o2: {_id: 0}, o: {$set: {a: 5}}}]},
{explain: {find: collName}},
{filemd5: 1, root: "fs"},
- {mapReduce: collName, map: function() {}, reduce: function(key, vals) {}, out: "out"},
];
sessionCommands.forEach(testCommand);
@@ -116,7 +115,8 @@
createIndexes: collName,
indexes: [{name: "a_1", key: {a: 1}}],
writeConcern: {w: "majority"}
- }
+ },
+ {mapReduce: collName, map: function() {}, reduce: function(key, vals) {}, out: "out"},
];
nonSessionCommands.forEach(testCommand);
diff --git a/jstests/core/txns/statement_ids_accepted.js b/jstests/core/txns/statement_ids_accepted.js
index 689fff75013..ff76adc15af 100644
--- a/jstests/core/txns/statement_ids_accepted.js
+++ b/jstests/core/txns/statement_ids_accepted.js
@@ -167,24 +167,19 @@
insert: collName,
documents: [{_id: "doc1"}],
readConcern: {level: "snapshot"},
- txnNumber: NumberLong(txnNumber++),
+ txnNumber: NumberLong(txnNumber),
stmtId: NumberInt(0),
startTransaction: true,
autocommit: false
}));
- jsTestLog("Check that mapreduce accepts a statement ID");
- assert.commandWorked(sessionDb.runCommand({
- mapreduce: collName,
- map: function() {
- emit(this, this);
- },
- reduce: function(key, values) {
- return key;
- },
- out: {inline: 1},
+ // Abort the transaction to release locks.
+ // abortTransaction can only be run on the admin database.
+ assert.commandWorked(sessionDb.adminCommand({
+ abortTransaction: 1,
txnNumber: NumberLong(txnNumber++),
- stmtId: NumberInt(0)
+ stmtId: NumberInt(1),
+ autocommit: false
}));
const isMongos = assert.commandWorked(db.runCommand("ismaster")).msg === "isdbgrid";
diff --git a/src/mongo/db/service_entry_point_common.cpp b/src/mongo/db/service_entry_point_common.cpp
index 0dcb4b89dbe..7427a07bb81 100644
--- a/src/mongo/db/service_entry_point_common.cpp
+++ b/src/mongo/db/service_entry_point_common.cpp
@@ -124,7 +124,6 @@ const StringMap<int> sessionCommandAutomaticCheckOutWhiteList = {
{"group", 1},
{"insert", 1},
{"killCursors", 1},
- {"mapReduce", 1},
{"prepareTransaction", 1},
{"refreshLogicalSessionCacheNow", 1},
{"update", 1}};