diff options
author | Spencer Jackson <spencer.jackson@mongodb.com> | 2016-07-11 13:50:21 -0400 |
---|---|---|
committer | Spencer Jackson <spencer.jackson@mongodb.com> | 2016-07-29 15:51:21 -0400 |
commit | 9380a1c12a19a061eaafabb5f6b9e87f16a28179 (patch) | |
tree | 9d2dec0ecb977c7555f9d74108da3a4c68586cad /src/mongo/db/service_context.cpp | |
parent | 3cca3da0ad890c8272f56e18f8066c472b2a25f4 (diff) | |
download | mongo-9380a1c12a19a061eaafabb5f6b9e87f16a28179.tar.gz |
SERVER-17856: Allow mongod users to currentOp and killOp own operations
Diffstat (limited to 'src/mongo/db/service_context.cpp')
-rw-r--r-- | src/mongo/db/service_context.cpp | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/src/mongo/db/service_context.cpp b/src/mongo/db/service_context.cpp index 648fd546721..585ffefb430 100644 --- a/src/mongo/db/service_context.cpp +++ b/src/mongo/db/service_context.cpp @@ -294,7 +294,7 @@ void ServiceContext::setKillAllOperations() { } } -void ServiceContext::_killOperation_inlock(OperationContext* opCtx, ErrorCodes::Error killCode) { +void ServiceContext::killOperation(OperationContext* opCtx, ErrorCodes::Error killCode) { opCtx->markKilled(killCode); for (const auto listener : _killOpListeners) { @@ -306,20 +306,6 @@ void ServiceContext::_killOperation_inlock(OperationContext* opCtx, ErrorCodes:: } } -bool ServiceContext::killOperation(unsigned int opId) { - for (LockedClientsCursor cursor(this); Client* client = cursor.next();) { - stdx::lock_guard<Client> lk(*client); - - OperationContext* opCtx = client->getOperationContext(); - if (opCtx && opCtx->getOpID() == opId) { - _killOperation_inlock(opCtx, ErrorCodes::Interrupted); - return true; - } - } - - return false; -} - void ServiceContext::killAllUserOperations(const OperationContext* txn, ErrorCodes::Error killCode) { for (LockedClientsCursor cursor(this); Client* client = cursor.next();) { @@ -333,7 +319,7 @@ void ServiceContext::killAllUserOperations(const OperationContext* txn, // Don't kill ourself. if (toKill && toKill->getOpID() != txn->getOpID()) { - _killOperation_inlock(toKill, killCode); + killOperation(toKill, killCode); } } } |