summaryrefslogtreecommitdiff
path: root/src/mongo/db/operation_context.cpp
diff options
context:
space:
mode:
authorAmirsaman Memaripour <amirsaman.memaripour@mongodb.com>2020-03-12 17:05:05 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-03-24 04:32:03 +0000
commitef75364ada70eaf4a096ed07adfeb3175abd719b (patch)
tree51fdaba76229875086d6e1c32889da230f92b9e4 /src/mongo/db/operation_context.cpp
parent30bd61a92cd4c8d6dd5588b59b9bdf4a0cd3c7d8 (diff)
downloadmongo-ef75364ada70eaf4a096ed07adfeb3175abd719b.tar.gz
SERVER-46841 Make PeriodicRunner interrupt blocked operations on stop
Diffstat (limited to 'src/mongo/db/operation_context.cpp')
-rw-r--r--src/mongo/db/operation_context.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/mongo/db/operation_context.cpp b/src/mongo/db/operation_context.cpp
index ee38faab01b..a0bee37b49b 100644
--- a/src/mongo/db/operation_context.cpp
+++ b/src/mongo/db/operation_context.cpp
@@ -203,10 +203,17 @@ bool opShouldFail(Client* client, const BSONObj& failPointInfo) {
} // namespace
Status OperationContext::checkForInterruptNoAssert() noexcept {
- // TODO: Remove the MONGO_likely(getClient()) once all operation contexts are constructed with
- // clients.
- if (MONGO_likely(getClient() && getServiceContext()) &&
- getServiceContext()->getKillAllOperations() && !_isExecutingShutdown) {
+ // TODO: Remove the MONGO_likely(hasClientAndServiceContext) once all operation contexts are
+ // constructed with clients.
+ const auto hasClientAndServiceContext = getClient() && getServiceContext();
+
+ if (MONGO_likely(hasClientAndServiceContext) && getClient()->getKilled() &&
+ !_isExecutingShutdown) {
+ return Status(ErrorCodes::ClientMarkedKilled, "client has been killed");
+ }
+
+ if (MONGO_likely(hasClientAndServiceContext) && getServiceContext()->getKillAllOperations() &&
+ !_isExecutingShutdown) {
return Status(ErrorCodes::InterruptedAtShutdown, "interrupted at shutdown");
}