summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands
diff options
context:
space:
mode:
authorJason Carey <jcarey@argv.me>2019-01-23 16:37:35 -0500
committerJason Carey <jcarey@argv.me>2019-02-10 12:23:18 -0500
commitc922cb18516981ceca59993331296d102f4e01fb (patch)
treea066a8b4d05cb37b1dee9dde34d9366f6ece0a2f /src/mongo/db/commands
parentc467b79f46ea23f40669eb06f0d2698bc640c997 (diff)
downloadmongo-c922cb18516981ceca59993331296d102f4e01fb.tar.gz
SERVER-39150 markKillOnClientDisconnect
Diffstat (limited to 'src/mongo/db/commands')
-rw-r--r--src/mongo/db/commands/authentication_commands.cpp2
-rw-r--r--src/mongo/db/commands/count_cmd.cpp1
-rw-r--r--src/mongo/db/commands/distinct.cpp1
-rw-r--r--src/mongo/db/commands/find_cmd.cpp1
-rw-r--r--src/mongo/db/commands/list_collections.cpp1
-rw-r--r--src/mongo/db/commands/list_databases.cpp1
-rw-r--r--src/mongo/db/commands/list_indexes.cpp1
-rw-r--r--src/mongo/db/commands/pipeline_command.cpp3
8 files changed, 11 insertions, 0 deletions
diff --git a/src/mongo/db/commands/authentication_commands.cpp b/src/mongo/db/commands/authentication_commands.cpp
index b5c6ac9c4c6..7aeaf8d279c 100644
--- a/src/mongo/db/commands/authentication_commands.cpp
+++ b/src/mongo/db/commands/authentication_commands.cpp
@@ -232,6 +232,7 @@ public:
const std::string&,
const BSONObj& cmdObj,
BSONObjBuilder& result) final {
+ CommandHelpers::handleMarkKillOnClientDisconnect(opCtx);
auto n = getNextNonce();
std::stringstream ss;
ss << std::hex << n;
@@ -253,6 +254,7 @@ bool CmdAuthenticate::run(OperationContext* opCtx,
const std::string& dbname,
const BSONObj& cmdObj,
BSONObjBuilder& result) {
+ CommandHelpers::handleMarkKillOnClientDisconnect(opCtx);
if (!serverGlobalParams.quiet.load()) {
mutablebson::Document cmdToLog(cmdObj, mutablebson::Document::kInPlaceDisabled);
log() << " authenticate db: " << dbname << " " << cmdToLog;
diff --git a/src/mongo/db/commands/count_cmd.cpp b/src/mongo/db/commands/count_cmd.cpp
index 818ea1400e4..6b80f8016d7 100644
--- a/src/mongo/db/commands/count_cmd.cpp
+++ b/src/mongo/db/commands/count_cmd.cpp
@@ -180,6 +180,7 @@ public:
const string& dbname,
const BSONObj& cmdObj,
BSONObjBuilder& result) override {
+ CommandHelpers::handleMarkKillOnClientDisconnect(opCtx);
// Acquire locks and resolve possible UUID. The RAII object is optional, because in the case
// of a view, the locks need to be released.
boost::optional<AutoGetCollectionForReadCommand> ctx;
diff --git a/src/mongo/db/commands/distinct.cpp b/src/mongo/db/commands/distinct.cpp
index f26feb2cf80..580f15206a6 100644
--- a/src/mongo/db/commands/distinct.cpp
+++ b/src/mongo/db/commands/distinct.cpp
@@ -168,6 +168,7 @@ public:
const std::string& dbname,
const BSONObj& cmdObj,
BSONObjBuilder& result) override {
+ CommandHelpers::handleMarkKillOnClientDisconnect(opCtx);
// Acquire locks and resolve possible UUID. The RAII object is optional, because in the case
// of a view, the locks need to be released.
boost::optional<AutoGetCollectionForReadCommand> ctx;
diff --git a/src/mongo/db/commands/find_cmd.cpp b/src/mongo/db/commands/find_cmd.cpp
index e9a20684a6b..a73aef6375a 100644
--- a/src/mongo/db/commands/find_cmd.cpp
+++ b/src/mongo/db/commands/find_cmd.cpp
@@ -229,6 +229,7 @@ public:
* --Generate response to send to the client.
*/
void run(OperationContext* opCtx, rpc::ReplyBuilderInterface* result) {
+ CommandHelpers::handleMarkKillOnClientDisconnect(opCtx);
// Although it is a command, a find command gets counted as a query.
globalOpCounters.gotQuery();
ServerReadConcernMetrics::get(opCtx)->recordReadConcern(
diff --git a/src/mongo/db/commands/list_collections.cpp b/src/mongo/db/commands/list_collections.cpp
index a702a8f6807..df886abf938 100644
--- a/src/mongo/db/commands/list_collections.cpp
+++ b/src/mongo/db/commands/list_collections.cpp
@@ -247,6 +247,7 @@ public:
const string& dbname,
const BSONObj& jsobj,
BSONObjBuilder& result) final {
+ CommandHelpers::handleMarkKillOnClientDisconnect(opCtx);
unique_ptr<MatchExpression> matcher;
const auto as = AuthorizationSession::get(opCtx->getClient());
diff --git a/src/mongo/db/commands/list_databases.cpp b/src/mongo/db/commands/list_databases.cpp
index 7e2adf2ee1b..c212403535f 100644
--- a/src/mongo/db/commands/list_databases.cpp
+++ b/src/mongo/db/commands/list_databases.cpp
@@ -96,6 +96,7 @@ public:
const string& dbname,
const BSONObj& cmdObj,
BSONObjBuilder& result) final {
+ CommandHelpers::handleMarkKillOnClientDisconnect(opCtx);
IDLParserErrorContext ctx("listDatabases");
auto cmd = ListDatabasesCommand::parse(ctx, cmdObj);
auto* as = AuthorizationSession::get(opCtx->getClient());
diff --git a/src/mongo/db/commands/list_indexes.cpp b/src/mongo/db/commands/list_indexes.cpp
index 2210639210d..8c4b15606dc 100644
--- a/src/mongo/db/commands/list_indexes.cpp
+++ b/src/mongo/db/commands/list_indexes.cpp
@@ -128,6 +128,7 @@ public:
const string& dbname,
const BSONObj& cmdObj,
BSONObjBuilder& result) {
+ CommandHelpers::handleMarkKillOnClientDisconnect(opCtx);
const long long defaultBatchSize = std::numeric_limits<long long>::max();
long long batchSize;
uassertStatusOK(
diff --git a/src/mongo/db/commands/pipeline_command.cpp b/src/mongo/db/commands/pipeline_command.cpp
index ef5dc99606b..06a91ad79f0 100644
--- a/src/mongo/db/commands/pipeline_command.cpp
+++ b/src/mongo/db/commands/pipeline_command.cpp
@@ -97,6 +97,9 @@ public:
}
void run(OperationContext* opCtx, rpc::ReplyBuilderInterface* reply) override {
+ CommandHelpers::handleMarkKillOnClientDisconnect(
+ opCtx, !Pipeline::aggSupportsWriteConcern(_request.body));
+
const auto aggregationRequest = uassertStatusOK(
AggregationRequest::parseFromBSON(_dbName, _request.body, boost::none));
uassertStatusOK(runAggregate(opCtx,