summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Rassi <rassi@10gen.com>2014-12-23 12:27:08 -0500
committerJason Rassi <rassi@10gen.com>2014-12-23 22:56:43 -0500
commit1df9c58634def7beeee86fc4f4353a70940fcbbf (patch)
tree0086ddb92808cba83630cd88c1c7dce815ed79d0
parent7494d33c77932db60fb8cdcc1abb178e67d8c60a (diff)
downloadmongo-1df9c58634def7beeee86fc4f4353a70940fcbbf.tar.gz
SERVER-16520 Rename CollectionCursorCache to CursorManager
-rw-r--r--src/mongo/SConscript2
-rw-r--r--src/mongo/db/catalog/collection.cpp14
-rw-r--r--src/mongo/db/catalog/collection.h6
-rw-r--r--src/mongo/db/catalog/cursor_manager.cpp (renamed from src/mongo/db/catalog/collection_cursor_cache.cpp)60
-rw-r--r--src/mongo/db/catalog/cursor_manager.h (renamed from src/mongo/db/catalog/collection_cursor_cache.h)8
-rw-r--r--src/mongo/db/catalog/database.cpp2
-rw-r--r--src/mongo/db/catalog/index_catalog.cpp6
-rw-r--r--src/mongo/db/catalog/index_catalog.h2
-rw-r--r--src/mongo/db/clientcursor.cpp44
-rw-r--r--src/mongo/db/clientcursor.h14
-rw-r--r--src/mongo/db/commands/parallel_collection_scan.cpp2
-rw-r--r--src/mongo/db/commands/pipeline_command.cpp4
-rw-r--r--src/mongo/db/commands/repair_cursor.cpp2
-rw-r--r--src/mongo/db/instance.cpp4
-rw-r--r--src/mongo/db/query/find.cpp4
-rw-r--r--src/mongo/db/query/plan_executor.cpp4
-rw-r--r--src/mongo/db/query/plan_executor.h2
-rw-r--r--src/mongo/db/range_deleter_db_env.cpp2
-rw-r--r--src/mongo/db/range_preserver.h4
-rw-r--r--src/mongo/dbtests/executor_registry.cpp4
-rw-r--r--src/mongo/dbtests/query_plan_executor.cpp21
-rw-r--r--src/mongo/dbtests/querytests.cpp20
22 files changed, 116 insertions, 115 deletions
diff --git a/src/mongo/SConscript b/src/mongo/SConscript
index 1058b0ad880..6b8cf504c3c 100644
--- a/src/mongo/SConscript
+++ b/src/mongo/SConscript
@@ -574,8 +574,8 @@ env.Library('elapsed_tracker',
serverOnlyFiles = [ "db/background.cpp",
"db/catalog/collection.cpp",
"db/catalog/collection_compact.cpp",
- "db/catalog/collection_cursor_cache.cpp",
"db/catalog/collection_info_cache.cpp",
+ "db/catalog/cursor_manager.cpp",
"db/catalog/database.cpp",
"db/catalog/database_holder.cpp",
"db/catalog/index_catalog.cpp",
diff --git a/src/mongo/db/catalog/collection.cpp b/src/mongo/db/catalog/collection.cpp
index 3afb4212329..0aa8aaaed2f 100644
--- a/src/mongo/db/catalog/collection.cpp
+++ b/src/mongo/db/catalog/collection.cpp
@@ -87,7 +87,7 @@ namespace mongo {
_database( database ),
_infoCache( this ),
_indexCatalog( this ),
- _cursorCache( fullNS ) {
+ _cursorManager( fullNS ) {
_magic = 1357924;
_indexCatalog.init(txn);
if ( isCapped() )
@@ -252,7 +252,7 @@ namespace mongo {
BSONObj doc = docFor( txn, loc );
/* check if any cursors point to us. if so, advance them. */
- _cursorCache.invalidateDocument(txn, loc, INVALIDATION_DELETION);
+ _cursorManager.invalidateDocument(txn, loc, INVALIDATION_DELETION);
_indexCatalog.unindexRecord(txn, doc, loc, false);
@@ -280,7 +280,7 @@ namespace mongo {
}
/* check if any cursors point to us. if so, advance them. */
- _cursorCache.invalidateDocument(txn, loc, INVALIDATION_DELETION);
+ _cursorManager.invalidateDocument(txn, loc, INVALIDATION_DELETION);
_indexCatalog.unindexRecord(txn, doc, loc, noWarn);
@@ -389,7 +389,7 @@ namespace mongo {
}
// Broadcast the mutation so that query results stay correct.
- _cursorCache.invalidateDocument(txn, oldLocation, INVALIDATION_MUTATION);
+ _cursorManager.invalidateDocument(txn, oldLocation, INVALIDATION_MUTATION);
return newLocation;
}
@@ -399,7 +399,7 @@ namespace mongo {
const char* oldBuffer,
size_t oldSize ) {
moveCounter.increment();
- _cursorCache.invalidateDocument(txn, oldLocation, INVALIDATION_DELETION);
+ _cursorManager.invalidateDocument(txn, oldLocation, INVALIDATION_DELETION);
_indexCatalog.unindexRecord(txn, BSONObj(oldBuffer), oldLocation, true);
return Status::OK();
}
@@ -412,7 +412,7 @@ namespace mongo {
const mutablebson::DamageVector& damages ) {
// Broadcast the mutation so that query results stay correct.
- _cursorCache.invalidateDocument(txn, loc, INVALIDATION_MUTATION);
+ _cursorManager.invalidateDocument(txn, loc, INVALIDATION_MUTATION);
return _recordStore->updateWithDamages( txn, loc, oldRec, damageSource, damages );
}
@@ -494,7 +494,7 @@ namespace mongo {
Status status = _indexCatalog.dropAllIndexes(txn, true);
if ( !status.isOK() )
return status;
- _cursorCache.invalidateAll( false );
+ _cursorManager.invalidateAll( false );
_infoCache.reset( txn );
// 3) truncate record store
diff --git a/src/mongo/db/catalog/collection.h b/src/mongo/db/catalog/collection.h
index d5f61e1ec21..63ba7ca5664 100644
--- a/src/mongo/db/catalog/collection.h
+++ b/src/mongo/db/catalog/collection.h
@@ -34,8 +34,8 @@
#include "mongo/base/string_data.h"
#include "mongo/bson/mutable/damage_vector.h"
-#include "mongo/db/catalog/collection_cursor_cache.h"
#include "mongo/db/catalog/collection_info_cache.h"
+#include "mongo/db/catalog/cursor_manager.h"
#include "mongo/db/catalog/index_catalog.h"
#include "mongo/db/exec/collection_scan_common.h"
#include "mongo/db/namespace_string.h"
@@ -125,7 +125,7 @@ namespace mongo {
const RecordStore* getRecordStore() const { return _recordStore; }
RecordStore* getRecordStore() { return _recordStore; }
- CollectionCursorCache* cursorCache() const { return &_cursorCache; }
+ CursorManager* cursorManager() const { return &_cursorManager; }
bool requiresIdIndex() const;
@@ -313,7 +313,7 @@ namespace mongo {
// this is mutable because read only users of the Collection class
// use it keep state. This seems valid as const correctness of Collection
// should be about the data.
- mutable CollectionCursorCache _cursorCache;
+ mutable CursorManager _cursorManager;
friend class Database;
friend class IndexCatalog;
diff --git a/src/mongo/db/catalog/collection_cursor_cache.cpp b/src/mongo/db/catalog/cursor_manager.cpp
index affb12c58be..ad03a883ee4 100644
--- a/src/mongo/db/catalog/collection_cursor_cache.cpp
+++ b/src/mongo/db/catalog/cursor_manager.cpp
@@ -1,4 +1,4 @@
-// collection_cursor_cache.h
+// cursor_manager.cpp
/**
* Copyright (C) 2013 MongoDB Inc.
@@ -28,7 +28,7 @@
* it in the license file.
*/
-#include "mongo/db/catalog/collection_cursor_cache.h"
+#include "mongo/db/catalog/cursor_manager.h"
#include "mongo/base/data_cursor.h"
#include "mongo/db/audit.h"
@@ -87,14 +87,14 @@ namespace mongo {
~GlobalCursorIdCache();
/**
- * this gets called when a CollectionCursorCache gets created
- * @return the id the CollectionCursorCache should use when generating
+ * this gets called when a CursorManager gets created
+ * @return the id the CursorManager should use when generating
* cursor ids
*/
unsigned created( const std::string& ns );
/**
- * called by CollectionCursorCache when its going away
+ * called by CursorManager when its going away
*/
void destroyed( unsigned id, const std::string& ns );
@@ -204,7 +204,7 @@ namespace mongo {
return false;
}
- return collection->cursorCache()->eraseCursor(txn, id, checkAuth);
+ return collection->cursorManager()->eraseCursor(txn, id, checkAuth);
}
std::size_t GlobalCursorIdCache::timeoutCursors(OperationContext* txn, int millisSinceLastCall) {
@@ -228,7 +228,7 @@ namespace mongo {
continue;
}
- totalTimedOut += collection->cursorCache()->timeoutCursors( millisSinceLastCall );
+ totalTimedOut += collection->cursorManager()->timeoutCursors( millisSinceLastCall );
}
@@ -237,12 +237,12 @@ namespace mongo {
// ---
- std::size_t CollectionCursorCache::timeoutCursorsGlobal(OperationContext* txn,
+ std::size_t CursorManager::timeoutCursorsGlobal(OperationContext* txn,
int millisSinceLastCall) {;
return _globalCursorIdCache.timeoutCursors(txn, millisSinceLastCall);
}
- int CollectionCursorCache::eraseCursorGlobalIfAuthorized(OperationContext* txn, int n,
+ int CursorManager::eraseCursorGlobalIfAuthorized(OperationContext* txn, int n,
const char* _ids) {
ConstDataCursor ids(_ids);
int numDeleted = 0;
@@ -254,10 +254,10 @@ namespace mongo {
}
return numDeleted;
}
- bool CollectionCursorCache::eraseCursorGlobalIfAuthorized(OperationContext* txn, CursorId id) {
+ bool CursorManager::eraseCursorGlobalIfAuthorized(OperationContext* txn, CursorId id) {
return _globalCursorIdCache.eraseCursor(txn, id, true);
}
- bool CollectionCursorCache::eraseCursorGlobal(OperationContext* txn, CursorId id) {
+ bool CursorManager::eraseCursorGlobal(OperationContext* txn, CursorId id) {
return _globalCursorIdCache.eraseCursor(txn, id, false );
}
@@ -265,19 +265,19 @@ namespace mongo {
// --------------------------
- CollectionCursorCache::CollectionCursorCache( const StringData& ns )
+ CursorManager::CursorManager( const StringData& ns )
: _nss( ns ),
- _mutex( "CollectionCursorCache" ) {
+ _mutex( "CursorManager" ) {
_collectionCacheRuntimeId = _globalCursorIdCache.created( _nss.ns() );
_random.reset( new PseudoRandom( _globalCursorIdCache.nextSeed() ) );
}
- CollectionCursorCache::~CollectionCursorCache() {
+ CursorManager::~CursorManager() {
invalidateAll( true );
_globalCursorIdCache.destroyed( _collectionCacheRuntimeId, _nss.ns() );
}
- void CollectionCursorCache::invalidateAll( bool collectionGoingAway ) {
+ void CursorManager::invalidateAll( bool collectionGoingAway ) {
SimpleMutex::scoped_lock lk( _mutex );
for ( ExecSet::iterator it = _nonCachedExecutors.begin();
@@ -346,9 +346,9 @@ namespace mongo {
}
}
- void CollectionCursorCache::invalidateDocument( OperationContext* txn,
- const RecordId& dl,
- InvalidationType type ) {
+ void CursorManager::invalidateDocument( OperationContext* txn,
+ const RecordId& dl,
+ InvalidationType type ) {
if ( supportsDocLocking() ) {
// If a storage engine supports doc locking, then we do not need to invalidate.
// The transactional boundaries of the operation protect us.
@@ -373,7 +373,7 @@ namespace mongo {
}
}
- std::size_t CollectionCursorCache::timeoutCursors( int millisSinceLastCall ) {
+ std::size_t CursorManager::timeoutCursors( int millisSinceLastCall ) {
SimpleMutex::scoped_lock lk( _mutex );
vector<ClientCursor*> toDelete;
@@ -395,18 +395,18 @@ namespace mongo {
return toDelete.size();
}
- void CollectionCursorCache::registerExecutor( PlanExecutor* exec ) {
+ void CursorManager::registerExecutor( PlanExecutor* exec ) {
SimpleMutex::scoped_lock lk(_mutex);
const std::pair<ExecSet::iterator, bool> result = _nonCachedExecutors.insert(exec);
invariant(result.second); // make sure this was inserted
}
- void CollectionCursorCache::deregisterExecutor( PlanExecutor* exec ) {
+ void CursorManager::deregisterExecutor( PlanExecutor* exec ) {
SimpleMutex::scoped_lock lk(_mutex);
_nonCachedExecutors.erase(exec);
}
- ClientCursor* CollectionCursorCache::find( CursorId id, bool pin ) {
+ ClientCursor* CursorManager::find( CursorId id, bool pin ) {
SimpleMutex::scoped_lock lk( _mutex );
CursorMap::const_iterator it = _cursors.find( id );
if ( it == _cursors.end() )
@@ -423,14 +423,14 @@ namespace mongo {
return cursor;
}
- void CollectionCursorCache::unpin( ClientCursor* cursor ) {
+ void CursorManager::unpin( ClientCursor* cursor ) {
SimpleMutex::scoped_lock lk( _mutex );
invariant( cursor->isPinned() );
cursor->unsetPinned();
}
- void CollectionCursorCache::getCursorIds( std::set<CursorId>* openCursors ) {
+ void CursorManager::getCursorIds( std::set<CursorId>* openCursors ) {
SimpleMutex::scoped_lock lk( _mutex );
for ( CursorMap::const_iterator i = _cursors.begin(); i != _cursors.end(); ++i ) {
@@ -439,12 +439,12 @@ namespace mongo {
}
}
- size_t CollectionCursorCache::numCursors(){
+ size_t CursorManager::numCursors(){
SimpleMutex::scoped_lock lk( _mutex );
return _cursors.size();
}
- CursorId CollectionCursorCache::_allocateCursorId_inlock() {
+ CursorId CursorManager::_allocateCursorId_inlock() {
for ( int i = 0; i < 10000; i++ ) {
unsigned mypart = static_cast<unsigned>( _random->nextInt32() );
CursorId id = cursorIdFromParts( _collectionCacheRuntimeId, mypart );
@@ -454,7 +454,7 @@ namespace mongo {
fassertFailed( 17360 );
}
- CursorId CollectionCursorCache::registerCursor( ClientCursor* cc ) {
+ CursorId CursorManager::registerCursor( ClientCursor* cc ) {
invariant( cc );
SimpleMutex::scoped_lock lk( _mutex );
CursorId id = _allocateCursorId_inlock();
@@ -462,12 +462,12 @@ namespace mongo {
return id;
}
- void CollectionCursorCache::deregisterCursor( ClientCursor* cc ) {
+ void CursorManager::deregisterCursor( ClientCursor* cc ) {
SimpleMutex::scoped_lock lk( _mutex );
_deregisterCursor_inlock( cc );
}
- bool CollectionCursorCache::eraseCursor(OperationContext* txn, CursorId id, bool checkAuth) {
+ bool CursorManager::eraseCursor(OperationContext* txn, CursorId id, bool checkAuth) {
SimpleMutex::scoped_lock lk( _mutex );
CursorMap::iterator it = _cursors.find( id );
@@ -498,7 +498,7 @@ namespace mongo {
return true;
}
- void CollectionCursorCache::_deregisterCursor_inlock( ClientCursor* cc ) {
+ void CursorManager::_deregisterCursor_inlock( ClientCursor* cc ) {
invariant( cc );
CursorId id = cc->cursorid();
_cursors.erase( id );
diff --git a/src/mongo/db/catalog/collection_cursor_cache.h b/src/mongo/db/catalog/cursor_manager.h
index e031c4abee1..1e92aefad7a 100644
--- a/src/mongo/db/catalog/collection_cursor_cache.h
+++ b/src/mongo/db/catalog/cursor_manager.h
@@ -1,4 +1,4 @@
-// collection_cursor_cache.h
+// cursor_manager.h
/**
* Copyright (C) 2013 MongoDB Inc.
@@ -43,14 +43,14 @@ namespace mongo {
class PseudoRandom;
class PlanExecutor;
- class CollectionCursorCache {
+ class CursorManager {
public:
- CollectionCursorCache( const StringData& ns );
+ CursorManager( const StringData& ns );
/**
* will kill() all PlanExecutor instances it has
*/
- ~CollectionCursorCache();
+ ~CursorManager();
// -----------------
diff --git a/src/mongo/db/catalog/database.cpp b/src/mongo/db/catalog/database.cpp
index 24c0ea01821..383b869b833 100644
--- a/src/mongo/db/catalog/database.cpp
+++ b/src/mongo/db/catalog/database.cpp
@@ -404,7 +404,7 @@ namespace mongo {
// Takes ownership of the collection
txn->recoveryUnit()->registerChange(new RemoveCollectionChange(this, it->second));
- it->second->_cursorCache.invalidateAll(false);
+ it->second->_cursorManager.invalidateAll(false);
_collections.erase( it );
}
diff --git a/src/mongo/db/catalog/index_catalog.cpp b/src/mongo/db/catalog/index_catalog.cpp
index 3919ce67704..d7639b744a8 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->cursorCache()->invalidateAll( false );
+ _collection->cursorManager()->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->cursorCache()->invalidateAll( false );
+ _collection->cursorManager()->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->cursorCache()->invalidateAll( collectionGoingAway );
+ _collection->cursorManager()->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/catalog/index_catalog.h b/src/mongo/db/catalog/index_catalog.h
index 8c2f924682b..5b689eea0ca 100644
--- a/src/mongo/db/catalog/index_catalog.h
+++ b/src/mongo/db/catalog/index_catalog.h
@@ -119,7 +119,7 @@ namespace mongo {
* Use this method to notify the IndexCatalog that the spec for this index has changed.
*
* It is invalid to dereference 'oldDesc' after calling this method. This method broadcasts
- * an invalidateAll() on the cursor cache to notify other users of the IndexCatalog that
+ * an invalidateAll() on the cursor manager to notify other users of the IndexCatalog that
* this descriptor is now invalid.
*/
const IndexDescriptor* refreshEntry( OperationContext* txn,
diff --git a/src/mongo/db/clientcursor.cpp b/src/mongo/db/clientcursor.cpp
index 1a2e35992d5..878d765c6e5 100644
--- a/src/mongo/db/clientcursor.cpp
+++ b/src/mongo/db/clientcursor.cpp
@@ -69,12 +69,12 @@ namespace mongo {
return cursorStatsOpen.get();
}
- ClientCursor::ClientCursor(CollectionCursorCache* cursorCache,
+ ClientCursor::ClientCursor(CursorManager* cursorManager,
PlanExecutor* exec,
int qopts,
const BSONObj query,
bool isAggCursor)
- : _cursorCache(cursorCache),
+ : _cursorManager(cursorManager),
_countedYet(false),
_isAggCursor(isAggCursor),
_unownedRU(NULL) {
@@ -84,14 +84,14 @@ namespace mongo {
_query = query;
_queryOptions = qopts;
if (exec->collection()) {
- invariant(cursorCache == exec->collection()->cursorCache());
+ invariant(cursorManager == exec->collection()->cursorManager());
}
init();
}
- ClientCursor::ClientCursor(CollectionCursorCache* cursorCache)
- : _ns(cursorCache->ns()),
- _cursorCache(cursorCache),
+ ClientCursor::ClientCursor(CursorManager* cursorManager)
+ : _ns(cursorManager->ns()),
+ _cursorManager(cursorManager),
_countedYet(false),
_queryOptions(QueryOption_NoCursorTimeout),
_isAggCursor(false),
@@ -100,7 +100,7 @@ namespace mongo {
}
void ClientCursor::init() {
- invariant( _cursorCache );
+ invariant( _cursorManager );
_isPinned = false;
_isNoTimeout = false;
@@ -116,7 +116,7 @@ namespace mongo {
cursorStatsOpenNoTimeout.increment();
}
- _cursorid = _cursorCache->registerCursor( this );
+ _cursorid = _cursorManager->registerCursor( this );
cursorStatsOpen.increment();
_countedYet = true;
@@ -138,13 +138,13 @@ namespace mongo {
cursorStatsOpenNoTimeout.decrement();
}
- if ( _cursorCache ) {
+ if ( _cursorManager ) {
// this could be null if kill() was killed
- _cursorCache->deregisterCursor( this );
+ _cursorManager->deregisterCursor( this );
}
// defensive:
- _cursorCache = NULL;
+ _cursorManager = NULL;
_cursorid = INVALID_CURSOR_ID;
_pos = -2;
_isNoTimeout = false;
@@ -154,7 +154,7 @@ namespace mongo {
if ( _exec.get() )
_exec->kill();
- _cursorCache = NULL;
+ _cursorManager = NULL;
}
//
@@ -218,10 +218,10 @@ namespace mongo {
// deleted from underneath us, so we can save the pointer and ignore the ID.
//
- ClientCursorPin::ClientCursorPin( CollectionCursorCache* cursorCache, long long cursorid )
+ ClientCursorPin::ClientCursorPin( CursorManager* cursorManager, long long cursorid )
: _cursor( NULL ) {
cursorStatsOpenPinned.increment();
- _cursor = cursorCache->find( cursorid, true );
+ _cursor = cursorManager->find( cursorid, true );
}
ClientCursorPin::~ClientCursorPin() {
@@ -235,14 +235,14 @@ namespace mongo {
invariant( _cursor->isPinned() );
- if ( _cursor->cursorCache() == NULL ) {
+ if ( _cursor->cursorManager() == NULL ) {
// The ClientCursor was killed while we had it. Therefore, it is our responsibility to
// kill it.
deleteUnderlying();
}
else {
- // Unpin the cursor under the collection cursor cache lock.
- _cursor->cursorCache()->unpin( _cursor );
+ // Unpin the cursor under the collection cursor manager lock.
+ _cursor->cursorManager()->unpin( _cursor );
}
}
@@ -252,11 +252,11 @@ namespace mongo {
// - We must unpin the cursor before destruction, since it is an error to destroy a pinned
// cursor.
// - In addition, we must deregister the cursor before unpinning, since it is an
- // error to unpin a registered cursor without holding the cursor cache lock (note that we
- // can't simply unpin with the cursor cache lock here, since we need to guarantee
+ // error to unpin a registered cursor without holding the cursor manager lock (note that
+ // we can't simply unpin with the cursor manager lock here, since we need to guarantee
// exclusive ownership of the cursor when we are deleting it).
- if ( _cursor->cursorCache() ) {
- _cursor->cursorCache()->deregisterCursor( _cursor );
+ if ( _cursor->cursorManager() ) {
+ _cursor->cursorManager()->deregisterCursor( _cursor );
_cursor->kill();
}
_cursor->unsetPinned();
@@ -287,7 +287,7 @@ namespace mongo {
while (!inShutdown()) {
OperationContextImpl txn;
cursorStatsTimedOut.increment(
- CollectionCursorCache::timeoutCursorsGlobal(&txn, t.millisReset()));
+ CursorManager::timeoutCursorsGlobal(&txn, t.millisReset()));
sleepsecs(Secs);
}
client.shutdown();
diff --git a/src/mongo/db/clientcursor.h b/src/mongo/db/clientcursor.h
index 356c33f2bc0..8174efab5ab 100644
--- a/src/mongo/db/clientcursor.h
+++ b/src/mongo/db/clientcursor.h
@@ -43,8 +43,8 @@ namespace mongo {
typedef boost::recursive_mutex::scoped_lock recursive_scoped_lock;
class ClientCursor;
class Collection;
- class CollectionCursorCache;
class CurOp;
+ class CursorManager;
class Database;
class NamespaceDetails;
class ParsedQuery;
@@ -62,7 +62,7 @@ namespace mongo {
/**
* This ClientCursor constructor creates a cursorid that can be getMore'd
*/
- ClientCursor(CollectionCursorCache* cursorCache,
+ ClientCursor(CursorManager* cursorManager,
PlanExecutor* exec,
int qopts = 0,
const BSONObj query = BSONObj(),
@@ -71,7 +71,7 @@ namespace mongo {
/**
* This ClientCursor is used to track sharding state.
*/
- ClientCursor(CollectionCursorCache* cursorCache);
+ ClientCursor(CursorManager* cursorManager);
//
// Basic accessors
@@ -79,7 +79,7 @@ namespace mongo {
CursorId cursorid() const { return _cursorid; }
std::string ns() const { return _ns; }
- CollectionCursorCache* cursorCache() const { return _cursorCache; }
+ CursorManager* cursorManager() const { return _cursorManager; }
bool isAggCursor() const { return _isAggCursor; }
//
@@ -197,7 +197,7 @@ namespace mongo {
RecoveryUnit* releaseOwnedRecoveryUnit();
private:
- friend class CollectionCursorCache;
+ friend class CursorManager;
friend class ClientCursorPin;
/**
@@ -221,7 +221,7 @@ namespace mongo {
// The namespace we're operating on.
std::string _ns;
- CollectionCursorCache* _cursorCache;
+ CursorManager* _cursorManager;
// if we've added it to the total open counter yet
bool _countedYet;
@@ -289,7 +289,7 @@ namespace mongo {
*/
class ClientCursorPin : boost::noncopyable {
public:
- ClientCursorPin( CollectionCursorCache* cursorCache, long long cursorid );
+ ClientCursorPin( CursorManager* cursorManager, long long cursorid );
~ClientCursorPin();
// This just releases the pin, does not delete the underlying
// unless ownership has passed to us after kill
diff --git a/src/mongo/db/commands/parallel_collection_scan.cpp b/src/mongo/db/commands/parallel_collection_scan.cpp
index e36ad731d83..0dc2950f18d 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->cursorCache(),
+ ClientCursor* cc = new ClientCursor( collection->cursorManager(),
execs.releaseAt(i) );
// we are mimicking the aggregation cursor output here
diff --git a/src/mongo/db/commands/pipeline_command.cpp b/src/mongo/db/commands/pipeline_command.cpp
index 18daf7facbd..9583a58fb34 100644
--- a/src/mongo/db/commands/pipeline_command.cpp
+++ b/src/mongo/db/commands/pipeline_command.cpp
@@ -275,10 +275,10 @@ namespace mongo {
if (collection) {
// XXX
const bool isAggCursor = true; // enable special locking behavior
- ClientCursor* cursor = new ClientCursor(collection->cursorCache(),
+ ClientCursor* cursor = new ClientCursor(collection->cursorManager(),
execHolder.release(), 0, BSONObj(),
isAggCursor);
- pin.reset(new ClientCursorPin(collection->cursorCache(), cursor->cursorid()));
+ pin.reset(new ClientCursorPin(collection->cursorManager(), 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 c968b03c1be..9e97763e0f9 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->cursorCache(), exec.release());
+ ClientCursor* cc = new ClientCursor(collection->cursorManager(), exec.release());
BSONObjBuilder cursorObj(result.subobjStart("cursor"));
cursorObj.append("id", cc->cursorid());
diff --git a/src/mongo/db/instance.cpp b/src/mongo/db/instance.cpp
index aad9da30096..92c3f8e30e0 100644
--- a/src/mongo/db/instance.cpp
+++ b/src/mongo/db/instance.cpp
@@ -522,7 +522,7 @@ namespace {
const char* cursorArray = dbmessage.getArray(n);
- int found = CollectionCursorCache::eraseCursorGlobalIfAuthorized(txn, n, cursorArray);
+ int found = CursorManager::eraseCursorGlobalIfAuthorized(txn, n, cursorArray);
if ( logger::globalLogDomain()->shouldLog(logger::LogSeverity::Debug(1)) || found != n ) {
LOG( found == n ? 1 : 0 ) << "killcursors: found " << found << " of " << n << endl;
@@ -781,7 +781,7 @@ namespace {
// because it may now be out of sync with the client's iteration state.
// SERVER-7952
// TODO Temporary code, see SERVER-4563 for a cleanup overview.
- CollectionCursorCache::eraseCursorGlobal(txn, cursorid );
+ CursorManager::eraseCursorGlobal(txn, cursorid );
}
ex.reset( new AssertionException( e.getInfo().msg, e.getCode() ) );
ok = false;
diff --git a/src/mongo/db/query/find.cpp b/src/mongo/db/query/find.cpp
index 24f77315a27..74a0de79e36 100644
--- a/src/mongo/db/query/find.cpp
+++ b/src/mongo/db/query/find.cpp
@@ -211,7 +211,7 @@ namespace mongo {
// A pin performs a CC lookup and if there is a CC, increments the CC's pin value so it
// doesn't time out. Also informs ClientCursor that there is somebody actively holding the
// CC, so don't delete it.
- ClientCursorPin ccPin(collection->cursorCache(), cursorid);
+ ClientCursorPin ccPin(collection->cursorManager(), cursorid);
ClientCursor* cc = ccPin.c();
// If we're not being called from DBDirectClient we want to associate the RecoveryUnit
@@ -824,7 +824,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->cursorCache(), exec.get(),
+ ClientCursor* cc = new ClientCursor(collection->cursorManager(), exec.get(),
pq.getOptions().toInt(),
pq.getFilter());
ccId = cc->cursorid();
diff --git a/src/mongo/db/query/plan_executor.cpp b/src/mongo/db/query/plan_executor.cpp
index 796523470d1..f54f835188a 100644
--- a/src/mongo/db/query/plan_executor.cpp
+++ b/src/mongo/db/query/plan_executor.cpp
@@ -444,13 +444,13 @@ namespace mongo {
// Collection can be null for an EOFStage plan, or other places where registration
// is not needed.
if (_exec->collection()) {
- _exec->collection()->cursorCache()->registerExecutor(exec);
+ _exec->collection()->cursorManager()->registerExecutor(exec);
}
}
PlanExecutor::ScopedExecutorRegistration::~ScopedExecutorRegistration() {
if (_exec->collection()) {
- _exec->collection()->cursorCache()->deregisterExecutor(_exec);
+ _exec->collection()->cursorManager()->deregisterExecutor(_exec);
}
}
diff --git a/src/mongo/db/query/plan_executor.h b/src/mongo/db/query/plan_executor.h
index eecfb6efe09..5bef6e89438 100644
--- a/src/mongo/db/query/plan_executor.h
+++ b/src/mongo/db/query/plan_executor.h
@@ -270,7 +270,7 @@ namespace mongo {
//
/**
- * Register this plan executor with the collection cursor cache so that it
+ * Register this plan executor with the collection cursor manager so that it
* receives notifications for events that happen while yielding any locks.
*
* Deregistration happens automatically when this plan executor is destroyed.
diff --git a/src/mongo/db/range_deleter_db_env.cpp b/src/mongo/db/range_deleter_db_env.cpp
index caa95550a06..b82a89a47f1 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->cursorCache()->getCursorIds( openCursors );
+ collection->cursorManager()->getCursorIds( openCursors );
}
}
diff --git a/src/mongo/db/range_preserver.h b/src/mongo/db/range_preserver.h
index 626d541f76d..042987863c4 100644
--- a/src/mongo/db/range_preserver.h
+++ b/src/mongo/db/range_preserver.h
@@ -52,10 +52,10 @@ namespace mongo {
// Empty collections don't have any data we need to preserve
if (collection) {
// Not a memory leak. Cached in a static structure by CC's ctor.
- ClientCursor* cc = new ClientCursor(collection->cursorCache());
+ ClientCursor* cc = new ClientCursor(collection->cursorManager());
// Pin keeps the CC from being deleted while it's in scope. We delete it ourselves.
- _pin.reset(new ClientCursorPin(collection->cursorCache(), cc->cursorid()));
+ _pin.reset(new ClientCursorPin(collection->cursorManager(), cc->cursorid()));
}
}
diff --git a/src/mongo/dbtests/executor_registry.cpp b/src/mongo/dbtests/executor_registry.cpp
index 50319bbaf8a..183079bee08 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())
- ->cursorCache()
+ ->cursorManager()
->registerExecutor(exec);
wuow.commit();
}
@@ -98,7 +98,7 @@ namespace ExecutorRegistry {
void deregisterExecutor( PlanExecutor* exec ) {
WriteUnitOfWork wuow(&_opCtx);
_ctx->ctx().db()->getOrCreateCollection(&_opCtx, ns())
- ->cursorCache()
+ ->cursorManager()
->deregisterExecutor(exec);
wuow.commit();
}
diff --git a/src/mongo/dbtests/query_plan_executor.cpp b/src/mongo/dbtests/query_plan_executor.cpp
index ca3ac770f78..dcb46f8705d 100644
--- a/src/mongo/dbtests/query_plan_executor.cpp
+++ b/src/mongo/dbtests/query_plan_executor.cpp
@@ -154,7 +154,7 @@ namespace QueryPlanExecutor {
Collection* collection = ctx.getCollection();
if ( !collection )
return 0;
- return collection->cursorCache()->numCursors();
+ return collection->cursorManager()->numCursors();
}
void registerExec( PlanExecutor* exec ) {
@@ -162,7 +162,7 @@ namespace QueryPlanExecutor {
AutoGetCollectionForRead ctx(&_txn, ns());
WriteUnitOfWork wunit(&_txn);
Collection* collection = ctx.getDb()->getOrCreateCollection(&_txn, ns());
- collection->cursorCache()->registerExecutor( exec );
+ collection->cursorManager()->registerExecutor( exec );
wunit.commit();
}
@@ -171,7 +171,7 @@ namespace QueryPlanExecutor {
AutoGetCollectionForRead ctx(&_txn, ns());
WriteUnitOfWork wunit(&_txn);
Collection* collection = ctx.getDb()->getOrCreateCollection(&_txn, ns());
- collection->cursorCache()->deregisterExecutor( exec );
+ collection->cursorManager()->deregisterExecutor( exec );
wunit.commit();
}
@@ -415,12 +415,12 @@ namespace QueryPlanExecutor {
PlanExecutor* exec = makeCollScanExec(coll,filterObj);
// Make a client cursor from the runner.
- new ClientCursor(coll->cursorCache(), exec, 0, BSONObj());
+ new ClientCursor(coll->cursorManager(), exec, 0, BSONObj());
// There should be one cursor before invalidation,
// and zero cursors after invalidation.
ASSERT_EQUALS(1U, numCursors());
- coll->cursorCache()->invalidateAll(false);
+ coll->cursorManager()->invalidateAll(false);
ASSERT_EQUALS(0U, numCursors());
}
};
@@ -441,13 +441,14 @@ namespace QueryPlanExecutor {
PlanExecutor* exec = makeCollScanExec(collection, filterObj);
// Make a client cursor from the runner.
- ClientCursor* cc = new ClientCursor(collection->cursorCache(), exec, 0, BSONObj());
- ClientCursorPin ccPin(collection->cursorCache(), cc->cursorid());
+ ClientCursor* cc = new ClientCursor(collection->cursorManager(), exec, 0,
+ BSONObj());
+ ClientCursorPin ccPin(collection->cursorManager(), cc->cursorid());
// If the cursor is pinned, it sticks around,
// even after invalidation.
ASSERT_EQUALS(1U, numCursors());
- collection->cursorCache()->invalidateAll(false);
+ collection->cursorManager()->invalidateAll(false);
ASSERT_EQUALS(1U, numCursors());
// The invalidation should have killed the runner.
@@ -481,13 +482,13 @@ namespace QueryPlanExecutor {
PlanExecutor* exec = makeCollScanExec(collection, filterObj);
// Make a client cursor from the runner.
- new ClientCursor(collection->cursorCache(), exec, 0, BSONObj());
+ new ClientCursor(collection->cursorManager(), exec, 0, BSONObj());
}
// There should be one cursor before timeout,
// and zero cursors after timeout.
ASSERT_EQUALS(1U, numCursors());
- CollectionCursorCache::timeoutCursorsGlobal(&_txn, 600001);
+ CursorManager::timeoutCursorsGlobal(&_txn, 600001);
ASSERT_EQUALS(0U, numCursors());
}
};
diff --git a/src/mongo/dbtests/querytests.cpp b/src/mongo/dbtests/querytests.cpp
index 84647587496..449a3d52b7d 100644
--- a/src/mongo/dbtests/querytests.cpp
+++ b/src/mongo/dbtests/querytests.cpp
@@ -265,7 +265,7 @@ namespace QueryTests {
{
// Check internal server handoff to getmore.
Client::WriteContext ctx(&_txn, ns);
- ClientCursorPin clientCursor( ctx.getCollection()->cursorCache(), cursorId );
+ ClientCursorPin clientCursor( ctx.getCollection()->cursorManager(), 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() );
@@ -319,10 +319,10 @@ namespace QueryTests {
// Check that the cursor has been removed.
{
AutoGetCollectionForRead ctx(&_txn, ns);
- ASSERT(0 == ctx.getCollection()->cursorCache()->numCursors());
+ ASSERT(0 == ctx.getCollection()->cursorManager()->numCursors());
}
- ASSERT_FALSE(CollectionCursorCache::eraseCursorGlobal(&_txn, cursorId));
+ ASSERT_FALSE(CursorManager::eraseCursorGlobal(&_txn, cursorId));
// Check that a subsequent get more fails with the cursor removed.
ASSERT_THROWS( _client.getMore( ns, cursorId ), UserException );
@@ -369,8 +369,8 @@ namespace QueryTests {
// Check that the cursor still exists
{
AutoGetCollectionForRead ctx(&_txn, ns);
- ASSERT(1 == ctx.getCollection()->cursorCache()->numCursors());
- ASSERT(ctx.getCollection()->cursorCache()->find(cursorId, false));
+ ASSERT(1 == ctx.getCollection()->cursorManager()->numCursors());
+ ASSERT(ctx.getCollection()->cursorManager()->find(cursorId, false));
}
// Check that the cursor can be iterated until all documents are returned.
@@ -665,7 +665,7 @@ namespace QueryTests {
ASSERT_EQUALS( two, c->next()["ts"].Date() );
long long cursorId = c->getCursorId();
- ClientCursorPin clientCursor( ctx.db()->getCollection( &_txn, ns )->cursorCache(),
+ ClientCursorPin clientCursor( ctx.db()->getCollection( &_txn, ns )->cursorManager(),
cursorId );
ASSERT_EQUALS( three.millis, clientCursor.c()->getSlaveReadTill().asDate() );
}
@@ -1172,7 +1172,7 @@ namespace QueryTests {
Collection* collection = ctx.getCollection();
if ( !collection )
return 0;
- return collection->cursorCache()->numCursors();
+ return collection->cursorManager()->numCursors();
}
const char * ns() {
@@ -1516,7 +1516,7 @@ namespace QueryTests {
ClientCursor *clientCursor = 0;
{
AutoGetCollectionForRead ctx(&_txn, ns());
- ClientCursorPin clientCursorPointer(ctx.getCollection()->cursorCache(), cursorId);
+ ClientCursorPin clientCursorPointer(ctx.getCollection()->cursorManager(), cursorId);
clientCursor = clientCursorPointer.c();
// clientCursorPointer destructor unpins the cursor.
}
@@ -1554,11 +1554,11 @@ namespace QueryTests {
{
Client::WriteContext ctx(&_txn, ns() );
ClientCursorPin pinCursor( ctx.ctx().db()->getCollection( &_txn,
- ns())->cursorCache(),
+ ns())->cursorManager(),
cursorId );
string expectedAssertion =
str::stream() << "Cannot kill active cursor " << cursorId;
- ASSERT_THROWS_WHAT(CollectionCursorCache::eraseCursorGlobal(&_txn, cursorId),
+ ASSERT_THROWS_WHAT(CursorManager::eraseCursorGlobal(&_txn, cursorId),
MsgAssertionException, expectedAssertion);
}