summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2014-04-28 17:10:04 -0400
committerMathias Stearn <mathias@10gen.com>2014-04-29 09:06:25 -0400
commit6ee00c6473d790afd1d1dd91b7c6991397aaec39 (patch)
tree0ad1ac6ef0755aa810986f9a7267347c3ed6512b /src/mongo/db
parent9443c5c229a77366c3593964bd837cb29c2a0524 (diff)
downloadmongo-6ee00c6473d790afd1d1dd91b7c6991397aaec39.tar.gz
SERVER-13635 Don't include extent_manger.h in database.h
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/catalog/database.cpp21
-rw-r--r--src/mongo/db/catalog/database.h14
-rw-r--r--src/mongo/db/catalog/index_catalog.cpp1
-rw-r--r--src/mongo/db/commands/touch.cpp1
-rw-r--r--src/mongo/db/db.cpp1
-rw-r--r--src/mongo/db/dbcommands.cpp1
-rw-r--r--src/mongo/db/storage/record.cpp1
7 files changed, 26 insertions, 14 deletions
diff --git a/src/mongo/db/catalog/database.cpp b/src/mongo/db/catalog/database.cpp
index d33c6a3efec..6b544726b26 100644
--- a/src/mongo/db/catalog/database.cpp
+++ b/src/mongo/db/catalog/database.cpp
@@ -50,6 +50,7 @@
#include "mongo/db/server_parameters.h"
#include "mongo/db/storage/data_file.h"
#include "mongo/db/storage/extent.h"
+#include "mongo/db/storage/extent_manager.h"
#include "mongo/db/storage_options.h"
#include "mongo/db/structure/catalog/namespace_details.h"
#include "mongo/db/catalog/collection.h"
@@ -198,7 +199,7 @@ namespace mongo {
Database::Database(const char *nm, bool& newDb, const string& path )
: _name(nm), _path(path),
_namespaceIndex( _path, _name ),
- _extentManager(_name, _path, storageGlobalParams.directoryperdb),
+ _extentManager(new ExtentManager(_name, _path, storageGlobalParams.directoryperdb)),
_profileName(_name + ".system.profile"),
_namespacesName(_name + ".system.namespaces"),
_indexesName(_name + ".system.indexes"),
@@ -226,8 +227,8 @@ namespace mongo {
NamespaceDetails* details = _namespaceIndex.details( oldFreeList );
if ( details ) {
if ( !details->firstExtent().isNull() ) {
- _extentManager.freeExtents(details->firstExtent(),
- details->lastExtent());
+ _extentManager->freeExtents(details->firstExtent(),
+ details->lastExtent());
}
_namespaceIndex.kill_ns( oldFreeList );
}
@@ -299,7 +300,7 @@ namespace mongo {
// repair purposes yet we do not.
void Database::openAllFiles() {
verify(this);
- Status s = _extentManager.init();
+ Status s = _extentManager->init();
if ( !s.isOK() ) {
msgasserted( 16966, str::stream() << "_extentManager.init failed: " << s.toString() );
}
@@ -345,6 +346,12 @@ namespace mongo {
}
}
+ long long Database::fileSize() const { return _extentManager->fileSize(); }
+
+ int Database::numFiles() const { return _extentManager->numFiles(); }
+
+ void Database::flushFiles( bool sync ) { return _extentManager->flushFiles( sync ); }
+
bool Database::setProfilingLevel( int newLevel , string& errmsg ) {
if ( _profile == newLevel )
return true;
@@ -788,7 +795,7 @@ namespace mongo {
// free extents
if( !d->firstExtent().isNull() ) {
- _extentManager.freeExtents(d->firstExtent(), d->lastExtent());
+ _extentManager->freeExtents(d->firstExtent(), d->lastExtent());
d->setFirstExtentInvalid();
d->setLastExtentInvalid();
}
@@ -800,12 +807,12 @@ namespace mongo {
}
void Database::getFileFormat( int* major, int* minor ) {
- if ( _extentManager.numFiles() == 0 ) {
+ if ( _extentManager->numFiles() == 0 ) {
*major = 0;
*minor = 0;
return;
}
- const DataFile* df = _extentManager.getFile( 0 );
+ const DataFile* df = _extentManager->getFile( 0 );
*major = df->getHeader()->version;
*minor = df->getHeader()->versionMinor;
}
diff --git a/src/mongo/db/catalog/database.h b/src/mongo/db/catalog/database.h
index 57219fee63f..4ff05a209db 100644
--- a/src/mongo/db/catalog/database.h
+++ b/src/mongo/db/catalog/database.h
@@ -32,7 +32,6 @@
#include "mongo/db/namespace_string.h"
#include "mongo/db/structure/catalog/namespace_index.h"
-#include "mongo/db/storage/extent_manager.h"
#include "mongo/db/storage/record.h"
#include "mongo/db/storage_options.h"
#include "mongo/util/string_map.h"
@@ -41,6 +40,7 @@ namespace mongo {
class Collection;
class Extent;
+ class ExtentManager;
class DataFile;
class IndexCatalog;
class NamespaceDetails;
@@ -121,9 +121,9 @@ namespace mongo {
/**
* total file size of Database in bytes
*/
- long long fileSize() const { return _extentManager.fileSize(); }
+ long long fileSize() const;
- int numFiles() const { return _extentManager.numFiles(); }
+ int numFiles() const;
void getFileFormat( int* major, int* minor );
@@ -132,7 +132,7 @@ namespace mongo {
*/
bool setProfilingLevel( int newLevel , string& errmsg );
- void flushFiles( bool sync ) { return _extentManager.flushFiles( sync ); }
+ void flushFiles( bool sync );
/**
* @return true if ns is part of the database
@@ -154,8 +154,8 @@ namespace mongo {
NamespaceIndex& namespaceIndex() { return _namespaceIndex; }
// TODO: do not think this method should exist, so should try and encapsulate better
- ExtentManager& getExtentManager() { return _extentManager; }
- const ExtentManager& getExtentManager() const { return _extentManager; }
+ ExtentManager& getExtentManager() { return *_extentManager; }
+ const ExtentManager& getExtentManager() const { return *_extentManager; }
Status dropCollection( const StringData& fullns );
@@ -219,7 +219,7 @@ namespace mongo {
const string _path; // "/data/db"
NamespaceIndex _namespaceIndex;
- ExtentManager _extentManager;
+ boost::scoped_ptr<ExtentManager> _extentManager;
const string _profileName; // "alleyinsider.system.profile"
const string _namespacesName; // "alleyinsider.system.namespaces"
diff --git a/src/mongo/db/catalog/index_catalog.cpp b/src/mongo/db/catalog/index_catalog.cpp
index 7359d1ac42e..f1c09a07d1e 100644
--- a/src/mongo/db/catalog/index_catalog.cpp
+++ b/src/mongo/db/catalog/index_catalog.cpp
@@ -60,6 +60,7 @@
#include "mongo/db/query/internal_plans.h"
#include "mongo/db/repl/rs.h" // this is ugly
#include "mongo/db/storage/data_file.h"
+#include "mongo/db/storage/extent_manager.h"
#include "mongo/db/structure/catalog/namespace_details.h"
#include "mongo/db/structure/catalog/namespace_details_rsv1_metadata.h"
#include "mongo/db/structure/record_store_v1_simple.h"
diff --git a/src/mongo/db/commands/touch.cpp b/src/mongo/db/commands/touch.cpp
index 0fe50f19f8d..83dc0aff893 100644
--- a/src/mongo/db/commands/touch.cpp
+++ b/src/mongo/db/commands/touch.cpp
@@ -49,6 +49,7 @@
#include "mongo/db/kill_current_op.h"
#include "mongo/db/pdfile.h"
#include "mongo/db/storage/extent.h"
+#include "mongo/db/storage/extent_manager.h"
#include "mongo/db/structure/catalog/namespace_details.h"
#include "mongo/util/timer.h"
#include "mongo/util/touch_pages.h"
diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp
index f18df2ed3d1..72cb43050ce 100644
--- a/src/mongo/db/db.cpp
+++ b/src/mongo/db/db.cpp
@@ -73,6 +73,7 @@
#include "mongo/db/stats/counters.h"
#include "mongo/db/stats/snapshots.h"
#include "mongo/db/storage/data_file.h"
+#include "mongo/db/storage/extent_manager.h"
#include "mongo/db/storage_options.h"
#include "mongo/db/ttl.h"
#include "mongo/platform/process_id.h"
diff --git a/src/mongo/db/dbcommands.cpp b/src/mongo/db/dbcommands.cpp
index e80d07936ea..2fb41d3a976 100644
--- a/src/mongo/db/dbcommands.cpp
+++ b/src/mongo/db/dbcommands.cpp
@@ -67,6 +67,7 @@
#include "mongo/db/repair_database.h"
#include "mongo/db/repl/is_master.h"
#include "mongo/db/repl/oplog.h"
+#include "mongo/db/storage/extent_manager.h"
#include "mongo/db/structure/catalog/namespace_details.h"
#include "mongo/db/write_concern.h"
#include "mongo/s/d_logic.h"
diff --git a/src/mongo/db/storage/record.cpp b/src/mongo/db/storage/record.cpp
index a4e9dea109d..23bf3ebb28c 100644
--- a/src/mongo/db/storage/record.cpp
+++ b/src/mongo/db/storage/record.cpp
@@ -38,6 +38,7 @@
#include "mongo/db/catalog/database_holder.h"
#include "mongo/db/pagefault.h"
#include "mongo/db/pdfile.h"
+#include "mongo/db/storage/extent_manager.h"
#include "mongo/platform/bits.h"
#include "mongo/platform/unordered_set.h"
#include "mongo/util/net/listen.h"