1
0
Fork 0

Harden database creation against spurious "duplicate name" errors (#9950)

that were caused by other parallel operations lazily creating required
system collections in the same database.
This commit is contained in:
Jan 2019-09-09 20:34:17 +02:00 committed by KVS85
parent 4feb615de7
commit ecd45a802a
22 changed files with 114 additions and 136 deletions

View File

@ -1,6 +1,10 @@
v3.5.1 (XXXX-XX-XX) v3.5.1 (XXXX-XX-XX)
------------------- -------------------
* Harden database creation against spurious "duplicate name" errors that
were caused by other parallel operations lazily creating required
system collections in the same database.
* Fixed internal issue #633: made ArangoSearch functions BOOST, ANALYZER, MIN_MATCH * Fixed internal issue #633: made ArangoSearch functions BOOST, ANALYZER, MIN_MATCH
callable with constant arguments. This will allow running queries where all arguments callable with constant arguments. This will allow running queries where all arguments
for these functions are deterministic and do not depend on loop variables. for these functions are deterministic and do not depend on loop variables.

View File

@ -1469,7 +1469,7 @@ Result ClusterInfo::createDatabaseCoordinator( // create database
if (!res.successful()) { if (!res.successful()) {
if (res._statusCode == (int)arangodb::rest::ResponseCode::PRECONDITION_FAILED) { if (res._statusCode == (int)arangodb::rest::ResponseCode::PRECONDITION_FAILED) {
return Result(TRI_ERROR_ARANGO_DUPLICATE_NAME); return Result(TRI_ERROR_ARANGO_DUPLICATE_NAME, std::string("duplicate database name '") + name + "'");
} }
return Result(TRI_ERROR_CLUSTER_COULD_NOT_CREATE_DATABASE_IN_PLAN); return Result(TRI_ERROR_CLUSTER_COULD_NOT_CREATE_DATABASE_IN_PLAN);
@ -1654,7 +1654,7 @@ Result ClusterInfo::checkCollectionPreconditions(std::string const& databaseName
if (it2 != (*it).second.end()) { if (it2 != (*it).second.end()) {
// collection already exists! // collection already exists!
events::CreateCollection(databaseName, info.name, TRI_ERROR_ARANGO_DUPLICATE_NAME); events::CreateCollection(databaseName, info.name, TRI_ERROR_ARANGO_DUPLICATE_NAME);
return TRI_ERROR_ARANGO_DUPLICATE_NAME; return Result(TRI_ERROR_ARANGO_DUPLICATE_NAME, std::string("duplicate collection name '") + info.name + "'");
} }
} else { } else {
// no collection in plan for this particular database... this may be true for // no collection in plan for this particular database... this may be true for
@ -1678,7 +1678,7 @@ Result ClusterInfo::checkCollectionPreconditions(std::string const& databaseName
if (it2 != (*it).second.end()) { if (it2 != (*it).second.end()) {
// view already exists! // view already exists!
events::CreateCollection(databaseName, info.name, TRI_ERROR_ARANGO_DUPLICATE_NAME); events::CreateCollection(databaseName, info.name, TRI_ERROR_ARANGO_DUPLICATE_NAME);
return TRI_ERROR_ARANGO_DUPLICATE_NAME; return Result(TRI_ERROR_ARANGO_DUPLICATE_NAME, std::string("duplicate collection name '") + info.name + "'");
} }
} }
} }
@ -2346,7 +2346,7 @@ Result ClusterInfo::createViewCoordinator( // create view
if (it2 != (*it).second.end()) { if (it2 != (*it).second.end()) {
// view already exists! // view already exists!
events::CreateView(databaseName, name, TRI_ERROR_ARANGO_DUPLICATE_NAME); events::CreateView(databaseName, name, TRI_ERROR_ARANGO_DUPLICATE_NAME);
return Result(TRI_ERROR_ARANGO_DUPLICATE_NAME); return Result(TRI_ERROR_ARANGO_DUPLICATE_NAME, std::string("duplicate view name '") + name + "'");
} }
} }
} }
@ -2359,7 +2359,7 @@ Result ClusterInfo::createViewCoordinator( // create view
if (it2 != (*it).second.end()) { if (it2 != (*it).second.end()) {
// collection already exists! // collection already exists!
events::CreateCollection(databaseName, name, TRI_ERROR_ARANGO_DUPLICATE_NAME); events::CreateCollection(databaseName, name, TRI_ERROR_ARANGO_DUPLICATE_NAME);
return Result(TRI_ERROR_ARANGO_DUPLICATE_NAME); return Result(TRI_ERROR_ARANGO_DUPLICATE_NAME, std::string("duplicate view name '") + name + "'");
} }
} }
} }

View File

