diff options
author | Jason Rassi <rassi@10gen.com> | 2015-01-12 12:32:13 -0500 |
---|---|---|
committer | Jason Rassi <rassi@10gen.com> | 2015-01-12 12:40:45 -0500 |
commit | 9e1c94c0c9348f08bfa405896a28707afd62c899 (patch) | |
tree | 53c693ec8e28733e6d216f955223016b7521e9ff | |
parent | 2468153c690dbe8312a10829d3cd7565ed90c1e1 (diff) | |
download | mongo-9e1c94c0c9348f08bfa405896a28707afd62c899.tar.gz |
SERVER-16659 Collection: rename cursorManager() to getCursorManager()
-rw-r--r-- | src/mongo/db/catalog/collection.h | 2 | ||||
-rw-r--r-- | src/mongo/db/catalog/cursor_manager.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/catalog/index_catalog.cpp | 6 | ||||
-rw-r--r-- | src/mongo/db/clientcursor.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/commands/parallel_collection_scan.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/commands/pipeline_command.cpp | 5 | ||||
-rw-r--r-- | src/mongo/db/commands/repair_cursor.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/query/find.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/query/plan_executor.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/range_deleter_db_env.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/range_preserver.h | 2 | ||||
-rw-r--r-- | src/mongo/dbtests/executor_registry.cpp | 4 | ||||
-rw-r--r-- | src/mongo/dbtests/query_plan_executor.cpp | 18 | ||||
-rw-r--r-- | src/mongo/dbtests/querytests.cpp | 20 |
14 files changed, 41 insertions, 38 deletions
diff --git a/src/mongo/db/catalog/collection.h b/src/mongo/db/catalog/collection.h index 6e3133a89ee..7edf1064d1f 100644 --- a/src/mongo/db/catalog/collection.h +++ b/src/mongo/db/catalog/collection.h @@ -125,7 +125,7 @@ namespace mongo { const RecordStore* getRecordStore() const { return _recordStore; } RecordStore* getRecordStore() { return _recordStore; } - CursorManager* cursorManager() const { return &_cursorManager; } + CursorManager* getCursorManager() const { return &_cursorManager; } bool requiresIdIndex() const; diff --git a/src/mongo/db/catalog/cursor_manager.cpp b/src/mongo/db/catalog/cursor_manager.cpp index 1e8d2480eee..e097bd1aee7 100644 --- a/src/mongo/db/catalog/cursor_manager.cpp +++ b/src/mongo/db/catalog/cursor_manager.cpp @@ -234,7 +234,7 @@ namespace mongo { ErrorCodes::CursorNotFound); return false; } - return collection->cursorManager()->eraseCursor(txn, id, checkAuth); + return collection->getCursorManager()->eraseCursor(txn, id, checkAuth); } std::size_t GlobalCursorIdCache::timeoutCursors(OperationContext* txn, int millisSinceLastCall) { @@ -272,7 +272,7 @@ namespace mongo { continue; } - totalTimedOut += collection->cursorManager()->timeoutCursors( millisSinceLastCall ); + totalTimedOut += collection->getCursorManager()->timeoutCursors( millisSinceLastCall ); } return totalTimedOut; diff --git a/src/mongo/db/catalog/index_catalog.cpp b/src/mongo/db/catalog/index_catalog.cpp index 103e6b4bd2b..6462f7396ff 100644 --- a/src/mongo/db/catalog/index_catalog.cpp +++ b/src/mongo/db/catalog/index_catalog.cpp @@ -702,7 +702,7 @@ namespace { // there may be pointers pointing at keys in the btree(s). kill them. // TODO: can this can only clear cursors on this index? - _collection->cursorManager()->invalidateAll( false ); + _collection->getCursorManager()->invalidateAll( false ); // make sure nothing in progress massert( 17348, @@ -802,7 +802,7 @@ namespace { // there may be pointers pointing at keys in the btree(s). kill them. // TODO: can this can only clear cursors on this index? - _collection->cursorManager()->invalidateAll( false ); + _collection->getCursorManager()->invalidateAll( false ); // wipe out stats _collection->infoCache()->reset(txn); @@ -1046,7 +1046,7 @@ namespace { // Notify other users of the IndexCatalog that we're about to invalidate 'oldDesc'. const bool collectionGoingAway = false; - _collection->cursorManager()->invalidateAll( collectionGoingAway ); + _collection->getCursorManager()->invalidateAll( collectionGoingAway ); // Delete the IndexCatalogEntry that owns this descriptor. After deletion, 'oldDesc' is // invalid and should not be dereferenced. diff --git a/src/mongo/db/clientcursor.cpp b/src/mongo/db/clientcursor.cpp index 7f19265cc37..be61f0fa541 100644 --- a/src/mongo/db/clientcursor.cpp +++ b/src/mongo/db/clientcursor.cpp @@ -86,14 +86,14 @@ namespace mongo { _query = query; _queryOptions = qopts; if (exec->collection()) { - invariant(cursorManager == exec->collection()->cursorManager()); + invariant(cursorManager == exec->collection()->getCursorManager()); } init(); } ClientCursor::ClientCursor(const Collection* collection) : _ns(collection->ns().ns()), - _cursorManager(collection->cursorManager()), + _cursorManager(collection->getCursorManager()), _countedYet(false), _queryOptions(QueryOption_NoCursorTimeout), _isAggCursor(false), diff --git a/src/mongo/db/commands/parallel_collection_scan.cpp b/src/mongo/db/commands/parallel_collection_scan.cpp index 8d1e4f206e9..bb759d0bbb1 100644 --- a/src/mongo/db/commands/parallel_collection_scan.cpp +++ b/src/mongo/db/commands/parallel_collection_scan.cpp @@ -137,7 +137,7 @@ namespace mongo { for (size_t i = 0; i < execs.size(); i++) { // transfer ownership of an executor to the ClientCursor (which manages its own // lifetime). - ClientCursor* cc = new ClientCursor( collection->cursorManager(), + ClientCursor* cc = new ClientCursor( collection->getCursorManager(), execs.releaseAt(i), ns.ns() ); diff --git a/src/mongo/db/commands/pipeline_command.cpp b/src/mongo/db/commands/pipeline_command.cpp index 9061f5978cb..cb025afa9f9 100644 --- a/src/mongo/db/commands/pipeline_command.cpp +++ b/src/mongo/db/commands/pipeline_command.cpp @@ -280,13 +280,14 @@ namespace mongo { if (collection) { // XXX const bool isAggCursor = true; // enable special locking behavior - ClientCursor* cursor = new ClientCursor(collection->cursorManager(), + ClientCursor* cursor = new ClientCursor(collection->getCursorManager(), execHolder.release(), nss.ns(), 0, BSONObj(), isAggCursor); - pin.reset(new ClientCursorPin(collection->cursorManager(), cursor->cursorid())); + pin.reset(new ClientCursorPin(collection->getCursorManager(), + cursor->cursorid())); // Don't add any code between here and the start of the try block. } } diff --git a/src/mongo/db/commands/repair_cursor.cpp b/src/mongo/db/commands/repair_cursor.cpp index 986e35cfc7d..d7589682b66 100644 --- a/src/mongo/db/commands/repair_cursor.cpp +++ b/src/mongo/db/commands/repair_cursor.cpp @@ -102,7 +102,7 @@ namespace mongo { // ClientCursors' constructor inserts them into a global map that manages their // lifetimes. That is why the next line isn't leaky. - ClientCursor* cc = new ClientCursor(collection->cursorManager(), + ClientCursor* cc = new ClientCursor(collection->getCursorManager(), exec.release(), ns.ns()); diff --git a/src/mongo/db/query/find.cpp b/src/mongo/db/query/find.cpp index 3ab3f4209be..2f14820e8f1 100644 --- a/src/mongo/db/query/find.cpp +++ b/src/mongo/db/query/find.cpp @@ -207,7 +207,7 @@ namespace mongo { ctx.reset(new AutoGetCollectionForRead(txn, nss)); Collection* collection = ctx->getCollection(); uassert( 17356, "collection dropped between getMore calls", collection ); - cursorManager = collection->cursorManager(); + cursorManager = collection->getCursorManager(); } QLOG() << "Running getMore, cursorid: " << cursorid << endl; @@ -840,7 +840,7 @@ namespace mongo { // Allocate a new ClientCursor. We don't have to worry about leaking it as it's // inserted into a global map by its ctor. - ClientCursor* cc = new ClientCursor(collection->cursorManager(), + ClientCursor* cc = new ClientCursor(collection->getCursorManager(), exec.release(), nss.ns(), pq.getOptions().toInt(), diff --git a/src/mongo/db/query/plan_executor.cpp b/src/mongo/db/query/plan_executor.cpp index 6d1ceffeb05..2a9e1009aad 100644 --- a/src/mongo/db/query/plan_executor.cpp +++ b/src/mongo/db/query/plan_executor.cpp @@ -461,13 +461,13 @@ namespace mongo { // Collection can be null for an EOFStage plan, or other places where registration // is not needed. if (_exec->collection()) { - _exec->collection()->cursorManager()->registerExecutor(exec); + _exec->collection()->getCursorManager()->registerExecutor(exec); } } PlanExecutor::ScopedExecutorRegistration::~ScopedExecutorRegistration() { if (_exec->collection()) { - _exec->collection()->cursorManager()->deregisterExecutor(_exec); + _exec->collection()->getCursorManager()->deregisterExecutor(_exec); } } diff --git a/src/mongo/db/range_deleter_db_env.cpp b/src/mongo/db/range_deleter_db_env.cpp index f7b2dfad747..b79f0dbb714 100644 --- a/src/mongo/db/range_deleter_db_env.cpp +++ b/src/mongo/db/range_deleter_db_env.cpp @@ -159,6 +159,6 @@ namespace mongo { return; } - collection->cursorManager()->getCursorIds( openCursors ); + collection->getCursorManager()->getCursorIds( openCursors ); } } diff --git a/src/mongo/db/range_preserver.h b/src/mongo/db/range_preserver.h index a8a5a5d75b0..e9c2b93a57c 100644 --- a/src/mongo/db/range_preserver.h +++ b/src/mongo/db/range_preserver.h @@ -55,7 +55,7 @@ namespace mongo { ClientCursor* cc = new ClientCursor(collection); // Pin keeps the CC from being deleted while it's in scope. We delete it ourselves. - _pin.reset(new ClientCursorPin(collection->cursorManager(), cc->cursorid())); + _pin.reset(new ClientCursorPin(collection->getCursorManager(), cc->cursorid())); } } diff --git a/src/mongo/dbtests/executor_registry.cpp b/src/mongo/dbtests/executor_registry.cpp index c9581be2952..9af65a1b013 100644 --- a/src/mongo/dbtests/executor_registry.cpp +++ b/src/mongo/dbtests/executor_registry.cpp @@ -90,7 +90,7 @@ namespace ExecutorRegistry { void registerExecutor( PlanExecutor* exec ) { WriteUnitOfWork wuow(&_opCtx); _ctx->ctx().db()->getOrCreateCollection(&_opCtx, ns()) - ->cursorManager() + ->getCursorManager() ->registerExecutor(exec); wuow.commit(); } @@ -98,7 +98,7 @@ namespace ExecutorRegistry { void deregisterExecutor( PlanExecutor* exec ) { WriteUnitOfWork wuow(&_opCtx); _ctx->ctx().db()->getOrCreateCollection(&_opCtx, ns()) - ->cursorManager() + ->getCursorManager() ->deregisterExecutor(exec); wuow.commit(); } diff --git a/src/mongo/dbtests/query_plan_executor.cpp b/src/mongo/dbtests/query_plan_executor.cpp index 43a2cc1c05b..944e1aaeff3 100644 --- a/src/mongo/dbtests/query_plan_executor.cpp +++ b/src/mongo/dbtests/query_plan_executor.cpp @@ -160,7 +160,7 @@ namespace QueryPlanExecutor { Collection* collection = ctx.getCollection(); if ( !collection ) return 0; - return collection->cursorManager()->numCursors(); + return collection->getCursorManager()->numCursors(); } void registerExec( PlanExecutor* exec ) { @@ -168,7 +168,7 @@ namespace QueryPlanExecutor { AutoGetCollectionForRead ctx(&_txn, ns()); WriteUnitOfWork wunit(&_txn); Collection* collection = ctx.getDb()->getOrCreateCollection(&_txn, ns()); - collection->cursorManager()->registerExecutor( exec ); + collection->getCursorManager()->registerExecutor( exec ); wunit.commit(); } @@ -177,7 +177,7 @@ namespace QueryPlanExecutor { AutoGetCollectionForRead ctx(&_txn, ns()); WriteUnitOfWork wunit(&_txn); Collection* collection = ctx.getDb()->getOrCreateCollection(&_txn, ns()); - collection->cursorManager()->deregisterExecutor( exec ); + collection->getCursorManager()->deregisterExecutor( exec ); wunit.commit(); } @@ -421,12 +421,12 @@ namespace QueryPlanExecutor { PlanExecutor* exec = makeCollScanExec(coll,filterObj); // Make a client cursor from the runner. - new ClientCursor(coll->cursorManager(), exec, ns(), 0, BSONObj()); + new ClientCursor(coll->getCursorManager(), exec, ns(), 0, BSONObj()); // There should be one cursor before invalidation, // and zero cursors after invalidation. ASSERT_EQUALS(1U, numCursors()); - coll->cursorManager()->invalidateAll(false); + coll->getCursorManager()->invalidateAll(false); ASSERT_EQUALS(0U, numCursors()); } }; @@ -447,17 +447,17 @@ namespace QueryPlanExecutor { PlanExecutor* exec = makeCollScanExec(collection, filterObj); // Make a client cursor from the runner. - ClientCursor* cc = new ClientCursor(collection->cursorManager(), + ClientCursor* cc = new ClientCursor(collection->getCursorManager(), exec, ns(), 0, BSONObj()); - ClientCursorPin ccPin(collection->cursorManager(), cc->cursorid()); + ClientCursorPin ccPin(collection->getCursorManager(), cc->cursorid()); // If the cursor is pinned, it sticks around, // even after invalidation. ASSERT_EQUALS(1U, numCursors()); - collection->cursorManager()->invalidateAll(false); + collection->getCursorManager()->invalidateAll(false); ASSERT_EQUALS(1U, numCursors()); // The invalidation should have killed the runner. @@ -491,7 +491,7 @@ namespace QueryPlanExecutor { PlanExecutor* exec = makeCollScanExec(collection, filterObj); // Make a client cursor from the runner. - new ClientCursor(collection->cursorManager(), exec, ns(), 0, BSONObj()); + new ClientCursor(collection->getCursorManager(), exec, ns(), 0, BSONObj()); } // There should be one cursor before timeout, diff --git a/src/mongo/dbtests/querytests.cpp b/src/mongo/dbtests/querytests.cpp index 06643570c4d..9b3532b801a 100644 --- a/src/mongo/dbtests/querytests.cpp +++ b/src/mongo/dbtests/querytests.cpp @@ -267,7 +267,7 @@ namespace QueryTests { { // Check internal server handoff to getmore. Client::WriteContext ctx(&_txn, ns); - ClientCursorPin clientCursor( ctx.getCollection()->cursorManager(), cursorId ); + ClientCursorPin clientCursor( ctx.getCollection()->getCursorManager(), cursorId ); // pq doesn't exist if it's a runner inside of the clientcursor. // ASSERT( clientCursor.c()->pq ); // ASSERT_EQUALS( 2, clientCursor.c()->pq->getNumToReturn() ); @@ -321,7 +321,7 @@ namespace QueryTests { // Check that the cursor has been removed. { AutoGetCollectionForRead ctx(&_txn, ns); - ASSERT(0 == ctx.getCollection()->cursorManager()->numCursors()); + ASSERT(0 == ctx.getCollection()->getCursorManager()->numCursors()); } ASSERT_FALSE(CursorManager::eraseCursorGlobal(&_txn, cursorId)); @@ -371,8 +371,8 @@ namespace QueryTests { // Check that the cursor still exists { AutoGetCollectionForRead ctx(&_txn, ns); - ASSERT(1 == ctx.getCollection()->cursorManager()->numCursors()); - ASSERT(ctx.getCollection()->cursorManager()->find(cursorId, false)); + ASSERT(1 == ctx.getCollection()->getCursorManager()->numCursors()); + ASSERT(ctx.getCollection()->getCursorManager()->find(cursorId, false)); } // Check that the cursor can be iterated until all documents are returned. @@ -667,7 +667,7 @@ namespace QueryTests { ASSERT_EQUALS( two, c->next()["ts"].Date() ); long long cursorId = c->getCursorId(); - ClientCursorPin clientCursor( ctx.db()->getCollection( ns )->cursorManager(), + ClientCursorPin clientCursor( ctx.db()->getCollection( ns )->getCursorManager(), cursorId ); ASSERT_EQUALS( three.millis, clientCursor.c()->getSlaveReadTill().asDate() ); } @@ -1174,7 +1174,7 @@ namespace QueryTests { Collection* collection = ctx.getCollection(); if ( !collection ) return 0; - return collection->cursorManager()->numCursors(); + return collection->getCursorManager()->numCursors(); } const char * ns() { @@ -1519,7 +1519,8 @@ namespace QueryTests { ClientCursor *clientCursor = 0; { AutoGetCollectionForRead ctx(&_txn, ns()); - ClientCursorPin clientCursorPointer(ctx.getCollection()->cursorManager(), cursorId); + ClientCursorPin clientCursorPointer(ctx.getCollection()->getCursorManager(), + cursorId); clientCursor = clientCursorPointer.c(); // clientCursorPointer destructor unpins the cursor. } @@ -1556,8 +1557,9 @@ namespace QueryTests { { Client::WriteContext ctx(&_txn, ns() ); - ClientCursorPin pinCursor( ctx.ctx().db()->getCollection( ns())->cursorManager(), - cursorId ); + ClientCursorPin pinCursor( ctx.ctx().db()->getCollection( ns() ) + ->getCursorManager(), + cursorId ); string expectedAssertion = str::stream() << "Cannot kill active cursor " << cursorId; ASSERT_THROWS_WHAT(CursorManager::eraseCursorGlobal(&_txn, cursorId), |