summaryrefslogtreecommitdiff
path: root/src/mongo/db/concurrency
diff options
context:
space:
mode:
authorLouis Williams <louis.williams@mongodb.com>2023-03-28 11:58:12 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-03-28 13:31:34 +0000
commit3e46a0ef81dfe95c11d9c5324fb86758b155363d (patch)
tree4765dcec524645178d080d79fca5db2ceb302a34 /src/mongo/db/concurrency
parenta6ac9a1fe19da49b7067e802bf498d7fc0dcb5af (diff)
downloadmongo-3e46a0ef81dfe95c11d9c5324fb86758b155363d.tar.gz
SERVER-74778 Refactor and improve performance of PriorityTicketHolder
Diffstat (limited to 'src/mongo/db/concurrency')
-rw-r--r--src/mongo/db/concurrency/lock_state.cpp9
1 files changed, 1 insertions, 8 deletions
diff --git a/src/mongo/db/concurrency/lock_state.cpp b/src/mongo/db/concurrency/lock_state.cpp
index d2e4a513182..42c8c9e1ef4 100644
--- a/src/mongo/db/concurrency/lock_state.cpp
+++ b/src/mongo/db/concurrency/lock_state.cpp
@@ -380,8 +380,6 @@ void LockerImpl::reacquireTicket(OperationContext* opCtx) {
}
bool LockerImpl::_acquireTicket(OperationContext* opCtx, LockMode mode, Date_t deadline) {
- _admCtx.setLockMode(mode);
-
// Upon startup, the holder is not guaranteed to be initialized.
auto holder = _ticketHolderManager ? _ticketHolderManager->getTicketHolder(mode) : nullptr;
const bool reader = isSharedLockMode(mode);
@@ -392,17 +390,13 @@ bool LockerImpl::_acquireTicket(OperationContext* opCtx, LockMode mode, Date_t d
// MODE_X is exclusive of all other locks, thus acquiring a ticket is unnecessary.
_clientState.store(reader ? kQueuedReader : kQueuedWriter);
// If the ticket wait is interrupted, restore the state of the client.
- ScopeGuard restoreStateOnErrorGuard([&] {
- _clientState.store(kInactive);
- _admCtx.setLockMode(MODE_NONE);
- });
+ ScopeGuard restoreStateOnErrorGuard([&] { _clientState.store(kInactive); });
// Acquiring a ticket is a potentially blocking operation. This must not be called after a
// transaction timestamp has been set, indicating this transaction has created an oplog
// hole.
invariant(!opCtx->recoveryUnit()->isTimestamped());
- _admCtx.setLockMode(mode);
if (auto ticket = holder->waitForTicketUntil(
_uninterruptibleLocksRequested ? nullptr : opCtx, &_admCtx, deadline)) {
_ticket = std::move(*ticket);
@@ -1112,7 +1106,6 @@ void LockerImpl::releaseTicket() {
void LockerImpl::_releaseTicket() {
_ticket.reset();
- _admCtx.setLockMode(MODE_NONE);
_clientState.store(kInactive);
}