@ -1171,12 +1171,12 @@ bool HeartbeatThread::handlePlanChangeCoordinator(uint64_t currentPlanVersion) {
// database does not yet exist, create it now // database does not yet exist, create it now
// create a local database object... // create a local database object...
int res = databaseFeature->createDatabase(id, name, vocbase); Result res = databaseFeature->createDatabase(id, name, vocbase);
if (res != TRI_ERROR_NO_ERROR) { if (res.fail()) {
LOG_TOPIC("ca877", ERR, arangodb::Logger::HEARTBEAT) LOG_TOPIC("ca877", ERR, arangodb::Logger::HEARTBEAT)
<< "creating local database '" << name << "creating local database '" << name
<< "' failed: " << TRI_errno_string(res); << "' failed: " << res.errorMessage();
} else { } else {
HasRunOnce.store(true, std::memory_order_release); HasRunOnce.store(true, std::memory_order_release);
} }

View File

@ -1222,12 +1222,12 @@ bool MMFilesWalRecoverState::ReplayMarker(MMFilesMarker const* marker,
MMFilesPersistentIndexFeature::dropDatabase(databaseId); MMFilesPersistentIndexFeature::dropDatabase(databaseId);
vocbase = nullptr; vocbase = nullptr;
int res = state->databaseFeature->createDatabase(databaseId, nameString, vocbase); Result res = state->databaseFeature->createDatabase(databaseId, nameString, vocbase);
if (res != TRI_ERROR_NO_ERROR) { if (res.fail()) {
LOG_TOPIC("9c045", WARN, arangodb::Logger::ENGINES) LOG_TOPIC("9c045", WARN, arangodb::Logger::ENGINES)
<< "cannot create database " << databaseId << ": " << "cannot create database " << databaseId << ": "
<< TRI_errno_string(res); << res.errorMessage();
++state->errorCount; ++state->errorCount;
return state->canContinue(); return state->canContinue();
} }

View File

@ -1964,8 +1964,10 @@ void RestReplicationHandler::handleCommandRestoreView() {
if (view) { if (view) {
if (!overwrite) { if (!overwrite) {
generateError(TRI_ERROR_ARANGO_DUPLICATE_NAME); generateError(GeneralResponse::responseCode(TRI_ERROR_ARANGO_DUPLICATE_NAME),
TRI_ERROR_ARANGO_DUPLICATE_NAME,
std::string("unable to restore view '") + nameSlice.copyString() + ": " +
TRI_errno_string(TRI_ERROR_ARANGO_DUPLICATE_NAME));
return; return;
} }
@ -1973,7 +1975,6 @@ void RestReplicationHandler::handleCommandRestoreView() {
if (!res.ok()) { if (!res.ok()) {
generateError(res); generateError(res);
return; return;
} }
} }

View File

@ -586,13 +586,13 @@ Result DatabaseFeature::registerPostRecoveryCallback(std::function<Result()>&& c
} }
/// @brief create a new database /// @brief create a new database
int DatabaseFeature::createDatabase(TRI_voc_tick_t id, std::string const& name, Result DatabaseFeature::createDatabase(TRI_voc_tick_t id, std::string const& name,
TRI_vocbase_t*& result) { TRI_vocbase_t*& result) {
result = nullptr; result = nullptr;
if (!TRI_vocbase_t::IsAllowedName(false, arangodb::velocypack::StringRef(name))) { if (!TRI_vocbase_t::IsAllowedName(false, arangodb::velocypack::StringRef(name))) {
events::CreateDatabase(name, TRI_ERROR_ARANGO_DATABASE_NAME_INVALID); events::CreateDatabase(name, TRI_ERROR_ARANGO_DATABASE_NAME_INVALID);
return TRI_ERROR_ARANGO_DATABASE_NAME_INVALID; return {TRI_ERROR_ARANGO_DATABASE_NAME_INVALID};
} }
if (id == 0) { if (id == 0) {
@ -620,7 +620,7 @@ int DatabaseFeature::createDatabase(TRI_voc_tick_t id, std::string const& name,
if (it != theLists->_databases.end()) { if (it != theLists->_databases.end()) {
// name already in use // name already in use
events::CreateDatabase(name, TRI_ERROR_ARANGO_DUPLICATE_NAME); events::CreateDatabase(name, TRI_ERROR_ARANGO_DUPLICATE_NAME);
return TRI_ERROR_ARANGO_DUPLICATE_NAME; return Result(TRI_ERROR_ARANGO_DUPLICATE_NAME, std::string("duplicate database name '") + name + "'");
} }
} }
@ -640,17 +640,17 @@ int DatabaseFeature::createDatabase(TRI_voc_tick_t id, std::string const& name,
try { try {
vocbase->addReplicationApplier(); vocbase->addReplicationApplier();
} catch (basics::Exception const& ex) { } catch (basics::Exception const& ex) {
LOG_TOPIC("e7444", ERR, arangodb::Logger::FIXME) std::string msg = "initializing replication applier for database '" +
<< "initializing replication applier for database '" vocbase->name() + "' failed: " + ex.what();
<< vocbase->name() << "' failed: " << ex.what(); LOG_TOPIC("e7444", ERR, arangodb::Logger::FIXME) << msg;
events::CreateDatabase(name, ex.code()); events::CreateDatabase(name, ex.code());
return ex.code(); return Result(ex.code(), std::move(msg));
} catch (std::exception const& ex) { } catch (std::exception const& ex) {
LOG_TOPIC("56c41", ERR, arangodb::Logger::FIXME) std::string msg = "initializing replication applier for database '" +
<< "initializing replication applier for database '" vocbase->name() + "' failed: " + ex.what();
<< vocbase->name() << "' failed: " << ex.what(); LOG_TOPIC("56c41", ERR, arangodb::Logger::FIXME) << msg;
events::CreateDatabase(name, TRI_ERROR_INTERNAL); events::CreateDatabase(name, TRI_ERROR_INTERNAL);
return TRI_ERROR_INTERNAL; return Result(TRI_ERROR_INTERNAL, std::move(msg));
} }
// enable deadlock detection // enable deadlock detection

View File

@ -110,7 +110,7 @@ class DatabaseFeature : public application_features::ApplicationFeature {
std::vector<std::string> getDatabaseNames(); std::vector<std::string> getDatabaseNames();
std::vector<std::string> getDatabaseNamesForUser(std::string const& user); std::vector<std::string> getDatabaseNamesForUser(std::string const& user);
int createDatabase(TRI_voc_tick_t id, std::string const& name, TRI_vocbase_t*& result); Result createDatabase(TRI_voc_tick_t id, std::string const& name, TRI_vocbase_t*& result);
int dropDatabase(std::string const& name, bool waitForDeletion, bool removeAppsDirectory); int dropDatabase(std::string const& name, bool waitForDeletion, bool removeAppsDirectory);
int dropDatabase(TRI_voc_tick_t id, bool waitForDeletion, bool removeAppsDirectory); int dropDatabase(TRI_voc_tick_t id, bool waitForDeletion, bool removeAppsDirectory);

View File

@ -271,9 +271,9 @@ arangodb::Result Databases::create(std::string const& dbName, VPackSlice const&
} }
TRI_vocbase_t* vocbase = nullptr; TRI_vocbase_t* vocbase = nullptr;
int res = databaseFeature->createDatabase(id, dbName, vocbase); Result res = databaseFeature->createDatabase(id, dbName, vocbase);
if (res != TRI_ERROR_NO_ERROR) { if (res.fail()) {
return Result(res); return res;
} }
TRI_ASSERT(vocbase != nullptr); TRI_ASSERT(vocbase != nullptr);

View File

@ -65,7 +65,7 @@ namespace {
void createSystemCollection(TRI_vocbase_t& vocbase, std::string const& name) { void createSystemCollection(TRI_vocbase_t& vocbase, std::string const& name) {
auto const res = methods::Collections::createSystem(vocbase, name); auto const res = methods::Collections::createSystem(vocbase, name);
if (res.fail()) { if (res.fail() && !res.is(TRI_ERROR_ARANGO_DUPLICATE_NAME)) {
THROW_ARANGO_EXCEPTION(res); THROW_ARANGO_EXCEPTION(res);
} }
} }

View File

@ -249,9 +249,8 @@ TEST_F(ClusterInfoTest, test_drop_database) {
"{ \"name\": \"testView\", \"type\": \"testViewType\" }"); "{ \"name\": \"testView\", \"type\": \"testViewType\" }");
TRI_vocbase_t* vocbase; // will be owned by DatabaseFeature TRI_vocbase_t* vocbase; // will be owned by DatabaseFeature
// create database // create database
ASSERT_TRUE((TRI_ERROR_NO_ERROR == ASSERT_TRUE(database->createDatabase(1, "testDatabase", vocbase).ok());
database->createDatabase(1, "testDatabase", vocbase))); ASSERT_NE(nullptr, vocbase);
ASSERT_TRUE((nullptr != vocbase));
// simulate heartbeat thread // simulate heartbeat thread
ASSERT_TRUE(arangodb::AgencyComm().setValue("Current/Databases/testDatabase", arangodb::velocypack::Slice::emptyObjectSlice(), 0.0).successful()); ASSERT_TRUE(arangodb::AgencyComm().setValue("Current/Databases/testDatabase", arangodb::velocypack::Slice::emptyObjectSlice(), 0.0).successful());

View File

@ -985,8 +985,7 @@ class IResearchAnalyzerFeatureGetTest : public IResearchAnalyzerFeatureTest {
ASSERT_NE(_sysVocbase, nullptr); ASSERT_NE(_sysVocbase, nullptr);
_vocbase = nullptr; _vocbase = nullptr;
auto res = _dbFeature->createDatabase(1, dbName, _vocbase); ASSERT_TRUE(_dbFeature->createDatabase(1, dbName, _vocbase).ok());
ASSERT_EQ(res, TRI_ERROR_NO_ERROR);
ASSERT_NE(_vocbase, nullptr); ASSERT_NE(_vocbase, nullptr);
arangodb::methods::Collections::createSystem(*_vocbase, arangodb::tests::AnalyzerCollectionName); arangodb::methods::Collections::createSystem(*_vocbase, arangodb::tests::AnalyzerCollectionName);
// Prepare analyzers // Prepare analyzers
@ -1377,8 +1376,7 @@ class IResearchAnalyzerFeatureCoordinatorTest : public ::testing::Test {
} }
_vocbase = nullptr; _vocbase = nullptr;
auto res = dbFeature->createDatabase(1, _dbName, _vocbase); ASSERT_TRUE(dbFeature->createDatabase(1, _dbName, _vocbase).ok());
ASSERT_EQ(res, TRI_ERROR_NO_ERROR);
ASSERT_NE(_vocbase, nullptr); ASSERT_NE(_vocbase, nullptr);
// Prepare analyzers // Prepare analyzers
@ -2471,8 +2469,7 @@ TEST_F(IResearchAnalyzerFeatureTest, test_remove) {
{ {
arangodb::iresearch::IResearchAnalyzerFeature feature(server); arangodb::iresearch::IResearchAnalyzerFeature feature(server);
TRI_vocbase_t* vocbase; TRI_vocbase_t* vocbase;
ASSERT_TRUE((TRI_ERROR_NO_ERROR == ASSERT_TRUE(dbFeature->createDatabase(1, "testVocbase", vocbase).ok());
dbFeature->createDatabase(1, "testVocbase", vocbase)));
ASSERT_TRUE((nullptr != dbFeature->lookupDatabase("testVocbase"))); ASSERT_TRUE((nullptr != dbFeature->lookupDatabase("testVocbase")));
EXPECT_TRUE((true == !feature.get("testVocbase::test_analyzer"))); EXPECT_TRUE((true == !feature.get("testVocbase::test_analyzer")));
@ -2972,8 +2969,7 @@ TEST_F(IResearchAnalyzerFeatureTest, test_upgrade_static_legacy) {
StorageEngineMock::versionFilenameResult, versionJson->slice(), false))); StorageEngineMock::versionFilenameResult, versionJson->slice(), false)));
TRI_vocbase_t* vocbase; TRI_vocbase_t* vocbase;
EXPECT_TRUE((TRI_ERROR_NO_ERROR == EXPECT_TRUE(dbFeature->createDatabase(1, "testVocbase", vocbase).ok());
dbFeature->createDatabase(1, "testVocbase", vocbase)));
sysDatabase->unprepare(); // unset system vocbase sysDatabase->unprepare(); // unset system vocbase
EXPECT_TRUE((arangodb::methods::Upgrade::startup(*vocbase, true, false).ok())); // run upgrade EXPECT_TRUE((arangodb::methods::Upgrade::startup(*vocbase, true, false).ok())); // run upgrade
EXPECT_TRUE((false == !vocbase->lookupCollection(arangodb::tests::AnalyzerCollectionName))); EXPECT_TRUE((false == !vocbase->lookupCollection(arangodb::tests::AnalyzerCollectionName)));
@ -3030,8 +3026,7 @@ TEST_F(IResearchAnalyzerFeatureTest, test_upgrade_static_legacy) {
std::unordered_set<std::string> expected{"abc"}; std::unordered_set<std::string> expected{"abc"};
TRI_vocbase_t* vocbase; TRI_vocbase_t* vocbase;
EXPECT_TRUE((TRI_ERROR_NO_ERROR == EXPECT_TRUE(dbFeature->createDatabase(1, "testVocbase", vocbase).ok());
dbFeature->createDatabase(1, "testVocbase", vocbase)));
EXPECT_TRUE((false == !vocbase->createCollection(createCollectionJson->slice()))); EXPECT_TRUE((false == !vocbase->createCollection(createCollectionJson->slice())));
// add document to collection // add document to collection
@ -3117,8 +3112,7 @@ TEST_F(IResearchAnalyzerFeatureTest, test_upgrade_static_legacy) {
StorageEngineMock::versionFilenameResult, versionJson->slice(), false))); StorageEngineMock::versionFilenameResult, versionJson->slice(), false)));
TRI_vocbase_t* vocbase; TRI_vocbase_t* vocbase;
EXPECT_TRUE((TRI_ERROR_NO_ERROR == EXPECT_TRUE(dbFeature->createDatabase(1, "testVocbase", vocbase).ok());
dbFeature->createDatabase(1, "testVocbase", vocbase)));
EXPECT_TRUE((arangodb::methods::Upgrade::startup(*vocbase, true, false).ok())); // run upgrade EXPECT_TRUE((arangodb::methods::Upgrade::startup(*vocbase, true, false).ok())); // run upgrade
EXPECT_TRUE((false == !vocbase->lookupCollection(arangodb::tests::AnalyzerCollectionName))); EXPECT_TRUE((false == !vocbase->lookupCollection(arangodb::tests::AnalyzerCollectionName)));
auto result = arangodb::tests::executeQuery(*vocbase, ANALYZER_COLLECTION_QUERY); auto result = arangodb::tests::executeQuery(*vocbase, ANALYZER_COLLECTION_QUERY);
@ -3180,8 +3174,7 @@ TEST_F(IResearchAnalyzerFeatureTest, test_upgrade_static_legacy) {
std::unordered_set<std::string> expected{"abc"}; std::unordered_set<std::string> expected{"abc"};
TRI_vocbase_t* vocbase; TRI_vocbase_t* vocbase;
EXPECT_TRUE((TRI_ERROR_NO_ERROR == EXPECT_TRUE(dbFeature->createDatabase(1, "testVocbase", vocbase).ok());
dbFeature->createDatabase(1, "testVocbase", vocbase)));
EXPECT_TRUE((false == !vocbase->createCollection(createCollectionJson->slice()))); EXPECT_TRUE((false == !vocbase->createCollection(createCollectionJson->slice())));
// add document to collection // add document to collection
@ -3281,8 +3274,7 @@ TEST_F(IResearchAnalyzerFeatureTest, test_upgrade_static_legacy) {
StorageEngineMock::versionFilenameResult, versionJson->slice(), false))); StorageEngineMock::versionFilenameResult, versionJson->slice(), false)));
TRI_vocbase_t* vocbase; TRI_vocbase_t* vocbase;
EXPECT_TRUE((TRI_ERROR_NO_ERROR == EXPECT_TRUE(dbFeature->createDatabase(1, "testVocbase", vocbase).ok());
dbFeature->createDatabase(1, "testVocbase", vocbase)));
EXPECT_TRUE((arangodb::methods::Upgrade::startup(*vocbase, true, false).ok())); // run upgrade EXPECT_TRUE((arangodb::methods::Upgrade::startup(*vocbase, true, false).ok())); // run upgrade
EXPECT_TRUE((false == !vocbase->lookupCollection(arangodb::tests::AnalyzerCollectionName))); EXPECT_TRUE((false == !vocbase->lookupCollection(arangodb::tests::AnalyzerCollectionName)));
auto result = arangodb::tests::executeQuery(*vocbase, ANALYZER_COLLECTION_QUERY); auto result = arangodb::tests::executeQuery(*vocbase, ANALYZER_COLLECTION_QUERY);
@ -3344,8 +3336,7 @@ TEST_F(IResearchAnalyzerFeatureTest, test_upgrade_static_legacy) {
std::set<std::string> expected{"abc"}; std::set<std::string> expected{"abc"};
TRI_vocbase_t* vocbase; TRI_vocbase_t* vocbase;
EXPECT_TRUE((TRI_ERROR_NO_ERROR == EXPECT_TRUE(dbFeature->createDatabase(1, "testVocbase", vocbase).ok());
dbFeature->createDatabase(1, "testVocbase", vocbase)));
EXPECT_TRUE((false == !vocbase->createCollection(createCollectionJson->slice()))); EXPECT_TRUE((false == !vocbase->createCollection(createCollectionJson->slice())));
// add document to collection // add document to collection
@ -3567,9 +3558,9 @@ TEST_F(IResearchAnalyzerFeatureTest, test_visit) {
TRI_vocbase_t* vocbase0; TRI_vocbase_t* vocbase0;
TRI_vocbase_t* vocbase1; TRI_vocbase_t* vocbase1;
TRI_vocbase_t* vocbase2; TRI_vocbase_t* vocbase2;
EXPECT_TRUE((TRI_ERROR_NO_ERROR == dbFeature->createDatabase(1, "vocbase0", vocbase0))); EXPECT_TRUE(dbFeature->createDatabase(1, "vocbase0", vocbase0).ok());
EXPECT_TRUE((TRI_ERROR_NO_ERROR == dbFeature->createDatabase(1, "vocbase1", vocbase1))); EXPECT_TRUE(dbFeature->createDatabase(1, "vocbase1", vocbase1).ok());
EXPECT_TRUE((TRI_ERROR_NO_ERROR == dbFeature->createDatabase(1, "vocbase2", vocbase2))); EXPECT_TRUE(dbFeature->createDatabase(1, "vocbase2", vocbase2).ok());
arangodb::methods::Collections::createSystem(*vocbase0, arangodb::tests::AnalyzerCollectionName); arangodb::methods::Collections::createSystem(*vocbase0, arangodb::tests::AnalyzerCollectionName);
arangodb::methods::Collections::createSystem(*vocbase1, arangodb::tests::AnalyzerCollectionName); arangodb::methods::Collections::createSystem(*vocbase1, arangodb::tests::AnalyzerCollectionName);
arangodb::methods::Collections::createSystem(*vocbase2, arangodb::tests::AnalyzerCollectionName); arangodb::methods::Collections::createSystem(*vocbase2, arangodb::tests::AnalyzerCollectionName);

View File

@ -457,7 +457,7 @@ TEST_F(IResearchFeatureTest, test_upgrade0_1) {
ASSERT_TRUE((nullptr != ci)); ASSERT_TRUE((nullptr != ci));
TRI_vocbase_t* vocbase; // will be owned by DatabaseFeature TRI_vocbase_t* vocbase; // will be owned by DatabaseFeature
ASSERT_TRUE((TRI_ERROR_NO_ERROR == database->createDatabase(1, "testDatabase", vocbase))); ASSERT_TRUE(database->createDatabase(1, "testDatabase", vocbase).ok());
ASSERT_TRUE(arangodb::AgencyComm().setValue(std::string("Current/Databases/") + vocbase->name(), arangodb::velocypack::Slice::emptyObjectSlice(), 0.0).successful()); ASSERT_TRUE(arangodb::AgencyComm().setValue(std::string("Current/Databases/") + vocbase->name(), arangodb::velocypack::Slice::emptyObjectSlice(), 0.0).successful());
ASSERT_TRUE((ci->createDatabaseCoordinator(vocbase->name(), arangodb::velocypack::Slice::emptyObjectSlice(), 0.0).ok())); ASSERT_TRUE((ci->createDatabaseCoordinator(vocbase->name(), arangodb::velocypack::Slice::emptyObjectSlice(), 0.0).ok()));
ASSERT_TRUE((ci->createCollectionCoordinator(vocbase->name(), collectionId, 0, 1, 1, false, collectionJson->slice(), 0.0).ok())); ASSERT_TRUE((ci->createCollectionCoordinator(vocbase->name(), collectionId, 0, 1, 1, false, collectionJson->slice(), 0.0).ok()));

View File

@ -273,9 +273,9 @@ TEST_F(IResearchLinkCoordinatorTest, test_create_drop) {
// create database // create database
{ {
// simulate heartbeat thread // simulate heartbeat thread
ASSERT_TRUE(TRI_ERROR_NO_ERROR == database->createDatabase(1, "testDatabase", vocbase)); ASSERT_TRUE(database->createDatabase(1, "testDatabase", vocbase).ok());
ASSERT_TRUE(nullptr != vocbase); ASSERT_NE(nullptr, vocbase);
EXPECT_TRUE("testDatabase" == vocbase->name()); EXPECT_TRUE("testDatabase" == vocbase->name());
EXPECT_TRUE(TRI_vocbase_type_e::TRI_VOCBASE_TYPE_COORDINATOR == vocbase->type()); EXPECT_TRUE(TRI_vocbase_type_e::TRI_VOCBASE_TYPE_COORDINATOR == vocbase->type());
EXPECT_TRUE(1 == vocbase->id()); EXPECT_TRUE(1 == vocbase->id());

View File

@ -533,8 +533,8 @@ TEST_F(IResearchLinkHelperTest, test_updateLinks) {
"Database"); "Database");
TRI_vocbase_t* vocbase; TRI_vocbase_t* vocbase;
ASSERT_TRUE( ASSERT_TRUE(
(TRI_ERROR_NO_ERROR == dbFeature->createDatabase(1, "testVocbase", vocbase))); // required for IResearchAnalyzerFeature::emplace(...) dbFeature->createDatabase(1, "testVocbase", vocbase).ok()); // required for IResearchAnalyzerFeature::emplace(...)
ASSERT_TRUE((nullptr != vocbase)); ASSERT_NE(nullptr, vocbase);
arangodb::methods::Collections::createSystem( arangodb::methods::Collections::createSystem(
*vocbase, *vocbase,
arangodb::tests::AnalyzerCollectionName); arangodb::tests::AnalyzerCollectionName);

View File

@ -1081,8 +1081,8 @@ TEST_F(IResearchViewTest, test_drop_database) {
StorageEngineMock::before = [&beforeCount]()->void { ++beforeCount; }; StorageEngineMock::before = [&beforeCount]()->void { ++beforeCount; };
TRI_vocbase_t* vocbase; // will be owned by DatabaseFeature TRI_vocbase_t* vocbase; // will be owned by DatabaseFeature
ASSERT_TRUE((TRI_ERROR_NO_ERROR == databaseFeature->createDatabase(0, "testDatabase" TOSTRING(__LINE__), vocbase))); ASSERT_TRUE(databaseFeature->createDatabase(0, "testDatabase" TOSTRING(__LINE__), vocbase).ok());
ASSERT_TRUE((nullptr != vocbase)); ASSERT_NE(nullptr, vocbase);
beforeCount = 0; // reset before call to StorageEngine::createView(...) beforeCount = 0; // reset before call to StorageEngine::createView(...)
auto logicalView = vocbase->createView(viewCreateJson->slice()); auto logicalView = vocbase->createView(viewCreateJson->slice());

View File

@ -314,8 +314,8 @@ TEST_F(IResearchViewCoordinatorTest, visit_collections) {
{ {
auto* database = arangodb::DatabaseFeature::DATABASE; auto* database = arangodb::DatabaseFeature::DATABASE;
ASSERT_TRUE((nullptr != database)); ASSERT_TRUE((nullptr != database));
ASSERT_TRUE((TRI_ERROR_NO_ERROR == database->createDatabase(1, "testVocbase", vocbase))); ASSERT_TRUE(database->createDatabase(1, "testVocbase", vocbase).ok());
ASSERT_TRUE((nullptr != vocbase)); ASSERT_NE(nullptr, vocbase);
ASSERT_TRUE(arangodb::AgencyComm().setValue(std::string("Current/Databases/") + vocbase->name(), arangodb::velocypack::Slice::emptyObjectSlice(), 0.0).successful()); ASSERT_TRUE(arangodb::AgencyComm().setValue(std::string("Current/Databases/") + vocbase->name(), arangodb::velocypack::Slice::emptyObjectSlice(), 0.0).successful());
ASSERT_TRUE((ci->createDatabaseCoordinator(vocbase->name(), ASSERT_TRUE((ci->createDatabaseCoordinator(vocbase->name(),
arangodb::velocypack::Slice::emptyObjectSlice(), 0.0) arangodb::velocypack::Slice::emptyObjectSlice(), 0.0)
@ -393,10 +393,9 @@ TEST_F(IResearchViewCoordinatorTest, test_defaults) {
// create database // create database
{ {
// simulate heartbeat thread // simulate heartbeat thread
ASSERT_TRUE((TRI_ERROR_NO_ERROR == ASSERT_TRUE(database->createDatabase(1, "testDatabase", vocbase).ok());
database->createDatabase(1, "testDatabase", vocbase)));
ASSERT_TRUE((nullptr != vocbase)); ASSERT_NE(nullptr, vocbase);
EXPECT_TRUE(("testDatabase" == vocbase->name())); EXPECT_TRUE(("testDatabase" == vocbase->name()));
EXPECT_TRUE((TRI_vocbase_type_e::TRI_VOCBASE_TYPE_COORDINATOR == vocbase->type())); EXPECT_TRUE((TRI_vocbase_type_e::TRI_VOCBASE_TYPE_COORDINATOR == vocbase->type()));
EXPECT_TRUE((1 == vocbase->id())); EXPECT_TRUE((1 == vocbase->id()));
@ -688,9 +687,9 @@ TEST_F(IResearchViewCoordinatorTest, test_create_drop_view) {
// create database // create database
{ {
// simulate heartbeat thread // simulate heartbeat thread
ASSERT_TRUE(TRI_ERROR_NO_ERROR == database->createDatabase(1, "testDatabase", vocbase)); ASSERT_TRUE(database->createDatabase(1, "testDatabase", vocbase).ok());
ASSERT_TRUE(nullptr != vocbase); ASSERT_NE(nullptr, vocbase);
EXPECT_TRUE("testDatabase" == vocbase->name()); EXPECT_TRUE("testDatabase" == vocbase->name());
EXPECT_TRUE(TRI_vocbase_type_e::TRI_VOCBASE_TYPE_COORDINATOR == vocbase->type()); EXPECT_TRUE(TRI_vocbase_type_e::TRI_VOCBASE_TYPE_COORDINATOR == vocbase->type());
EXPECT_TRUE(1 == vocbase->id()); EXPECT_TRUE(1 == vocbase->id());
@ -836,7 +835,7 @@ TEST_F(IResearchViewCoordinatorTest, test_create_link_in_background) {
// create database // create database
{ {
// simulate heartbeat thread // simulate heartbeat thread
ASSERT_EQ(TRI_ERROR_NO_ERROR, database->createDatabase(1, "testDatabase", vocbase)); ASSERT_TRUE(database->createDatabase(1, "testDatabase", vocbase).ok());
ASSERT_NE(nullptr, vocbase); ASSERT_NE(nullptr, vocbase);
ASSERT_EQ("testDatabase", vocbase->name()); ASSERT_EQ("testDatabase", vocbase->name());
@ -953,10 +952,9 @@ TEST_F(IResearchViewCoordinatorTest, test_drop_with_link) {
// create database // create database
{ {
// simulate heartbeat thread // simulate heartbeat thread
ASSERT_TRUE((TRI_ERROR_NO_ERROR == ASSERT_TRUE(database->createDatabase(1, "testDatabase", vocbase).ok());
database->createDatabase(1, "testDatabase", vocbase)));
ASSERT_TRUE((nullptr != vocbase)); ASSERT_NE(nullptr, vocbase);
EXPECT_TRUE(("testDatabase" == vocbase->name())); EXPECT_TRUE(("testDatabase" == vocbase->name()));
EXPECT_TRUE((TRI_vocbase_type_e::TRI_VOCBASE_TYPE_COORDINATOR == vocbase->type())); EXPECT_TRUE((TRI_vocbase_type_e::TRI_VOCBASE_TYPE_COORDINATOR == vocbase->type()));
EXPECT_TRUE((1 == vocbase->id())); EXPECT_TRUE((1 == vocbase->id()));
@ -1084,9 +1082,9 @@ TEST_F(IResearchViewCoordinatorTest, test_update_properties) {
// create database // create database
{ {
// simulate heartbeat thread // simulate heartbeat thread
ASSERT_TRUE(TRI_ERROR_NO_ERROR == database->createDatabase(1, "testDatabase", vocbase)); ASSERT_TRUE(database->createDatabase(1, "testDatabase", vocbase).ok());
ASSERT_TRUE(nullptr != vocbase); ASSERT_NE(nullptr, vocbase);
EXPECT_TRUE("testDatabase" == vocbase->name()); EXPECT_TRUE("testDatabase" == vocbase->name());
EXPECT_TRUE(TRI_vocbase_type_e::TRI_VOCBASE_TYPE_COORDINATOR == vocbase->type()); EXPECT_TRUE(TRI_vocbase_type_e::TRI_VOCBASE_TYPE_COORDINATOR == vocbase->type());
EXPECT_TRUE(1 == vocbase->id()); EXPECT_TRUE(1 == vocbase->id());
@ -1255,7 +1253,7 @@ TEST_F(IResearchViewCoordinatorTest, test_overwrite_immutable_properties) {
// create database // create database
{ {
// simulate heartbeat thread // simulate heartbeat thread
ASSERT_EQ(TRI_ERROR_NO_ERROR, database->createDatabase(1, "testDatabase", vocbase)); ASSERT_TRUE(database->createDatabase(1, "testDatabase", vocbase).ok());
ASSERT_NE(nullptr, vocbase); ASSERT_NE(nullptr, vocbase);
EXPECT_EQ("testDatabase", vocbase->name()); EXPECT_EQ("testDatabase", vocbase->name());
@ -1455,9 +1453,9 @@ TEST_F(IResearchViewCoordinatorTest, test_update_links_partial_remove) {
// create database // create database
{ {
// simulate heartbeat thread // simulate heartbeat thread
ASSERT_TRUE(TRI_ERROR_NO_ERROR == database->createDatabase(1, "testDatabase", vocbase)); ASSERT_TRUE(database->createDatabase(1, "testDatabase", vocbase).ok());
ASSERT_TRUE(nullptr != vocbase); ASSERT_NE(nullptr, vocbase);
EXPECT_TRUE("testDatabase" == vocbase->name()); EXPECT_TRUE("testDatabase" == vocbase->name());
EXPECT_TRUE(TRI_vocbase_type_e::TRI_VOCBASE_TYPE_COORDINATOR == vocbase->type()); EXPECT_TRUE(TRI_vocbase_type_e::TRI_VOCBASE_TYPE_COORDINATOR == vocbase->type());
EXPECT_TRUE(1 == vocbase->id()); EXPECT_TRUE(1 == vocbase->id());
@ -2047,9 +2045,9 @@ TEST_F(IResearchViewCoordinatorTest, test_update_links_partial_add) {
// create database // create database
{ {
// simulate heartbeat thread // simulate heartbeat thread
ASSERT_TRUE(TRI_ERROR_NO_ERROR == database->createDatabase(1, "testDatabase", vocbase)); ASSERT_TRUE(database->createDatabase(1, "testDatabase", vocbase).ok());
ASSERT_TRUE(nullptr != vocbase); ASSERT_NE(nullptr, vocbase);
EXPECT_TRUE("testDatabase" == vocbase->name()); EXPECT_TRUE("testDatabase" == vocbase->name());
EXPECT_TRUE(TRI_vocbase_type_e::TRI_VOCBASE_TYPE_COORDINATOR == vocbase->type()); EXPECT_TRUE(TRI_vocbase_type_e::TRI_VOCBASE_TYPE_COORDINATOR == vocbase->type());
EXPECT_TRUE(1 == vocbase->id()); EXPECT_TRUE(1 == vocbase->id());
@ -2690,9 +2688,9 @@ TEST_F(IResearchViewCoordinatorTest, test_update_links_replace) {
// create database // create database
{ {
// simulate heartbeat thread // simulate heartbeat thread
ASSERT_TRUE(TRI_ERROR_NO_ERROR == database->createDatabase(1, "testDatabase", vocbase)); ASSERT_TRUE(database->createDatabase(1, "testDatabase", vocbase).ok());
ASSERT_TRUE(nullptr != vocbase); ASSERT_NE(nullptr, vocbase);
EXPECT_TRUE("testDatabase" == vocbase->name()); EXPECT_TRUE("testDatabase" == vocbase->name());
EXPECT_TRUE(TRI_vocbase_type_e::TRI_VOCBASE_TYPE_COORDINATOR == vocbase->type()); EXPECT_TRUE(TRI_vocbase_type_e::TRI_VOCBASE_TYPE_COORDINATOR == vocbase->type());
EXPECT_TRUE(1 == vocbase->id()); EXPECT_TRUE(1 == vocbase->id());
@ -3291,9 +3289,9 @@ TEST_F(IResearchViewCoordinatorTest, test_update_links_clear) {
// create database // create database
{ {
// simulate heartbeat thread // simulate heartbeat thread
ASSERT_TRUE(TRI_ERROR_NO_ERROR == database->createDatabase(1, "testDatabase", vocbase)); ASSERT_TRUE(database->createDatabase(1, "testDatabase", vocbase).ok());
ASSERT_TRUE(nullptr != vocbase); ASSERT_NE(nullptr, vocbase);
EXPECT_TRUE("testDatabase" == vocbase->name()); EXPECT_TRUE("testDatabase" == vocbase->name());
EXPECT_TRUE(TRI_vocbase_type_e::TRI_VOCBASE_TYPE_COORDINATOR == vocbase->type()); EXPECT_TRUE(TRI_vocbase_type_e::TRI_VOCBASE_TYPE_COORDINATOR == vocbase->type());
EXPECT_TRUE(1 == vocbase->id()); EXPECT_TRUE(1 == vocbase->id());
@ -3756,9 +3754,9 @@ TEST_F(IResearchViewCoordinatorTest, test_drop_link) {
// create database // create database
{ {
// simulate heartbeat thread // simulate heartbeat thread
ASSERT_TRUE(TRI_ERROR_NO_ERROR == database->createDatabase(1, "testDatabase", vocbase)); ASSERT_TRUE(database->createDatabase(1, "testDatabase", vocbase).ok());
ASSERT_TRUE(nullptr != vocbase); ASSERT_NE(nullptr, vocbase);
EXPECT_TRUE("testDatabase" == vocbase->name()); EXPECT_TRUE("testDatabase" == vocbase->name());
EXPECT_TRUE(TRI_vocbase_type_e::TRI_VOCBASE_TYPE_COORDINATOR == vocbase->type()); EXPECT_TRUE(TRI_vocbase_type_e::TRI_VOCBASE_TYPE_COORDINATOR == vocbase->type());
EXPECT_TRUE(1 == vocbase->id()); EXPECT_TRUE(1 == vocbase->id());
@ -4064,10 +4062,9 @@ TEST_F(IResearchViewCoordinatorTest, test_update_overwrite) {
// create database // create database
{ {
// simulate heartbeat thread // simulate heartbeat thread
ASSERT_TRUE((TRI_ERROR_NO_ERROR == ASSERT_TRUE(database->createDatabase(1, "testDatabase", vocbase).ok());
database->createDatabase(1, "testDatabase", vocbase)));
ASSERT_TRUE((nullptr != vocbase)); ASSERT_NE(nullptr, vocbase);
EXPECT_TRUE(("testDatabase" == vocbase->name())); EXPECT_TRUE(("testDatabase" == vocbase->name()));
EXPECT_TRUE((TRI_vocbase_type_e::TRI_VOCBASE_TYPE_COORDINATOR == vocbase->type())); EXPECT_TRUE((TRI_vocbase_type_e::TRI_VOCBASE_TYPE_COORDINATOR == vocbase->type()));
EXPECT_TRUE((1 == vocbase->id())); EXPECT_TRUE((1 == vocbase->id()));
@ -4829,10 +4826,9 @@ TEST_F(IResearchViewCoordinatorTest, test_update_partial) {
// create database // create database
{ {
// simulate heartbeat thread // simulate heartbeat thread
ASSERT_TRUE((TRI_ERROR_NO_ERROR == ASSERT_TRUE(database->createDatabase(1, "testDatabase", vocbase).ok());
database->createDatabase(1, "testDatabase", vocbase)));
ASSERT_TRUE((nullptr != vocbase)); ASSERT_NE(nullptr, vocbase);
EXPECT_TRUE(("testDatabase" == vocbase->name())); EXPECT_TRUE(("testDatabase" == vocbase->name()));
EXPECT_TRUE((TRI_vocbase_type_e::TRI_VOCBASE_TYPE_COORDINATOR == vocbase->type())); EXPECT_TRUE((TRI_vocbase_type_e::TRI_VOCBASE_TYPE_COORDINATOR == vocbase->type()));
EXPECT_TRUE((1 == vocbase->id())); EXPECT_TRUE((1 == vocbase->id()));
@ -5601,9 +5597,9 @@ TEST_F(IResearchViewCoordinatorTest, IResearchViewNode_createBlock) {
// create database // create database
{ {
// simulate heartbeat thread // simulate heartbeat thread
ASSERT_TRUE(TRI_ERROR_NO_ERROR == database->createDatabase(1, "testDatabase", vocbase)); ASSERT_TRUE(database->createDatabase(1, "testDatabase", vocbase).ok());
ASSERT_TRUE(nullptr != vocbase); ASSERT_NE(nullptr, vocbase);
EXPECT_TRUE("testDatabase" == vocbase->name()); EXPECT_TRUE("testDatabase" == vocbase->name());
EXPECT_TRUE(TRI_vocbase_type_e::TRI_VOCBASE_TYPE_COORDINATOR == vocbase->type()); EXPECT_TRUE(TRI_vocbase_type_e::TRI_VOCBASE_TYPE_COORDINATOR == vocbase->type());
EXPECT_TRUE(1 == vocbase->id()); EXPECT_TRUE(1 == vocbase->id());

View File

@ -237,9 +237,9 @@ TEST_F(IResearchViewDBServerTest, test_drop) {
// create database // create database
{ {
// simulate heartbeat thread // simulate heartbeat thread
ASSERT_TRUE(TRI_ERROR_NO_ERROR == database->createDatabase(1, "testDatabase", vocbase)); ASSERT_TRUE(database->createDatabase(1, "testDatabase", vocbase).ok());
ASSERT_TRUE(nullptr != vocbase); ASSERT_NE(nullptr, vocbase);
EXPECT_TRUE("testDatabase" == vocbase->name()); EXPECT_TRUE("testDatabase" == vocbase->name());
EXPECT_TRUE(TRI_vocbase_type_e::TRI_VOCBASE_TYPE_NORMAL == vocbase->type()); EXPECT_TRUE(TRI_vocbase_type_e::TRI_VOCBASE_TYPE_NORMAL == vocbase->type());
EXPECT_TRUE(1 == vocbase->id()); EXPECT_TRUE(1 == vocbase->id());
@ -354,9 +354,9 @@ TEST_F(IResearchViewDBServerTest, test_drop_cid) {
// create database // create database
{ {
// simulate heartbeat thread // simulate heartbeat thread
ASSERT_TRUE(TRI_ERROR_NO_ERROR == database->createDatabase(1, "testDatabase", vocbase)); ASSERT_TRUE(database->createDatabase(1, "testDatabase", vocbase).ok());
ASSERT_TRUE(nullptr != vocbase); ASSERT_NE(nullptr, vocbase);
EXPECT_TRUE("testDatabase" == vocbase->name()); EXPECT_TRUE("testDatabase" == vocbase->name());
EXPECT_TRUE(TRI_vocbase_type_e::TRI_VOCBASE_TYPE_NORMAL == vocbase->type()); EXPECT_TRUE(TRI_vocbase_type_e::TRI_VOCBASE_TYPE_NORMAL == vocbase->type());
EXPECT_TRUE(1 == vocbase->id()); EXPECT_TRUE(1 == vocbase->id());
@ -422,9 +422,8 @@ TEST_F(IResearchViewDBServerTest, test_drop_database) {
PhysicalCollectionMock::before = [&beforeCount]() -> void { ++beforeCount; }; PhysicalCollectionMock::before = [&beforeCount]() -> void { ++beforeCount; };
TRI_vocbase_t* vocbase; // will be owned by DatabaseFeature TRI_vocbase_t* vocbase; // will be owned by DatabaseFeature
ASSERT_TRUE((TRI_ERROR_NO_ERROR == ASSERT_TRUE(databaseFeature->createDatabase(0, "testDatabase" TOSTRING(__LINE__), vocbase).ok());
databaseFeature->createDatabase(0, "testDatabase" TOSTRING(__LINE__), vocbase))); ASSERT_NE(nullptr, vocbase);
ASSERT_TRUE((nullptr != vocbase));
ASSERT_TRUE(arangodb::AgencyComm().setValue(std::string("Current/Databases/") + vocbase->name(), arangodb::velocypack::Slice::emptyObjectSlice(), 0.0).successful()); ASSERT_TRUE(arangodb::AgencyComm().setValue(std::string("Current/Databases/") + vocbase->name(), arangodb::velocypack::Slice::emptyObjectSlice(), 0.0).successful());
ASSERT_TRUE((ci->createDatabaseCoordinator(vocbase->name(), ASSERT_TRUE((ci->createDatabaseCoordinator(vocbase->name(),
arangodb::velocypack::Slice::emptyObjectSlice(), 0.) arangodb::velocypack::Slice::emptyObjectSlice(), 0.)
@ -458,9 +457,9 @@ TEST_F(IResearchViewDBServerTest, test_ensure) {
// create database // create database
{ {
// simulate heartbeat thread // simulate heartbeat thread
ASSERT_TRUE(TRI_ERROR_NO_ERROR == database->createDatabase(1, "testDatabase", vocbase)); ASSERT_TRUE(database->createDatabase(1, "testDatabase", vocbase).ok());
ASSERT_TRUE(nullptr != vocbase); ASSERT_NE(nullptr, vocbase);
EXPECT_TRUE("testDatabase" == vocbase->name()); EXPECT_TRUE("testDatabase" == vocbase->name());
EXPECT_TRUE(TRI_vocbase_type_e::TRI_VOCBASE_TYPE_NORMAL == vocbase->type()); EXPECT_TRUE(TRI_vocbase_type_e::TRI_VOCBASE_TYPE_NORMAL == vocbase->type());
EXPECT_TRUE(1 == vocbase->id()); EXPECT_TRUE(1 == vocbase->id());
@ -620,8 +619,7 @@ TEST_F(IResearchViewDBServerTest, test_query) {
"{ \"view\": \"testView\", \"type\": \"arangosearch\", " "{ \"view\": \"testView\", \"type\": \"arangosearch\", "
"\"includeAllFields\": true }"); "\"includeAllFields\": true }");
TRI_vocbase_t* vocbase; // will be owned by DatabaseFeature TRI_vocbase_t* vocbase; // will be owned by DatabaseFeature
ASSERT_TRUE((TRI_ERROR_NO_ERROR == ASSERT_TRUE(database->createDatabase(1, "testDatabase0", vocbase).ok());
database->createDatabase(1, "testDatabase0", vocbase)));
EXPECT_TRUE(arangodb::AgencyComm().setValue(std::string("Current/Databases/") + vocbase->name(), arangodb::velocypack::Slice::emptyObjectSlice(), 0.0).successful()); EXPECT_TRUE(arangodb::AgencyComm().setValue(std::string("Current/Databases/") + vocbase->name(), arangodb::velocypack::Slice::emptyObjectSlice(), 0.0).successful());
EXPECT_TRUE((ci->createDatabaseCoordinator(vocbase->name(), VPackSlice::emptyObjectSlice(), 0.0) EXPECT_TRUE((ci->createDatabaseCoordinator(vocbase->name(), VPackSlice::emptyObjectSlice(), 0.0)
.ok())); .ok()));
@ -664,8 +662,7 @@ TEST_F(IResearchViewDBServerTest, test_query) {
"{ \"view\": \"testView\", \"type\": \"arangosearch\", " "{ \"view\": \"testView\", \"type\": \"arangosearch\", "
"\"includeAllFields\": true }"); "\"includeAllFields\": true }");
TRI_vocbase_t* vocbase; // will be owned by DatabaseFeature TRI_vocbase_t* vocbase; // will be owned by DatabaseFeature
ASSERT_TRUE((TRI_ERROR_NO_ERROR == ASSERT_TRUE(database->createDatabase(1, "testDatabase1", vocbase).ok());
database->createDatabase(1, "testDatabase1", vocbase)));
EXPECT_TRUE(arangodb::AgencyComm().setValue(std::string("Current/Databases/") + vocbase->name(), arangodb::velocypack::Slice::emptyObjectSlice(), 0.0).successful()); EXPECT_TRUE(arangodb::AgencyComm().setValue(std::string("Current/Databases/") + vocbase->name(), arangodb::velocypack::Slice::emptyObjectSlice(), 0.0).successful());
EXPECT_TRUE((ci->createDatabaseCoordinator(vocbase->name(), VPackSlice::emptyObjectSlice(), 0.0) EXPECT_TRUE((ci->createDatabaseCoordinator(vocbase->name(), VPackSlice::emptyObjectSlice(), 0.0)
.ok())); .ok()));
@ -731,9 +728,8 @@ TEST_F(IResearchViewDBServerTest, test_query) {
"{ \"name\": \"testCollection\", \"id\":442 }"); "{ \"name\": \"testCollection\", \"id\":442 }");
TRI_vocbase_t* vocbase; // will be owned by DatabaseFeature TRI_vocbase_t* vocbase; // will be owned by DatabaseFeature
ASSERT_TRUE((TRI_ERROR_NO_ERROR == ASSERT_TRUE(databaseFeature->createDatabase(0, "testDatabase" TOSTRING(__LINE__), vocbase).ok());
databaseFeature->createDatabase(0, "testDatabase" TOSTRING(__LINE__), vocbase))); ASSERT_NE(nullptr, vocbase);
ASSERT_TRUE((nullptr != vocbase));
ASSERT_TRUE(arangodb::AgencyComm().setValue(std::string("Current/Databases/") + vocbase->name(), arangodb::velocypack::Slice::emptyObjectSlice(), 0.0).successful()); ASSERT_TRUE(arangodb::AgencyComm().setValue(std::string("Current/Databases/") + vocbase->name(), arangodb::velocypack::Slice::emptyObjectSlice(), 0.0).successful());
ASSERT_TRUE((ci->createDatabaseCoordinator(vocbase->name(), ASSERT_TRUE((ci->createDatabaseCoordinator(vocbase->name(),
arangodb::velocypack::Slice::emptyObjectSlice(), 0.) arangodb::velocypack::Slice::emptyObjectSlice(), 0.)
@ -832,9 +828,8 @@ TEST_F(IResearchViewDBServerTest, test_query) {
"Flush"); "Flush");
ASSERT_TRUE(feature); ASSERT_TRUE(feature);
TRI_vocbase_t* vocbase; // will be owned by DatabaseFeature TRI_vocbase_t* vocbase; // will be owned by DatabaseFeature
ASSERT_TRUE((TRI_ERROR_NO_ERROR == ASSERT_TRUE(databaseFeature->createDatabase(0, "testDatabase" TOSTRING(__LINE__), vocbase).ok());
databaseFeature->createDatabase(0, "testDatabase" TOSTRING(__LINE__), vocbase))); ASSERT_NE(nullptr, vocbase);
ASSERT_TRUE((nullptr != vocbase));
ASSERT_TRUE(arangodb::AgencyComm().setValue(std::string("Current/Databases/") + vocbase->name(), arangodb::velocypack::Slice::emptyObjectSlice(), 0.0).successful()); ASSERT_TRUE(arangodb::AgencyComm().setValue(std::string("Current/Databases/") + vocbase->name(), arangodb::velocypack::Slice::emptyObjectSlice(), 0.0).successful());
EXPECT_TRUE((ci->createDatabaseCoordinator( EXPECT_TRUE((ci->createDatabaseCoordinator(
vocbase->name(), vocbase->name(),
@ -1121,9 +1116,9 @@ TEST_F(IResearchViewDBServerTest, test_transaction_snapshot) {
// create database // create database
{ {
// simulate heartbeat thread // simulate heartbeat thread
ASSERT_TRUE(TRI_ERROR_NO_ERROR == database->createDatabase(1, "testDatabase", vocbase)); ASSERT_TRUE(database->createDatabase(1, "testDatabase", vocbase).ok());
ASSERT_TRUE(nullptr != vocbase); ASSERT_NE(nullptr, vocbase);
EXPECT_TRUE("testDatabase" == vocbase->name()); EXPECT_TRUE("testDatabase" == vocbase->name());
EXPECT_TRUE(TRI_vocbase_type_e::TRI_VOCBASE_TYPE_NORMAL == vocbase->type()); EXPECT_TRUE(TRI_vocbase_type_e::TRI_VOCBASE_TYPE_NORMAL == vocbase->type());
EXPECT_TRUE(1 == vocbase->id()); EXPECT_TRUE(1 == vocbase->id());
@ -1267,9 +1262,8 @@ TEST_F(IResearchViewDBServerTest, test_updateProperties) {
"\"collections\": [ 3, 4, 5 ], \"cleanupIntervalStep\": 24, " "\"collections\": [ 3, 4, 5 ], \"cleanupIntervalStep\": 24, "
"\"consolidationIntervalMsec\": 42 }"); "\"consolidationIntervalMsec\": 42 }");
TRI_vocbase_t* vocbase; // will be owned by DatabaseFeature TRI_vocbase_t* vocbase; // will be owned by DatabaseFeature
ASSERT_TRUE((TRI_ERROR_NO_ERROR == ASSERT_TRUE(databaseFeature->createDatabase(0, "testDatabase" TOSTRING(__LINE__), vocbase).ok());
databaseFeature->createDatabase(0, "testDatabase" TOSTRING(__LINE__), vocbase))); ASSERT_NE(nullptr, vocbase);
ASSERT_TRUE((nullptr != vocbase));
ASSERT_TRUE(arangodb::AgencyComm().setValue(std::string("Current/Databases/") + vocbase->name(), arangodb::velocypack::Slice::emptyObjectSlice(), 0.0).successful()); ASSERT_TRUE(arangodb::AgencyComm().setValue(std::string("Current/Databases/") + vocbase->name(), arangodb::velocypack::Slice::emptyObjectSlice(), 0.0).successful());
ASSERT_TRUE((ci->createDatabaseCoordinator(vocbase->name(), ASSERT_TRUE((ci->createDatabaseCoordinator(vocbase->name(),
arangodb::velocypack::Slice::emptyObjectSlice(), 0.) arangodb::velocypack::Slice::emptyObjectSlice(), 0.)
@ -1393,9 +1387,8 @@ TEST_F(IResearchViewDBServerTest, test_updateProperties) {
"\"collections\": [ 3, 4, 5 ], \"cleanupIntervalStep\": 24, " "\"collections\": [ 3, 4, 5 ], \"cleanupIntervalStep\": 24, "
"\"consolidationIntervalMsec\": 42 }"); "\"consolidationIntervalMsec\": 42 }");
TRI_vocbase_t* vocbase; // will be owned by DatabaseFeature TRI_vocbase_t* vocbase; // will be owned by DatabaseFeature
ASSERT_TRUE((TRI_ERROR_NO_ERROR == ASSERT_TRUE(databaseFeature->createDatabase(0, "testDatabase" TOSTRING(__LINE__), vocbase).ok());
databaseFeature->createDatabase(0, "testDatabase" TOSTRING(__LINE__), vocbase))); ASSERT_NE(nullptr, vocbase);
ASSERT_TRUE((nullptr != vocbase));
ASSERT_TRUE(arangodb::AgencyComm().setValue(std::string("Current/Databases/") + vocbase->name(), arangodb::velocypack::Slice::emptyObjectSlice(), 0.0).successful()); ASSERT_TRUE(arangodb::AgencyComm().setValue(std::string("Current/Databases/") + vocbase->name(), arangodb::velocypack::Slice::emptyObjectSlice(), 0.0).successful());
ASSERT_TRUE((ci->createDatabaseCoordinator(vocbase->name(), ASSERT_TRUE((ci->createDatabaseCoordinator(vocbase->name(),
arangodb::velocypack::Slice::emptyObjectSlice(), 0.) arangodb::velocypack::Slice::emptyObjectSlice(), 0.)
@ -1522,9 +1515,8 @@ TEST_F(IResearchViewDBServerTest, test_updateProperties) {
"\"collections\": [ 3, 4, 5 ], \"cleanupIntervalStep\": 24, " "\"collections\": [ 3, 4, 5 ], \"cleanupIntervalStep\": 24, "
"\"consolidationIntervalMsec\": 42 }"); "\"consolidationIntervalMsec\": 42 }");
TRI_vocbase_t* vocbase; // will be owned by DatabaseFeature TRI_vocbase_t* vocbase; // will be owned by DatabaseFeature
ASSERT_TRUE((TRI_ERROR_NO_ERROR == ASSERT_TRUE(databaseFeature->createDatabase(0, "testDatabase" TOSTRING(__LINE__), vocbase).ok());
databaseFeature->createDatabase(0, "testDatabase" TOSTRING(__LINE__), vocbase))); ASSERT_NE(nullptr, vocbase);
ASSERT_TRUE((nullptr != vocbase));
ASSERT_TRUE(arangodb::AgencyComm().setValue(std::string("Current/Databases/") + vocbase->name(), arangodb::velocypack::Slice::emptyObjectSlice(), 0.0).successful()); ASSERT_TRUE(arangodb::AgencyComm().setValue(std::string("Current/Databases/") + vocbase->name(), arangodb::velocypack::Slice::emptyObjectSlice(), 0.0).successful());
ASSERT_TRUE((ci->createDatabaseCoordinator(vocbase->name(), ASSERT_TRUE((ci->createDatabaseCoordinator(vocbase->name(),
arangodb::velocypack::Slice::emptyObjectSlice(), 0.) arangodb::velocypack::Slice::emptyObjectSlice(), 0.)
@ -1656,9 +1648,8 @@ TEST_F(IResearchViewDBServerTest, test_updateProperties) {
"\"collections\": [ 3, 4, 5 ], \"cleanupIntervalStep\": 24, " "\"collections\": [ 3, 4, 5 ], \"cleanupIntervalStep\": 24, "
"\"consolidationIntervalMsec\": 42 }"); "\"consolidationIntervalMsec\": 42 }");
TRI_vocbase_t* vocbase; // will be owned by DatabaseFeature TRI_vocbase_t* vocbase; // will be owned by DatabaseFeature
ASSERT_TRUE((TRI_ERROR_NO_ERROR == ASSERT_TRUE(databaseFeature->createDatabase(0, "testDatabase" TOSTRING(__LINE__), vocbase).ok());
databaseFeature->createDatabase(0, "testDatabase" TOSTRING(__LINE__), vocbase))); ASSERT_NE(nullptr, vocbase);
ASSERT_TRUE((nullptr != vocbase));
ASSERT_TRUE(arangodb::AgencyComm().setValue(std::string("Current/Databases/") + vocbase->name(), arangodb::velocypack::Slice::emptyObjectSlice(), 0.0).successful()); ASSERT_TRUE(arangodb::AgencyComm().setValue(std::string("Current/Databases/") + vocbase->name(), arangodb::velocypack::Slice::emptyObjectSlice(), 0.0).successful());
ASSERT_TRUE((ci->createDatabaseCoordinator(vocbase->name(), ASSERT_TRUE((ci->createDatabaseCoordinator(vocbase->name(),
arangodb::velocypack::Slice::emptyObjectSlice(), 0.) arangodb::velocypack::Slice::emptyObjectSlice(), 0.)

View File

@ -1102,8 +1102,7 @@ TEST_F(RestAnalyzerHandlerTest, test_list) {
arangodb::StaticStrings::SystemDatabase + "\" } ]"); arangodb::StaticStrings::SystemDatabase + "\" } ]");
ASSERT_TRUE((TRI_ERROR_NO_ERROR == dbFeature->loadDatabases(databases->slice()))); ASSERT_TRUE((TRI_ERROR_NO_ERROR == dbFeature->loadDatabases(databases->slice())));
TRI_vocbase_t* vocbase; TRI_vocbase_t* vocbase;
ASSERT_TRUE((TRI_ERROR_NO_ERROR == ASSERT_TRUE(dbFeature->createDatabase(1, "testVocbase", vocbase).ok());
dbFeature->createDatabase(1, "testVocbase", vocbase)));
sysDatabase->start(); // get system database from DatabaseFeature sysDatabase->start(); // get system database from DatabaseFeature
arangodb::methods::Collections::createSystem( arangodb::methods::Collections::createSystem(
*vocbase, *vocbase,

View File

@ -196,8 +196,7 @@ TEST_F(RestUsersHandlerTest, test_collection_auth) {
arangodb::application_features::ApplicationServer::getFeature<arangodb::DatabaseFeature>( arangodb::application_features::ApplicationServer::getFeature<arangodb::DatabaseFeature>(
"Database"); "Database");
TRI_vocbase_t* vocbase; // will be owned by DatabaseFeature TRI_vocbase_t* vocbase; // will be owned by DatabaseFeature
ASSERT_TRUE((TRI_ERROR_NO_ERROR == ASSERT_TRUE(databaseFeature->createDatabase(1, "testDatabase", vocbase).ok());
databaseFeature->createDatabase(1, "testDatabase", vocbase)));
auto grantRequestPtr = std::make_unique<GeneralRequestMock>(*vocbase); auto grantRequestPtr = std::make_unique<GeneralRequestMock>(*vocbase);
auto& grantRequest = *grantRequestPtr; auto& grantRequest = *grantRequestPtr;
auto grantResponcePtr = std::make_unique<GeneralResponseMock>(); auto grantResponcePtr = std::make_unique<GeneralResponseMock>();

View File

@ -145,7 +145,7 @@ TEST_F(FlushFeatureTest, test_subscription_retention) {
"Database"); "Database");
ASSERT_TRUE((dbFeature)); ASSERT_TRUE((dbFeature));
TRI_vocbase_t* vocbase; TRI_vocbase_t* vocbase;
ASSERT_TRUE((TRI_ERROR_NO_ERROR == dbFeature->createDatabase(1, "testDatabase", vocbase))); ASSERT_TRUE(dbFeature->createDatabase(1, "testDatabase", vocbase).ok());
ASSERT_NE(nullptr, vocbase); ASSERT_NE(nullptr, vocbase);
arangodb::FlushFeature feature(server); arangodb::FlushFeature feature(server);

View File

@ -2081,8 +2081,7 @@ TEST_F(V8AnalyzersTest, test_list) {
arangodb::StaticStrings::SystemDatabase + "\" } ]"); arangodb::StaticStrings::SystemDatabase + "\" } ]");
ASSERT_TRUE((TRI_ERROR_NO_ERROR == dbFeature->loadDatabases(databases->slice()))); ASSERT_TRUE((TRI_ERROR_NO_ERROR == dbFeature->loadDatabases(databases->slice())));
TRI_vocbase_t* vocbase; TRI_vocbase_t* vocbase;
ASSERT_TRUE((TRI_ERROR_NO_ERROR == ASSERT_TRUE(dbFeature->createDatabase(1, "testVocbase", vocbase).ok());
dbFeature->createDatabase(1, "testVocbase", vocbase)));
sysDatabase->start(); // get system database from DatabaseFeature sysDatabase->start(); // get system database from DatabaseFeature
arangodb::methods::Collections::createSystem( arangodb::methods::Collections::createSystem(
*vocbase, *vocbase,

View File

@ -224,8 +224,7 @@ TEST_F(V8UsersTest, test_collection_auth) {
arangodb::application_features::ApplicationServer::getFeature<arangodb::DatabaseFeature>( arangodb::application_features::ApplicationServer::getFeature<arangodb::DatabaseFeature>(
"Database"); "Database");
TRI_vocbase_t* vocbase; // will be owned by DatabaseFeature TRI_vocbase_t* vocbase; // will be owned by DatabaseFeature
ASSERT_TRUE((TRI_ERROR_NO_ERROR == ASSERT_TRUE(databaseFeature->createDatabase(1, "testDatabase", vocbase).ok());
databaseFeature->createDatabase(1, "testDatabase", vocbase)));
v8::Isolate::CreateParams isolateParams; v8::Isolate::CreateParams isolateParams;
ArrayBufferAllocator arrayBufferAllocator; ArrayBufferAllocator arrayBufferAllocator;
isolateParams.array_buffer_allocator = &arrayBufferAllocator; isolateParams.array_buffer_allocator = &arrayBufferAllocator;