diff --git a/db/database.cpp b/db/database.cpp index d6038ae5d7d..1a366909dc8 100644 --- a/db/database.cpp +++ b/db/database.cpp @@ -37,7 +37,9 @@ namespace mongo { } Database::Database(const char *nm, bool& newDb, const string& _path ) - : name(nm), path(_path), namespaceIndex( path, name ) { + : name(nm), path(_path), namespaceIndex( path, name ), + profileName(name + ".system.profile") + { { // check db name is valid size_t L = strlen(nm); @@ -50,7 +52,6 @@ namespace mongo { newDb = namespaceIndex.exists(); profile = 0; - profileName = name + ".system.profile"; { vector others; diff --git a/db/database.h b/db/database.h index a3659dc0be0..11b8bce228e 100644 --- a/db/database.h +++ b/db/database.h @@ -33,7 +33,7 @@ namespace mongo { public: static bool _openAllFiles; - Database(const char *nm, bool& newDb, const string& _path = dbpath); + Database(const char *nm, /*out*/ bool& newDb, const string& _path = dbpath); private: ~Database(); public: @@ -45,15 +45,13 @@ namespace mongo { /** * tries to make sure that this hasn't been deleted */ - bool isOk(){ - return magic == 781231; - } + bool isOk() const { return magic == 781231; } bool isEmpty(){ return ! namespaceIndex.allocated(); } - boost::filesystem::path fileName( int n ) { + boost::filesystem::path fileName( int n ) const { stringstream ss; ss << name << '.' << n; boost::filesystem::path fullName; @@ -64,7 +62,7 @@ namespace mongo { return fullName; } - bool exists(int n) { + bool exists(int n) const { return boost::filesystem::exists( fileName( n ) ); } @@ -174,7 +172,7 @@ namespace mongo { } /** - * @return true if success, false otherwise + * @return true if success. false if bad level or error creating profile ns */ bool setProfilingLevel( int newLevel , string& errmsg ); @@ -192,14 +190,12 @@ namespace mongo { void flushFiles( bool sync ); vector files; - string name; // "alleyinsider" - string path; + const string name; // "alleyinsider" + const string path; NamespaceIndex namespaceIndex; int profile; // 0=off. - string profileName; // "alleyinsider.system.profile" - + const string profileName; // "alleyinsider.system.profile" multimap ccByLoc; - int magic; // used for making sure the object is still loaded in memory }; diff --git a/db/repl.cpp b/db/repl.cpp index d9a3dbdde36..6afad34450c 100644 --- a/db/repl.cpp +++ b/db/repl.cpp @@ -25,7 +25,7 @@ local.sources - indicates what sources we pull from as a "slave", and the last update of each local.oplog.$main - our op log as "master" - local.dbinfo. + local.dbinfo. - no longer used??? local.pair.startup - can contain a special value indicating for a pair that we have the master copy. used when replacing other half of the pair which has permanently failed. local.pair.sync - { initialsynccomplete: 1 }