diff options
author | David Storch <david.storch@10gen.com> | 2019-01-17 10:36:29 -0500 |
---|---|---|
committer | David Storch <david.storch@10gen.com> | 2019-01-23 21:18:45 -0500 |
commit | 84b142d5123c06212ce7a2e495ae8afe48eb65cb (patch) | |
tree | e267b75425b6b61c863d73276a7be137f4109fc9 /src/mongo/db/pipeline | |
parent | 869b3b64a898076ff98405fa70403084417cb164 (diff) | |
download | mongo-84b142d5123c06212ce7a2e495ae8afe48eb65cb.tar.gz |
SERVER-37455 Delete per-collection cursor managers.
Diffstat (limited to 'src/mongo/db/pipeline')
-rw-r--r-- | src/mongo/db/pipeline/document_source_cursor.cpp | 30 | ||||
-rw-r--r-- | src/mongo/db/pipeline/document_source_cursor.h | 5 | ||||
-rw-r--r-- | src/mongo/db/pipeline/process_interface_standalone.cpp | 1 |
3 files changed, 3 insertions, 33 deletions
diff --git a/src/mongo/db/pipeline/document_source_cursor.cpp b/src/mongo/db/pipeline/document_source_cursor.cpp index b019bbf8e35..978f62e4f2b 100644 --- a/src/mongo/db/pipeline/document_source_cursor.cpp +++ b/src/mongo/db/pipeline/document_source_cursor.cpp @@ -140,7 +140,7 @@ void DocumentSourceCursor::loadBatch() { // still held if '_exec' did not end in an error. If '_exec' encountered an error during a // yield, the locks might be yielded. if (state != PlanExecutor::DEAD && state != PlanExecutor::FAILURE) { - cleanupExecutor(autoColl); + cleanupExecutor(); } } @@ -266,33 +266,7 @@ void DocumentSourceCursor::doDispose() { void DocumentSourceCursor::cleanupExecutor() { invariant(_exec); - auto* opCtx = pExpCtx->opCtx; - // We need to be careful to not use AutoGetCollection here, since we only need the lock to - // protect potential access to the Collection's CursorManager, and AutoGetCollection may throw - // if this namespace has since turned into a view. Using Database::getCollection() will simply - // return nullptr if the collection has since turned into a view. In this case, '_exec' will - // 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()); - 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); - - // Not freeing _exec if we're in explain mode since it will be used in serialize() to gather - // execution stats. - if (!pExpCtx->explain) { - _exec.reset(); - } -} - -void DocumentSourceCursor::cleanupExecutor(const AutoGetCollectionForRead& readLock) { - invariant(_exec); - auto cursorManager = - readLock.getCollection() ? readLock.getCollection()->getCursorManager() : nullptr; - _exec->dispose(pExpCtx->opCtx, cursorManager); + _exec->dispose(pExpCtx->opCtx); // Not freeing _exec if we're in explain mode since it will be used in serialize() to gather // execution stats. diff --git a/src/mongo/db/pipeline/document_source_cursor.h b/src/mongo/db/pipeline/document_source_cursor.h index d15c23c2849..90f3c6d4f1c 100644 --- a/src/mongo/db/pipeline/document_source_cursor.h +++ b/src/mongo/db/pipeline/document_source_cursor.h @@ -189,11 +189,6 @@ private: void cleanupExecutor(); /** - * Destroys and de-registers '_exec'. '_exec' must be non-null. - */ - void cleanupExecutor(const AutoGetCollectionForRead& readLock); - - /** * Reads a batch of data from '_exec'. Subclasses can specify custom behavior to be performed on * each document by overloading transformBSONObjToDocument(). */ diff --git a/src/mongo/db/pipeline/process_interface_standalone.cpp b/src/mongo/db/pipeline/process_interface_standalone.cpp index 4c247333272..f7736cd41b1 100644 --- a/src/mongo/db/pipeline/process_interface_standalone.cpp +++ b/src/mongo/db/pipeline/process_interface_standalone.cpp @@ -41,6 +41,7 @@ #include "mongo/db/catalog/uuid_catalog.h" #include "mongo/db/concurrency/d_concurrency.h" #include "mongo/db/curop.h" +#include "mongo/db/cursor_manager.h" #include "mongo/db/db_raii.h" #include "mongo/db/index/index_descriptor.h" #include "mongo/db/pipeline/document_source_cursor.h" |