summaryrefslogtreecommitdiff
path: root/src/mongo/db/concurrency/lock_state.cpp
diff options
context:
space:
mode:
authorDaniel Gottlieb <daniel.gottlieb@mongodb.com>2019-03-17 19:56:41 -0400
committerDaniel Gottlieb <daniel.gottlieb@mongodb.com>2019-03-17 19:56:41 -0400
commit564cfd0ede845a9c20280a352c544b36f6b74471 (patch)
treea9d01cbeed05ea871a166042c3cd532b5f149ac7 /src/mongo/db/concurrency/lock_state.cpp
parent58ff5248610305a35403020077a4dbdcd0691ff0 (diff)
downloadmongo-564cfd0ede845a9c20280a352c544b36f6b74471.tar.gz
SERVER-39673: Add flow control under a feature flag.
Diffstat (limited to 'src/mongo/db/concurrency/lock_state.cpp')
-rw-r--r--src/mongo/db/concurrency/lock_state.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/mongo/db/concurrency/lock_state.cpp b/src/mongo/db/concurrency/lock_state.cpp
index b3893be3983..ab49d9f878e 100644
--- a/src/mongo/db/concurrency/lock_state.cpp
+++ b/src/mongo/db/concurrency/lock_state.cpp
@@ -35,8 +35,10 @@
#include <vector>
+#include "mongo/db/concurrency/flow_control_ticketholder.h"
#include "mongo/db/namespace_string.h"
#include "mongo/db/service_context.h"
+#include "mongo/db/storage/flow_control.h"
#include "mongo/platform/compiler.h"
#include "mongo/stdx/new.h"
#include "mongo/util/background.h"
@@ -735,6 +737,13 @@ void LockerImpl::restoreLockState(OperationContext* opCtx, const Locker::LockSna
invariant(!inAWriteUnitOfWork());
invariant(_modeForTicket == MODE_NONE);
+ if (opCtx && (state.globalMode == LockMode::MODE_IX)) {
+ auto ticketholder = FlowControlTicketholder::get(opCtx);
+ if (ticketholder) {
+ ticketholder->getTicket(opCtx);
+ }
+ }
+
std::vector<OneLock>::const_iterator it = state.locks.begin();
// If we locked the PBWM, it must be locked before the resourceIdGlobal and
// resourceIdReplicationStateTransitionLock resources.
@@ -1003,5 +1012,4 @@ const ResourceId resourceIdParallelBatchWriterMode =
ResourceId(RESOURCE_GLOBAL, ResourceId::SINGLETON_PARALLEL_BATCH_WRITER_MODE);
const ResourceId resourceIdReplicationStateTransitionLock =
ResourceId(RESOURCE_GLOBAL, ResourceId::SINGLETON_REPLICATION_STATE_TRANSITION_LOCK);
-
} // namespace mongo