diff --git a/arangod/RocksDBEngine/RocksDBEngine.cpp b/arangod/RocksDBEngine/RocksDBEngine.cpp index 4ba10909d0..d451381c40 100644 --- a/arangod/RocksDBEngine/RocksDBEngine.cpp +++ b/arangod/RocksDBEngine/RocksDBEngine.cpp @@ -19,6 +19,7 @@ #include #include #include +#include using namespace arangodb; using namespace arangodb::application_features; @@ -84,6 +85,33 @@ void RocksDBEngine::start() { LOG_TOPIC(FATAL, arangodb::Logger::STARTUP) << "unable to initialize RocksDB engine: " << status.ToString(); FATAL_ERROR_EXIT(); } + + // create _system database if it should not exist + velocypack::Builder builder; + getDatabases(builder); + bool foundSystem = false; + for(auto const& item : velocypack::ArrayIterator(builder.slice())){ + // static string for _system?! + // stringref instead copyString + if(item.get("name").copyString() == "_system"){ + foundSystem = true; + break; + } + } + + if(!foundSystem){ + throw std::runtime_error("not fully implemented"); + + int err; + VPackBuilder builder; + TRI_voc_tick_t id(1337); + + createDatabase(id, builder.slice(), err); + if(err){ + LOG_TOPIC(FATAL, arangodb::Logger::STARTUP) << "unable to create _system database: " << err; + FATAL_ERROR_EXIT(); + } + } } void RocksDBEngine::stop() {