summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/document_source_cursor.cpp
diff options
context:
space:
mode:
authorDavid Storch <david.storch@10gen.com>2018-02-28 18:08:21 -0500
committerDavid Storch <david.storch@10gen.com>2018-03-09 17:20:42 -0500
commited1e2b4d2a4987e3744484f9482fdc7a0e119e94 (patch)
tree8096db9198fb62cd62e2192a38b15faf3d5100a6 /src/mongo/db/pipeline/document_source_cursor.cpp
parentb9e20190b647fea262a8f4e154bbf18d9934a3ba (diff)
downloadmongo-ed1e2b4d2a4987e3744484f9482fdc7a0e119e94.tar.gz
SERVER-33541 Add readConcern level 'snapshot' support for aggregation.
Diffstat (limited to 'src/mongo/db/pipeline/document_source_cursor.cpp')
-rw-r--r--src/mongo/db/pipeline/document_source_cursor.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/mongo/db/pipeline/document_source_cursor.cpp b/src/mongo/db/pipeline/document_source_cursor.cpp
index b090f195bbe..10d049cef28 100644
--- a/src/mongo/db/pipeline/document_source_cursor.cpp
+++ b/src/mongo/db/pipeline/document_source_cursor.cpp
@@ -210,8 +210,9 @@ Value DocumentSourceCursor::serialize(boost::optional<ExplainOptions::Verbosity>
{
auto opCtx = pExpCtx->opCtx;
- AutoGetDb dbLock(opCtx, _exec->nss().db(), MODE_IS);
- Lock::CollectionLock collLock(opCtx->lockState(), _exec->nss().ns(), MODE_IS);
+ auto lockMode = getLockModeForQuery(opCtx);
+ AutoGetDb dbLock(opCtx, _exec->nss().db(), lockMode);
+ Lock::CollectionLock collLock(opCtx->lockState(), _exec->nss().ns(), lockMode);
auto collection =
dbLock.getDb() ? dbLock.getDb()->getCollection(opCtx, _exec->nss()) : nullptr;
@@ -266,8 +267,9 @@ void DocumentSourceCursor::cleanupExecutor() {
// already have been marked as killed when the collection was dropped, and we won't need to
// access the CursorManager to properly dispose of it.
UninterruptibleLockGuard noInterrupt(opCtx->lockState());
- AutoGetDb dbLock(opCtx, _exec->nss().db(), MODE_IS);
- Lock::CollectionLock collLock(opCtx->lockState(), _exec->nss().ns(), MODE_IS);
+ auto lockMode = getLockModeForQuery(opCtx);
+ AutoGetDb dbLock(opCtx, _exec->nss().db(), lockMode);
+ Lock::CollectionLock collLock(opCtx->lockState(), _exec->nss().ns(), lockMode);
auto collection = dbLock.getDb() ? dbLock.getDb()->getCollection(opCtx, _exec->nss()) : nullptr;
auto cursorManager = collection ? collection->getCursorManager() : nullptr;
_exec->dispose(opCtx, cursorManager);