summaryrefslogtreecommitdiff
path: root/src/mongo/db/db_raii.cpp
diff options
context:
space:
mode:
authorXiangyu Yao <xiangyu.yao@mongodb.com>2018-07-20 15:37:15 -0400
committerXiangyu Yao <xiangyu.yao@mongodb.com>2018-07-26 08:12:55 -0400
commitbfc958a0b32c29167f81d1413b82c8d909276791 (patch)
tree0af1d5f36b40a84327f403d9934659178ca02ac5 /src/mongo/db/db_raii.cpp
parent58fcc7b5280cbe14a15a58fceaaf9d0ce8418434 (diff)
downloadmongo-bfc958a0b32c29167f81d1413b82c8d909276791.tar.gz
SERVER-35429 Add lock state checking with PBWM in AutoGetCollectionForRead
Diffstat (limited to 'src/mongo/db/db_raii.cpp')
-rw-r--r--src/mongo/db/db_raii.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mongo/db/db_raii.cpp b/src/mongo/db/db_raii.cpp
index dbe0c2b3902..5b09a36981b 100644
--- a/src/mongo/db/db_raii.cpp
+++ b/src/mongo/db/db_raii.cpp
@@ -161,7 +161,12 @@ AutoGetCollectionForRead::AutoGetCollectionForRead(OperationContext* opCtx,
LOG(2) << "Tried reading at last-applied time: " << *lastAppliedTimestamp
<< " on nss: " << nss.ns() << ", but future catalog changes are pending at time "
<< *minSnapshot << ". Trying again without reading at last-applied time.";
+ // Destructing the block sets _shouldConflictWithSecondaryBatchApplication back to the
+ // previous value. If the previous value is false (because there is another
+ // shouldNotConflictWithSecondaryBatchApplicationBlock outside of this function), this
+ // does not take the PBWM lock.
_shouldNotConflictWithSecondaryBatchApplicationBlock = boost::none;
+ invariant(opCtx->lockState()->shouldConflictWithSecondaryBatchApplication());
opCtx->recoveryUnit()->setTimestampReadSource(RecoveryUnit::ReadSource::kUnset);
}