diff options
author | Leonardo Menti <leonardo.menti@mongodb.com> | 2022-08-25 16:03:45 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-08-25 17:22:59 +0000 |
commit | d6a7a5f9cf7e98bd378006a4bab504b4e38c87ac (patch) | |
tree | a7cd09de637aef4c10ec86e4555597aa40953b70 | |
parent | 8da4f60772acaebf6e561a9d5c5b527457559eca (diff) | |
download | mongo-d6a7a5f9cf7e98bd378006a4bab504b4e38c87ac.tar.gz |
SERVER-68585 Integrate AcquisitionPriority to the Locker
-rw-r--r-- | src/mongo/db/concurrency/lock_state.h | 4 | ||||
-rw-r--r-- | src/mongo/db/concurrency/locker.h | 11 |
2 files changed, 7 insertions, 8 deletions
diff --git a/src/mongo/db/concurrency/lock_state.h b/src/mongo/db/concurrency/lock_state.h index 4664bb2c72f..392d0f7ef6d 100644 --- a/src/mongo/db/concurrency/lock_state.h +++ b/src/mongo/db/concurrency/lock_state.h @@ -36,7 +36,6 @@ #include "mongo/db/concurrency/locker.h" #include "mongo/db/operation_context.h" #include "mongo/platform/atomic_word.h" -#include "mongo/util/concurrency/admission_context.h" #include "mongo/util/concurrency/spin_lock.h" #include "mongo/util/concurrency/ticketholder.h" @@ -377,9 +376,6 @@ private: // A structure for accumulating time spent getting flow control tickets. FlowControlTicketholder::CurOp _flowControlStats; - // Keeps state and statistics related to admission control. - AdmissionContext _admCtx; - // The global ticketholders of the service context. TicketHolder* _ticketHolder; diff --git a/src/mongo/db/concurrency/locker.h b/src/mongo/db/concurrency/locker.h index b9faf273eac..fdb7d816da3 100644 --- a/src/mongo/db/concurrency/locker.h +++ b/src/mongo/db/concurrency/locker.h @@ -37,6 +37,7 @@ #include "mongo/db/concurrency/lock_stats.h" #include "mongo/db/operation_context.h" #include "mongo/stdx/thread.h" +#include "mongo/util/concurrency/admission_context.h" namespace mongo { @@ -514,16 +515,16 @@ public: void skipAcquireTicket() { // Should not hold or wait for the ticket. invariant(isNoop() || getClientState() == Locker::ClientState::kInactive); - _shouldAcquireTicket = false; + _admCtx.setPriority(AdmissionContext::AcquisitionPriority::kHigh); } void setAcquireTicket() { // Should hold or wait for the ticket. invariant(isNoop() || getClientState() == Locker::ClientState::kInactive); - _shouldAcquireTicket = true; + _admCtx.setPriority(AdmissionContext::AcquisitionPriority::kNormal); } bool shouldAcquireTicket() const { - return _shouldAcquireTicket; + return _admCtx.getPriority() != AdmissionContext::AcquisitionPriority::kHigh; } /** @@ -571,11 +572,13 @@ protected: */ unsigned _numResourcesToUnlockAtEndUnitOfWork = 0; + // Keeps state and statistics related to admission control. + AdmissionContext _admCtx; + private: bool _shouldConflictWithSecondaryBatchApplication = true; bool _shouldConflictWithSetFeatureCompatibilityVersion = true; bool _shouldAllowLockAcquisitionOnTimestampedUnitOfWork = false; - bool _shouldAcquireTicket = true; std::string _debugInfo; // Extra info about this locker for debugging purpose }; |