diff options
author | Tess Avitabile <tess.avitabile@mongodb.com> | 2018-05-10 10:10:10 -0400 |
---|---|---|
committer | Tess Avitabile <tess.avitabile@mongodb.com> | 2018-05-15 16:01:49 -0400 |
commit | bae37257c81b34327db93208d31d4963ff6a8cc6 (patch) | |
tree | 0f437b0005e6cb78c6e117fe749e5c6c64bce195 /src | |
parent | 9df77c72447bad5fab1d2b40feda83749b3767db (diff) | |
download | mongo-bae37257c81b34327db93208d31d4963ff6a8cc6.tar.gz |
SERVER-34903 Allow killCursors within a transaction
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/commands/killcursors_cmd.cpp | 8 | ||||
-rw-r--r-- | src/mongo/db/service_entry_point_common.cpp | 1 | ||||
-rw-r--r-- | src/mongo/db/session.cpp | 1 |
3 files changed, 10 insertions, 0 deletions
diff --git a/src/mongo/db/commands/killcursors_cmd.cpp b/src/mongo/db/commands/killcursors_cmd.cpp index e3dd7de3d35..ae6056c3289 100644 --- a/src/mongo/db/commands/killcursors_cmd.cpp +++ b/src/mongo/db/commands/killcursors_cmd.cpp @@ -47,6 +47,14 @@ class KillCursorsCmd final : public KillCursorsCmdBase { public: KillCursorsCmd() = default; + bool supportsReadConcern(const std::string& dbName, + const BSONObj& cmdObj, + repl::ReadConcernLevel level) const final { + // killCursors must support snapshot read concern in order to be run in transactions. + return level == repl::ReadConcernLevel::kLocalReadConcern || + level == repl::ReadConcernLevel::kSnapshotReadConcern; + } + private: Status _checkAuth(Client* client, const NamespaceString& nss, CursorId id) const final { auto opCtx = client->getOperationContext(); diff --git a/src/mongo/db/service_entry_point_common.cpp b/src/mongo/db/service_entry_point_common.cpp index 5e29ff2d268..52c9ebab091 100644 --- a/src/mongo/db/service_entry_point_common.cpp +++ b/src/mongo/db/service_entry_point_common.cpp @@ -126,6 +126,7 @@ const StringMap<int> sessionCheckoutWhitelist = {{"abortTransaction", 1}, {"getMore", 1}, {"group", 1}, {"insert", 1}, + {"killCursors", 1}, {"mapReduce", 1}, {"parallelCollectionScan", 1}, {"prepareTransaction", 1}, diff --git a/src/mongo/db/session.cpp b/src/mongo/db/session.cpp index ebdf3be0237..956b8c2c101 100644 --- a/src/mongo/db/session.cpp +++ b/src/mongo/db/session.cpp @@ -106,6 +106,7 @@ const StringMap<int> txnCmdWhitelist = {{"abortTransaction", 1}, {"geoSearch", 1}, {"getMore", 1}, {"insert", 1}, + {"killCursors", 1}, {"prepareTransaction", 1}, {"update", 1}}; |