diff options
author | Benety Goh <benety@mongodb.com> | 2015-01-15 23:03:01 -0500 |
---|---|---|
committer | Benety Goh <benety@mongodb.com> | 2015-01-16 17:01:57 -0500 |
commit | 020cc851f48cca51ba2ac6c94ca93119a4563c4f (patch) | |
tree | cf1f7e2d25dfb9c8397109412791e79ddf669df3 /src | |
parent | 6bab2f390cfbae08bf0801668f54a5fd35db2bfc (diff) | |
download | mongo-020cc851f48cca51ba2ac6c94ca93119a4563c4f.tar.gz |
SERVER-16906 storage engines without directoryperdb support should fail to start up with --directoryperdb
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/storage/devnull/devnull_kv_engine.h | 4 | ||||
-rw-r--r-- | src/mongo/db/storage/in_memory/in_memory_engine.h | 2 | ||||
-rw-r--r-- | src/mongo/db/storage/kv/kv_engine.h | 7 | ||||
-rw-r--r-- | src/mongo/db/storage/kv/kv_storage_engine.cpp | 5 | ||||
-rw-r--r-- | src/mongo/db/storage/rocks/rocks_engine.h | 4 | ||||
-rw-r--r-- | src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h | 2 |
7 files changed, 28 insertions, 0 deletions
diff --git a/src/mongo/db/storage/devnull/devnull_kv_engine.h b/src/mongo/db/storage/devnull/devnull_kv_engine.h index a1f19d53e19..05f88e7ebee 100644 --- a/src/mongo/db/storage/devnull/devnull_kv_engine.h +++ b/src/mongo/db/storage/devnull/devnull_kv_engine.h @@ -76,6 +76,10 @@ namespace mongo { return true; } + virtual bool supportsDirectoryPerDB() const { + return false; + } + virtual bool isDurable() const { return true; } diff --git a/src/mongo/db/storage/in_memory/in_memory_engine.h b/src/mongo/db/storage/in_memory/in_memory_engine.h index a466bd93dc3..c9aafb59f4c 100644 --- a/src/mongo/db/storage/in_memory/in_memory_engine.h +++ b/src/mongo/db/storage/in_memory/in_memory_engine.h @@ -65,6 +65,8 @@ namespace mongo { virtual bool supportsDocLocking() const { return false; } + virtual bool supportsDirectoryPerDB() const { return false; } + /** * This is sort of strange since "durable" has no meaning... */ diff --git a/src/mongo/db/storage/kv/kv_engine.h b/src/mongo/db/storage/kv/kv_engine.h index e7eacddf1ca..a78d14e5385 100644 --- a/src/mongo/db/storage/kv/kv_engine.h +++ b/src/mongo/db/storage/kv/kv_engine.h @@ -102,6 +102,13 @@ namespace mongo { */ virtual bool supportsDocLocking() const = 0; + /** + * Returns true if storage engine supports --directoryperdb. + * See: + * http://docs.mongodb.org/manual/reference/program/mongod/#cmdoption--directoryperdb + */ + virtual bool supportsDirectoryPerDB() const = 0; + virtual Status okToRename( OperationContext* opCtx, const StringData& fromNS, const StringData& toNS, diff --git a/src/mongo/db/storage/kv/kv_storage_engine.cpp b/src/mongo/db/storage/kv/kv_storage_engine.cpp index fc2ddbb580b..0f8e8c509ae 100644 --- a/src/mongo/db/storage/kv/kv_storage_engine.cpp +++ b/src/mongo/db/storage/kv/kv_storage_engine.cpp @@ -35,7 +35,9 @@ #include "mongo/db/operation_context_noop.h" #include "mongo/db/storage/kv/kv_database_catalog_entry.h" #include "mongo/db/storage/kv/kv_engine.h" +#include "mongo/util/assert_util.h" #include "mongo/util/log.h" +#include "mongo/util/mongoutils/str.h" namespace mongo { @@ -74,6 +76,9 @@ namespace mongo { , _engine( engine ) , _supportsDocLocking(_engine->supportsDocLocking()) { + uassert(28601, "Storage engine does not support --directoryperdb", + !(options.directoryPerDB && !engine->supportsDirectoryPerDB())); + OperationContextNoop opCtx( _engine->newRecoveryUnit() ); if (options.forRepair && engine->hasIdent(&opCtx, catalogInfo)) { diff --git a/src/mongo/db/storage/rocks/rocks_engine.h b/src/mongo/db/storage/rocks/rocks_engine.h index e84477e058d..4179150bc8c 100644 --- a/src/mongo/db/storage/rocks/rocks_engine.h +++ b/src/mongo/db/storage/rocks/rocks_engine.h @@ -97,6 +97,10 @@ namespace mongo { return true; } + virtual bool supportsDirectoryPerDB() const override { + return false; + } + virtual bool isDurable() const override { return _durable; } virtual int64_t getIdentSize(OperationContext* opCtx, diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp index 040429f6d98..84122dfa2b2 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp @@ -450,6 +450,10 @@ namespace mongo { return true; } + bool WiredTigerKVEngine::supportsDirectoryPerDB() const { + return true; + } + bool WiredTigerKVEngine::hasIdent(OperationContext* opCtx, const StringData& ident) const { return _hasUri(WiredTigerRecoveryUnit::get(opCtx)->getSession()->getSession(), _uri(ident)); } diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h index 845d226478a..cfce57c54cc 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h @@ -62,6 +62,8 @@ namespace mongo { virtual bool supportsDocLocking() const; + virtual bool supportsDirectoryPerDB() const; + virtual bool isDurable() const { return _durable; } virtual RecoveryUnit* newRecoveryUnit(); |