diff --git a/arangod/RestServer/DatabaseFeature.cpp b/arangod/RestServer/DatabaseFeature.cpp index 990c58b4e0..d2fb04e0d4 100644 --- a/arangod/RestServer/DatabaseFeature.cpp +++ b/arangod/RestServer/DatabaseFeature.cpp @@ -150,7 +150,7 @@ void DatabaseManagerThread::run() { // remove apps directory for database auto appPath = dealer->appPath(); - if (database->_isOwnAppsDirectory && !appPath.empty()) { + if (database->isOwnAppsDirectory() && !appPath.empty()) { path = arangodb::basics::FileUtils::buildFilename( arangodb::basics::FileUtils::buildFilename(appPath, "_db"), database->name()); @@ -687,7 +687,7 @@ int DatabaseFeature::dropDatabase(std::string const& name, bool writeMarker, boo _databasesProtector.scan(); delete oldLists; - vocbase->_isOwnAppsDirectory = removeAppsDirectory; + vocbase->isOwnAppsDirectory(removeAppsDirectory); // invalidate all entries for the database arangodb::aql::QueryCache::instance()->invalidate(vocbase); diff --git a/arangod/VocBase/vocbase.cpp b/arangod/VocBase/vocbase.cpp index 78e997a9f4..cf76d50077 100644 --- a/arangod/VocBase/vocbase.cpp +++ b/arangod/VocBase/vocbase.cpp @@ -1530,10 +1530,11 @@ TRI_vocbase_t::TRI_vocbase_t(TRI_vocbase_type_e type, TRI_voc_tick_t id, _name(name), _type(type), _refCount(0), + _isOwnAppsDirectory(true), _deadlockDetector(false), _userStructures(nullptr), - _hasCompactor(false), - _isOwnAppsDirectory(true) { + _hasCompactor(false) { + _queries.reset(new arangodb::aql::QueryList(this)); _cursorRepository.reset(new arangodb::CursorRepository(this)); _collectionKeys.reset(new arangodb::CollectionKeysRepository()); diff --git a/arangod/VocBase/vocbase.h b/arangod/VocBase/vocbase.h index dbad4a22f2..ea39aa3f46 100644 --- a/arangod/VocBase/vocbase.h +++ b/arangod/VocBase/vocbase.h @@ -177,10 +177,8 @@ struct TRI_vocbase_t { std::string _name; // database name TRI_vocbase_type_e _type; // type (normal or coordinator) std::atomic _refCount; - public: - arangodb::basics::DeadlockDetector - _deadlockDetector; - private: + bool _isOwnAppsDirectory; + arangodb::basics::ReadWriteLock _collectionsLock; // collection iterator lock std::vector _collections; // pointers to ALL collections std::vector _deadCollections; // pointers to collections @@ -189,20 +187,22 @@ struct TRI_vocbase_t { std::unordered_map _collectionsByName; // collections by name std::unordered_map _collectionsById; // collections by id + + std::unique_ptr _queries; + std::unique_ptr _cursorRepository; + std::unique_ptr _collectionKeys; + public: + arangodb::basics::DeadlockDetector + _deadlockDetector; arangodb::basics::ReadWriteLock _inventoryLock; // object lock needed when // replication is assessing // the state of the vocbase // structures for user-defined volatile data void* _userStructures; - private: - std::unique_ptr _queries; - std::unique_ptr _cursorRepository; - std::unique_ptr _collectionKeys; public: bool _hasCompactor; - bool _isOwnAppsDirectory; std::unique_ptr _replicationApplier; @@ -245,6 +245,9 @@ struct TRI_vocbase_t { arangodb::CursorRepository* cursorRepository() const { return _cursorRepository.get(); } arangodb::CollectionKeysRepository* collectionKeys() const { return _collectionKeys.get(); } + bool isOwnAppsDirectory() const { return _isOwnAppsDirectory; } + void isOwnAppsDirectory(bool value) { _isOwnAppsDirectory = value; } + /// @brief whether or not the vocbase has been marked as deleted inline bool isDropped() const { auto refCount = _refCount.load();