summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDianna Hohensee <dianna.hohensee@mongodb.com>2021-02-10 17:39:04 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-02-16 22:27:00 +0000
commit5d0eaf8291050689b970581083abc5d0e6c931d1 (patch)
treede2877bb70fdae19d924f9650197cd0176d38646
parente16a95eaac68ac2daa8f6f8b943b93763cd8dd5d (diff)
downloadmongo-5d0eaf8291050689b970581083abc5d0e6c931d1.tar.gz
SERVER-54116 AutoGetCollection*MaybeLockFree should pivot to locked if a storage snapshot is already open without the lock-free read operation flag set.
This avoids using a -LockFree helper, via the DBDirectClient, that must reset the storage snapshot.
-rw-r--r--src/mongo/db/db_raii.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/mongo/db/db_raii.cpp b/src/mongo/db/db_raii.cpp
index c11e9ce664a..db8d0c205e9 100644
--- a/src/mongo/db/db_raii.cpp
+++ b/src/mongo/db/db_raii.cpp
@@ -60,8 +60,11 @@ bool supportsLockFreeRead(OperationContext* opCtx) {
// Lock-free reads are not supported in multi-document transactions.
// Lock-free reads are not supported under an exclusive lock (nested reads under exclusive lock
// holding operations).
+ // Lock-free reads are not supported if a storage txn is already open w/o the lock-free reads
+ // operation flag set.
return !storageGlobalParams.disableLockFreeReads && !opCtx->inMultiDocumentTransaction() &&
- !opCtx->lockState()->isWriteLocked();
+ !opCtx->lockState()->isWriteLocked() &&
+ !(opCtx->recoveryUnit()->isActive() && !opCtx->isLockFreeReadsOp());
}
/**