summaryrefslogtreecommitdiff
path: root/src/mongo/db/concurrency/d_concurrency.cpp
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2016-07-01 19:18:45 -0400
committerMathias Stearn <mathias@10gen.com>2016-07-15 20:02:18 -0400
commit0673f9531be7cbaa8e5477ee28431a28191fe7ed (patch)
tree3cb01e723b750f437ea76247894fc0a70fe5d66a /src/mongo/db/concurrency/d_concurrency.cpp
parent8db76c3dd2ff1e9f2d8dbb026c4cd3c4496217c7 (diff)
downloadmongo-0673f9531be7cbaa8e5477ee28431a28191fe7ed.tar.gz
SERVER-24242 Lock::ParallelBatchWriterMode sets isBatchWriter while in scope
Diffstat (limited to 'src/mongo/db/concurrency/d_concurrency.cpp')
-rw-r--r--src/mongo/db/concurrency/d_concurrency.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/mongo/db/concurrency/d_concurrency.cpp b/src/mongo/db/concurrency/d_concurrency.cpp
index cf66b2e5620..0879f8bda4f 100644
--- a/src/mongo/db/concurrency/d_concurrency.cpp
+++ b/src/mongo/db/concurrency/d_concurrency.cpp
@@ -185,7 +185,14 @@ void Lock::OplogIntentWriteLock::serializeIfNeeded() {
}
Lock::ParallelBatchWriterMode::ParallelBatchWriterMode(Locker* lockState)
- : _pbwm(lockState, resourceIdParallelBatchWriterMode, MODE_X) {}
+ : _pbwm(lockState, resourceIdParallelBatchWriterMode, MODE_X), _lockState(lockState) {
+ invariant(!_lockState->isBatchWriter()); // Otherwise we couldn't clear in destructor.
+ _lockState->setIsBatchWriter(true);
+}
+
+Lock::ParallelBatchWriterMode::~ParallelBatchWriterMode() {
+ _lockState->setIsBatchWriter(false);
+}
void Lock::ResourceLock::lock(LockMode mode) {
invariant(_result == LOCK_INVALID);