Skip to content

Commit

Permalink
SERVER-19543 Don't store a pointer to the CatalogManager in the Catal…
Browse files Browse the repository at this point in the history
…ogCache
  • Loading branch information
stbrody committed Aug 13, 2015
1 parent 5c30b38 commit 0978210
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
7 changes: 3 additions & 4 deletions src/mongo/s/catalog/catalog_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,15 @@
#include "mongo/s/catalog/catalog_manager.h"
#include "mongo/s/catalog/type_database.h"
#include "mongo/s/config.h"
#include "mongo/s/grid.h"

namespace mongo {

using std::shared_ptr;
using std::string;


CatalogCache::CatalogCache(CatalogManager* catalogManager) : _catalogManager(catalogManager) {
invariant(_catalogManager);
}
CatalogCache::CatalogCache() {}

StatusWith<shared_ptr<DBConfig>> CatalogCache::getDatabase(OperationContext* txn,
const string& dbName) {
Expand All @@ -56,7 +55,7 @@ StatusWith<shared_ptr<DBConfig>> CatalogCache::getDatabase(OperationContext* txn
}

// Need to load from the store
StatusWith<DatabaseType> status = _catalogManager->getDatabase(dbName);
StatusWith<DatabaseType> status = grid.catalogManager(txn)->getDatabase(dbName);
if (!status.isOK()) {
return status.getStatus();
}
Expand Down
6 changes: 1 addition & 5 deletions src/mongo/s/catalog/catalog_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class CatalogCache {
MONGO_DISALLOW_COPYING(CatalogCache);

public:
explicit CatalogCache(CatalogManager* catalogManager);
CatalogCache();

/**
* Retrieves the cached metadata for the specified database. The returned value is still
Expand Down Expand Up @@ -81,10 +81,6 @@ class CatalogCache {
private:
typedef std::map<std::string, std::shared_ptr<DBConfig>> ShardedDatabasesMap;


// Reference to the catalog manager. Not owned.
CatalogManager* const _catalogManager;

// Databases catalog map and mutex to protect it
stdx::mutex _mutex;
ShardedDatabasesMap _databases;
Expand Down
2 changes: 1 addition & 1 deletion src/mongo/s/grid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void Grid::init(std::unique_ptr<CatalogManager> catalogManager,
invariant(!_cursorManager);

_catalogManager = std::move(catalogManager);
_catalogCache = stdx::make_unique<CatalogCache>(_catalogManager.get());
_catalogCache = stdx::make_unique<CatalogCache>();
_shardRegistry = std::move(shardRegistry);
_cursorManager = std::move(cursorManager);
}
Expand Down

0 comments on commit 0978210

Please sign in to comment.