Compare commits
1 Commits
fix_finali
...
add-build-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1946a229fb |
@@ -5,11 +5,4 @@
|
|||||||
* GCC 11.2 (toolchain-v4) doesn't compile on Fedora 38, multiple definitions of enum issue
|
* GCC 11.2 (toolchain-v4) doesn't compile on Fedora 38, multiple definitions of enum issue
|
||||||
* spdlog 1.10/11 doesn't work with fmt 10.0.0
|
* spdlog 1.10/11 doesn't work with fmt 10.0.0
|
||||||
|
|
||||||
## os
|
## [os](os/README.md)
|
||||||
|
|
||||||
Under the `os` directory, you can find scripts to install all required system
|
|
||||||
dependencies on operating systems where Memgraph natively builds. The testing
|
|
||||||
script helps to see how to install all packages (in the case of a new package),
|
|
||||||
or make any adjustments in the overall system setup. Also, the testing script
|
|
||||||
helps check if Memgraph runs on a freshly installed operating system (with no
|
|
||||||
packages installed).
|
|
||||||
|
|||||||
8
environment/os/README.md
Normal file
8
environment/os/README.md
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
# Memgraph Environment OSes
|
||||||
|
|
||||||
|
Under the this (`os`) directory, you can find scripts to install all required system
|
||||||
|
dependencies on operating systems where Memgraph natively builds. The testing
|
||||||
|
script helps to see how to install all packages (in the case of a new package),
|
||||||
|
or make any adjustments in the overall system setup. Also, the testing script
|
||||||
|
helps check if Memgraph runs on a freshly installed operating system (with no
|
||||||
|
packages installed).
|
||||||
11
release/package/README.md
Normal file
11
release/package/README.md
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# Memgraph Release Packaging
|
||||||
|
|
||||||
|
## Design Decisions
|
||||||
|
|
||||||
|
* Being able to build and test memgraph locally under Docker because multi-OS support
|
||||||
|
* Being able to push Docker images to the centralized repo (DockerHub)
|
||||||
|
* Being able to build and test memgraph under CI under Docker
|
||||||
|
* Being able to iterate on the code changes when adding support for new toolchains and OSe
|
||||||
|
* Being able to pick and choose toolchains, OSes, build type, hardware architecture
|
||||||
|
* Take care of enterprise keys, telemetry
|
||||||
|
* Create generator for Dockerfiles
|
||||||
@@ -110,9 +110,9 @@ class Database {
|
|||||||
* @param force_directory Use the configured directory, do not try to decipher the multi-db version
|
* @param force_directory Use the configured directory, do not try to decipher the multi-db version
|
||||||
* @return DatabaseInfo
|
* @return DatabaseInfo
|
||||||
*/
|
*/
|
||||||
DatabaseInfo GetInfo(replication_coordination_glue::ReplicationRole replication_role) const {
|
DatabaseInfo GetInfo(bool force_directory, replication_coordination_glue::ReplicationRole replication_role) const {
|
||||||
DatabaseInfo info;
|
DatabaseInfo info;
|
||||||
info.storage_info = storage_->GetInfo(replication_role);
|
info.storage_info = storage_->GetInfo(force_directory, replication_role);
|
||||||
info.triggers = trigger_store_.GetTriggerInfo().size();
|
info.triggers = trigger_store_.GetTriggerInfo().size();
|
||||||
info.streams = streams_.GetStreamInfo().size();
|
info.streams = streams_.GetStreamInfo().size();
|
||||||
return info;
|
return info;
|
||||||
|
|||||||
@@ -302,7 +302,7 @@ class DbmsHandler {
|
|||||||
auto db_acc_opt = db_gk.access();
|
auto db_acc_opt = db_gk.access();
|
||||||
if (db_acc_opt) {
|
if (db_acc_opt) {
|
||||||
auto &db_acc = *db_acc_opt;
|
auto &db_acc = *db_acc_opt;
|
||||||
const auto &info = db_acc->GetInfo(replication_role);
|
const auto &info = db_acc->GetInfo(false, replication_role);
|
||||||
const auto &storage_info = info.storage_info;
|
const auto &storage_info = info.storage_info;
|
||||||
stats.num_vertex += storage_info.vertex_count;
|
stats.num_vertex += storage_info.vertex_count;
|
||||||
stats.num_edges += storage_info.edge_count;
|
stats.num_edges += storage_info.edge_count;
|
||||||
@@ -338,7 +338,7 @@ class DbmsHandler {
|
|||||||
auto db_acc_opt = db_gk.access();
|
auto db_acc_opt = db_gk.access();
|
||||||
if (db_acc_opt) {
|
if (db_acc_opt) {
|
||||||
auto &db_acc = *db_acc_opt;
|
auto &db_acc = *db_acc_opt;
|
||||||
res.push_back(db_acc->GetInfo(replication_role));
|
res.push_back(db_acc->GetInfo(false, replication_role));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
|||||||
@@ -825,7 +825,7 @@ uint64_t DiskStorage::GetDiskSpaceUsage() const {
|
|||||||
durability_disk_storage_size;
|
durability_disk_storage_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
StorageInfo DiskStorage::GetBaseInfo() {
|
StorageInfo DiskStorage::GetBaseInfo(bool /* unused */) {
|
||||||
StorageInfo info{};
|
StorageInfo info{};
|
||||||
info.vertex_count = vertex_count_;
|
info.vertex_count = vertex_count_;
|
||||||
info.edge_count = edge_count_.load(std::memory_order_acquire);
|
info.edge_count = edge_count_.load(std::memory_order_acquire);
|
||||||
@@ -838,8 +838,9 @@ StorageInfo DiskStorage::GetBaseInfo() {
|
|||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
StorageInfo DiskStorage::GetInfo(memgraph::replication_coordination_glue::ReplicationRole replication_role) {
|
StorageInfo DiskStorage::GetInfo(bool force_dir,
|
||||||
StorageInfo info = GetBaseInfo();
|
memgraph::replication_coordination_glue::ReplicationRole replication_role) {
|
||||||
|
StorageInfo info = GetBaseInfo(force_dir);
|
||||||
{
|
{
|
||||||
auto access = Access(replication_role);
|
auto access = Access(replication_role);
|
||||||
const auto &lbl = access->ListAllIndices();
|
const auto &lbl = access->ListAllIndices();
|
||||||
|
|||||||
@@ -307,8 +307,9 @@ class DiskStorage final : public Storage {
|
|||||||
std::vector<std::pair<std::string, std::string>> SerializeVerticesForLabelPropertyIndex(LabelId label,
|
std::vector<std::pair<std::string, std::string>> SerializeVerticesForLabelPropertyIndex(LabelId label,
|
||||||
PropertyId property);
|
PropertyId property);
|
||||||
|
|
||||||
StorageInfo GetBaseInfo() override;
|
StorageInfo GetBaseInfo(bool force_directory) override;
|
||||||
StorageInfo GetInfo(memgraph::replication_coordination_glue::ReplicationRole replication_role) override;
|
StorageInfo GetInfo(bool force_directory,
|
||||||
|
memgraph::replication_coordination_glue::ReplicationRole replication_role) override;
|
||||||
|
|
||||||
void FreeMemory(std::unique_lock<utils::ResourceLock> /*lock*/) override {}
|
void FreeMemory(std::unique_lock<utils::ResourceLock> /*lock*/) override {}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
#include "storage/v2/inmemory/storage.hpp"
|
#include "storage/v2/inmemory/storage.hpp"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <filesystem>
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include "dbms/constants.hpp"
|
#include "dbms/constants.hpp"
|
||||||
@@ -1759,7 +1758,7 @@ void InMemoryStorage::CollectGarbage(std::unique_lock<utils::ResourceLock> main_
|
|||||||
template void InMemoryStorage::CollectGarbage<true>(std::unique_lock<utils::ResourceLock>);
|
template void InMemoryStorage::CollectGarbage<true>(std::unique_lock<utils::ResourceLock>);
|
||||||
template void InMemoryStorage::CollectGarbage<false>(std::unique_lock<utils::ResourceLock>);
|
template void InMemoryStorage::CollectGarbage<false>(std::unique_lock<utils::ResourceLock>);
|
||||||
|
|
||||||
StorageInfo InMemoryStorage::GetBaseInfo() {
|
StorageInfo InMemoryStorage::GetBaseInfo(bool force_directory) {
|
||||||
StorageInfo info{};
|
StorageInfo info{};
|
||||||
info.vertex_count = vertices_.size();
|
info.vertex_count = vertices_.size();
|
||||||
info.edge_count = edge_count_.load(std::memory_order_acquire);
|
info.edge_count = edge_count_.load(std::memory_order_acquire);
|
||||||
@@ -1770,23 +1769,27 @@ StorageInfo InMemoryStorage::GetBaseInfo() {
|
|||||||
info.memory_res = utils::GetMemoryRES();
|
info.memory_res = utils::GetMemoryRES();
|
||||||
// Special case for the default database
|
// Special case for the default database
|
||||||
auto update_path = [&](const std::filesystem::path &dir) {
|
auto update_path = [&](const std::filesystem::path &dir) {
|
||||||
#ifdef MG_ENTERPRISE
|
if (!force_directory && std::filesystem::is_directory(dir) && dir.has_filename()) {
|
||||||
if (config_.salient.name == dbms::kDefaultDB) {
|
const auto end = dir.end();
|
||||||
// Default DB points to the root (for back-compatibility); update to the "database" dir
|
auto it = end;
|
||||||
std::filesystem::path new_dir = dir / "databases" / dbms::kDefaultDB;
|
--it;
|
||||||
if (std::filesystem::exists(new_dir) && std::filesystem::is_directory(new_dir)) {
|
if (it != end) {
|
||||||
return new_dir;
|
--it;
|
||||||
|
if (it != end && *it != "databases") {
|
||||||
|
// Default DB points to the root (for back-compatibility); update to the "database" dir
|
||||||
|
return dir / dbms::kMultiTenantDir / dbms::kDefaultDB;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return dir;
|
return dir;
|
||||||
};
|
};
|
||||||
info.disk_usage = utils::GetDirDiskUsage<false>(update_path(config_.durability.storage_directory));
|
info.disk_usage = utils::GetDirDiskUsage<false>(update_path(config_.durability.storage_directory));
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
StorageInfo InMemoryStorage::GetInfo(memgraph::replication_coordination_glue::ReplicationRole replication_role) {
|
StorageInfo InMemoryStorage::GetInfo(bool force_directory,
|
||||||
StorageInfo info = GetBaseInfo();
|
memgraph::replication_coordination_glue::ReplicationRole replication_role) {
|
||||||
|
StorageInfo info = GetBaseInfo(force_directory);
|
||||||
{
|
{
|
||||||
auto access = Access(replication_role); // TODO: override isolation level?
|
auto access = Access(replication_role); // TODO: override isolation level?
|
||||||
const auto &lbl = access->ListAllIndices();
|
const auto &lbl = access->ListAllIndices();
|
||||||
|
|||||||
@@ -368,8 +368,9 @@ class InMemoryStorage final : public Storage {
|
|||||||
bool InitializeWalFile(memgraph::replication::ReplicationEpoch &epoch);
|
bool InitializeWalFile(memgraph::replication::ReplicationEpoch &epoch);
|
||||||
void FinalizeWalFile();
|
void FinalizeWalFile();
|
||||||
|
|
||||||
StorageInfo GetBaseInfo() override;
|
StorageInfo GetBaseInfo(bool force_directory) override;
|
||||||
StorageInfo GetInfo(memgraph::replication_coordination_glue::ReplicationRole replication_role) override;
|
StorageInfo GetInfo(bool force_directory,
|
||||||
|
memgraph::replication_coordination_glue::ReplicationRole replication_role) override;
|
||||||
|
|
||||||
/// Return true in all cases excepted if any sync replicas have not sent confirmation.
|
/// Return true in all cases excepted if any sync replicas have not sent confirmation.
|
||||||
[[nodiscard]] bool AppendToWal(const Transaction &transaction, uint64_t final_commit_timestamp,
|
[[nodiscard]] bool AppendToWal(const Transaction &transaction, uint64_t final_commit_timestamp,
|
||||||
|
|||||||
@@ -215,11 +215,11 @@ bool ReplicationStorageClient::FinalizeTransactionReplication(Storage *storage,
|
|||||||
MG_ASSERT(replica_stream_, "Missing stream for transaction deltas");
|
MG_ASSERT(replica_stream_, "Missing stream for transaction deltas");
|
||||||
try {
|
try {
|
||||||
auto response = replica_stream_->Finalize();
|
auto response = replica_stream_->Finalize();
|
||||||
return replica_state_.WithLock([storage, response, db_acc = std::move(db_acc), this](auto &state) mutable {
|
return replica_state_.WithLock([storage, &response, db_acc = std::move(db_acc), this](auto &state) mutable {
|
||||||
replica_stream_.reset();
|
replica_stream_.reset();
|
||||||
if (!response.success || state == replication::ReplicaState::RECOVERY) {
|
if (!response.success || state == replication::ReplicaState::RECOVERY) {
|
||||||
state = replication::ReplicaState::RECOVERY;
|
state = replication::ReplicaState::RECOVERY;
|
||||||
client_.thread_pool_.AddTask([storage, response, db_acc = std::move(db_acc), this] {
|
client_.thread_pool_.AddTask([storage, &response, db_acc = std::move(db_acc), this] {
|
||||||
this->RecoverReplica(response.current_commit_timestamp, storage);
|
this->RecoverReplica(response.current_commit_timestamp, storage);
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -359,9 +359,18 @@ class Storage {
|
|||||||
utils::BasicResult<SetIsolationLevelError> SetIsolationLevel(IsolationLevel isolation_level);
|
utils::BasicResult<SetIsolationLevelError> SetIsolationLevel(IsolationLevel isolation_level);
|
||||||
IsolationLevel GetIsolationLevel() const noexcept;
|
IsolationLevel GetIsolationLevel() const noexcept;
|
||||||
|
|
||||||
virtual StorageInfo GetBaseInfo() = 0;
|
virtual StorageInfo GetBaseInfo(bool force_directory) = 0;
|
||||||
|
StorageInfo GetBaseInfo() {
|
||||||
|
#if MG_ENTERPRISE
|
||||||
|
const bool force_dir = false;
|
||||||
|
#else
|
||||||
|
const bool force_dir = true; //!< Use the configured directory (multi-tenancy reroutes to another dir)
|
||||||
|
#endif
|
||||||
|
return GetBaseInfo(force_dir);
|
||||||
|
}
|
||||||
|
|
||||||
virtual StorageInfo GetInfo(memgraph::replication_coordination_glue::ReplicationRole replication_role) = 0;
|
virtual StorageInfo GetInfo(bool force_directory,
|
||||||
|
memgraph::replication_coordination_glue::ReplicationRole replication_role) = 0;
|
||||||
|
|
||||||
virtual Transaction CreateTransaction(IsolationLevel isolation_level, StorageMode storage_mode,
|
virtual Transaction CreateTransaction(IsolationLevel isolation_level, StorageMode storage_mode,
|
||||||
memgraph::replication_coordination_glue::ReplicationRole replication_role) = 0;
|
memgraph::replication_coordination_glue::ReplicationRole replication_role) = 0;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
# Old v1 tests
|
||||||
cd "$DIR"
|
run_v1.sh
|
||||||
|
|
||||||
# New tests
|
# New tests
|
||||||
pushd () { command pushd "$@" > /dev/null; }
|
pushd () { command pushd "$@" > /dev/null; }
|
||||||
@@ -15,9 +15,8 @@ function wait_for_server {
|
|||||||
sleep 1
|
sleep 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Old v1 tests
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
tests_v1="$DIR/run_v1.sh"
|
cd "$DIR"
|
||||||
$tests_v1
|
|
||||||
|
|
||||||
# Create a temporary directory.
|
# Create a temporary directory.
|
||||||
tmpdir=/tmp/memgraph_drivers
|
tmpdir=/tmp/memgraph_drivers
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
#include <optional>
|
#include <optional>
|
||||||
|
|
||||||
#include "dbms/database.hpp"
|
#include "dbms/database.hpp"
|
||||||
#include "dbms/dbms_handler.hpp"
|
|
||||||
#include "disk_test_utils.hpp"
|
#include "disk_test_utils.hpp"
|
||||||
#include "query/interpret/awesome_memgraph_functions.hpp"
|
#include "query/interpret/awesome_memgraph_functions.hpp"
|
||||||
#include "query/interpreter_context.hpp"
|
#include "query/interpreter_context.hpp"
|
||||||
@@ -31,31 +30,15 @@ using namespace memgraph::storage;
|
|||||||
constexpr auto testSuite = "database_v2_get_info";
|
constexpr auto testSuite = "database_v2_get_info";
|
||||||
const std::filesystem::path storage_directory{std::filesystem::temp_directory_path() / testSuite};
|
const std::filesystem::path storage_directory{std::filesystem::temp_directory_path() / testSuite};
|
||||||
|
|
||||||
struct TestConfig {};
|
template <typename StorageType>
|
||||||
struct DefaultConfig : TestConfig {};
|
|
||||||
struct TenantConfig : TestConfig {};
|
|
||||||
|
|
||||||
template <typename TestType>
|
|
||||||
class InfoTest : public testing::Test {
|
class InfoTest : public testing::Test {
|
||||||
using StorageType = typename TestType::first_type;
|
|
||||||
using ConfigType = typename TestType::second_type;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void SetUp() {
|
void SetUp() {
|
||||||
repl_state_.emplace(ReplicationStateRootPath(config));
|
repl_state.emplace(memgraph::storage::ReplicationStateRootPath(config));
|
||||||
#ifdef MG_ENTERPRISE
|
db_gk.emplace(config, *repl_state);
|
||||||
dbms_handler_.emplace(config, *repl_state_, auth_, false);
|
auto db_acc_opt = db_gk->access();
|
||||||
auto db_acc = dbms_handler_->Get(); // Default db
|
MG_ASSERT(db_acc_opt, "Failed to access db");
|
||||||
if (std::is_same_v<ConfigType, TenantConfig>) {
|
auto &db_acc = *db_acc_opt;
|
||||||
constexpr std::string_view db_name = "test_db";
|
|
||||||
MG_ASSERT(dbms_handler_->New(std::string{db_name}).HasValue(), "Failed to create database.");
|
|
||||||
db_acc = dbms_handler_->Get(db_name);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
dbms_handler_.emplace(config, *repl_state_);
|
|
||||||
auto db_acc = dbms_handler_->Get();
|
|
||||||
#endif
|
|
||||||
MG_ASSERT(db_acc, "Failed to access db");
|
|
||||||
MG_ASSERT(db_acc->GetStorageMode() == (std::is_same_v<StorageType, memgraph::storage::DiskStorage>
|
MG_ASSERT(db_acc->GetStorageMode() == (std::is_same_v<StorageType, memgraph::storage::DiskStorage>
|
||||||
? memgraph::storage::StorageMode::ON_DISK_TRANSACTIONAL
|
? memgraph::storage::StorageMode::ON_DISK_TRANSACTIONAL
|
||||||
: memgraph::storage::StorageMode::IN_MEMORY_TRANSACTIONAL),
|
: memgraph::storage::StorageMode::IN_MEMORY_TRANSACTIONAL),
|
||||||
@@ -65,8 +48,8 @@ class InfoTest : public testing::Test {
|
|||||||
|
|
||||||
void TearDown() {
|
void TearDown() {
|
||||||
db_acc_.reset();
|
db_acc_.reset();
|
||||||
dbms_handler_.reset();
|
db_gk.reset();
|
||||||
repl_state_.reset();
|
repl_state.reset();
|
||||||
if (std::is_same<StorageType, memgraph::storage::DiskStorage>::value) {
|
if (std::is_same<StorageType, memgraph::storage::DiskStorage>::value) {
|
||||||
disk_test_utils::RemoveRocksDbDirs(testSuite);
|
disk_test_utils::RemoveRocksDbDirs(testSuite);
|
||||||
}
|
}
|
||||||
@@ -76,9 +59,9 @@ class InfoTest : public testing::Test {
|
|||||||
StorageMode mode{std::is_same_v<StorageType, DiskStorage> ? StorageMode::ON_DISK_TRANSACTIONAL
|
StorageMode mode{std::is_same_v<StorageType, DiskStorage> ? StorageMode::ON_DISK_TRANSACTIONAL
|
||||||
: StorageMode::IN_MEMORY_TRANSACTIONAL};
|
: StorageMode::IN_MEMORY_TRANSACTIONAL};
|
||||||
|
|
||||||
#ifdef MG_ENTERPRISE
|
std::optional<memgraph::replication::ReplicationState> repl_state;
|
||||||
memgraph::auth::SynchedAuth auth_{storage_directory, memgraph::auth::Auth::Config {}};
|
std::optional<memgraph::dbms::DatabaseAccess> db_acc_;
|
||||||
#endif
|
std::optional<memgraph::utils::Gatekeeper<memgraph::dbms::Database>> db_gk;
|
||||||
memgraph::storage::Config config{
|
memgraph::storage::Config config{
|
||||||
[&]() {
|
[&]() {
|
||||||
memgraph::storage::Config config{};
|
memgraph::storage::Config config{};
|
||||||
@@ -86,27 +69,18 @@ class InfoTest : public testing::Test {
|
|||||||
config.durability.snapshot_wal_mode =
|
config.durability.snapshot_wal_mode =
|
||||||
memgraph::storage::Config::Durability::SnapshotWalMode::PERIODIC_SNAPSHOT_WITH_WAL;
|
memgraph::storage::Config::Durability::SnapshotWalMode::PERIODIC_SNAPSHOT_WITH_WAL;
|
||||||
if constexpr (std::is_same_v<StorageType, memgraph::storage::DiskStorage>) {
|
if constexpr (std::is_same_v<StorageType, memgraph::storage::DiskStorage>) {
|
||||||
|
config.disk = disk_test_utils::GenerateOnDiskConfig(testSuite).disk;
|
||||||
config.force_on_disk = true;
|
config.force_on_disk = true;
|
||||||
}
|
}
|
||||||
return config;
|
return config;
|
||||||
}() // iile
|
}() // iile
|
||||||
};
|
};
|
||||||
std::optional<memgraph::replication::ReplicationState> repl_state_;
|
|
||||||
std::optional<memgraph::dbms::DbmsHandler> dbms_handler_;
|
|
||||||
std::optional<memgraph::dbms::DatabaseAccess> db_acc_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
using TestTypes = ::testing::Types<std::pair<memgraph::storage::InMemoryStorage, DefaultConfig>,
|
using StorageTypes = ::testing::Types<memgraph::storage::InMemoryStorage, memgraph::storage::DiskStorage>;
|
||||||
std::pair<memgraph::storage::DiskStorage, DefaultConfig>
|
|
||||||
|
|
||||||
#ifdef MG_ENTERPRISE
|
TYPED_TEST_CASE(InfoTest, StorageTypes);
|
||||||
,
|
// TYPED_TEST_CASE(IndexTest, InMemoryStorageType);
|
||||||
std::pair<memgraph::storage::InMemoryStorage, TenantConfig>,
|
|
||||||
std::pair<memgraph::storage::DiskStorage, TenantConfig>
|
|
||||||
#endif
|
|
||||||
>;
|
|
||||||
|
|
||||||
TYPED_TEST_CASE(InfoTest, TestTypes);
|
|
||||||
|
|
||||||
// NOLINTNEXTLINE(hicpp-special-member-functions)
|
// NOLINTNEXTLINE(hicpp-special-member-functions)
|
||||||
TYPED_TEST(InfoTest, InfoCheck) {
|
TYPED_TEST(InfoTest, InfoCheck) {
|
||||||
@@ -192,13 +166,13 @@ TYPED_TEST(InfoTest, InfoCheck) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const auto &info = db_acc->GetInfo(
|
const auto &info = db_acc->GetInfo(
|
||||||
memgraph::replication_coordination_glue::ReplicationRole::MAIN); // force to use configured directory
|
true, memgraph::replication_coordination_glue::ReplicationRole::MAIN); // force to use configured directory
|
||||||
|
|
||||||
ASSERT_EQ(info.storage_info.vertex_count, 5);
|
ASSERT_EQ(info.storage_info.vertex_count, 5);
|
||||||
ASSERT_EQ(info.storage_info.edge_count, 2);
|
ASSERT_EQ(info.storage_info.edge_count, 2);
|
||||||
ASSERT_EQ(info.storage_info.average_degree, 0.8);
|
ASSERT_EQ(info.storage_info.average_degree, 0.8);
|
||||||
ASSERT_GT(info.storage_info.memory_res, 10'000'000); // 250MB < > 10MB
|
ASSERT_GT(info.storage_info.memory_res, 10'000'000); // 200MB < > 10MB
|
||||||
ASSERT_LT(info.storage_info.memory_res, 250'000'000);
|
ASSERT_LT(info.storage_info.memory_res, 200'000'000);
|
||||||
ASSERT_GT(info.storage_info.disk_usage, 100); // 1MB < > 100B
|
ASSERT_GT(info.storage_info.disk_usage, 100); // 1MB < > 100B
|
||||||
ASSERT_LT(info.storage_info.disk_usage, 1000'000);
|
ASSERT_LT(info.storage_info.disk_usage, 1000'000);
|
||||||
ASSERT_EQ(info.storage_info.label_indices, 1);
|
ASSERT_EQ(info.storage_info.label_indices, 1);
|
||||||
|
|||||||
@@ -13,11 +13,12 @@
|
|||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
|
||||||
#include "dbms/constants.hpp"
|
#include "disk_test_utils.hpp"
|
||||||
#include "storage/v2/disk/storage.hpp"
|
#include "storage/v2/disk/storage.hpp"
|
||||||
#include "storage/v2/inmemory/storage.hpp"
|
#include "storage/v2/inmemory/storage.hpp"
|
||||||
#include "storage/v2/isolation_level.hpp"
|
#include "storage/v2/isolation_level.hpp"
|
||||||
#include "storage/v2/storage.hpp"
|
#include "storage/v2/storage.hpp"
|
||||||
|
#include "storage/v2/storage_error.hpp"
|
||||||
|
|
||||||
// NOLINTNEXTLINE(google-build-using-namespace)
|
// NOLINTNEXTLINE(google-build-using-namespace)
|
||||||
using namespace memgraph::storage;
|
using namespace memgraph::storage;
|
||||||
@@ -30,7 +31,6 @@ class InfoTest : public testing::Test {
|
|||||||
protected:
|
protected:
|
||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
std::filesystem::remove_all(storage_directory);
|
std::filesystem::remove_all(storage_directory);
|
||||||
config_.salient.name = memgraph::dbms::kDefaultDB;
|
|
||||||
memgraph::storage::UpdatePaths(config_, storage_directory);
|
memgraph::storage::UpdatePaths(config_, storage_directory);
|
||||||
config_.durability.snapshot_wal_mode =
|
config_.durability.snapshot_wal_mode =
|
||||||
memgraph::storage::Config::Durability::SnapshotWalMode::PERIODIC_SNAPSHOT_WITH_WAL;
|
memgraph::storage::Config::Durability::SnapshotWalMode::PERIODIC_SNAPSHOT_WITH_WAL;
|
||||||
@@ -135,7 +135,7 @@ TYPED_TEST(InfoTest, InfoCheck) {
|
|||||||
ASSERT_FALSE(unique_acc->Commit().HasError());
|
ASSERT_FALSE(unique_acc->Commit().HasError());
|
||||||
}
|
}
|
||||||
|
|
||||||
StorageInfo info = this->storage->GetInfo(ReplicationRole::MAIN);
|
StorageInfo info = this->storage->GetInfo(true, ReplicationRole::MAIN); // force to use configured directory
|
||||||
|
|
||||||
ASSERT_EQ(info.vertex_count, 5);
|
ASSERT_EQ(info.vertex_count, 5);
|
||||||
ASSERT_EQ(info.edge_count, 2);
|
ASSERT_EQ(info.edge_count, 2);
|
||||||
|
|||||||
Reference in New Issue
Block a user