diff --git a/config/alpha.conf b/config/alpha.conf
index ae91c62d4..fe29aa11b 100644
--- a/config/alpha.conf
+++ b/config/alpha.conf
@@ -21,17 +21,16 @@
--snapshot-cycle-sec=300
# create snapshot disabled on db exit
---snapshot-on-db-exit=true
+--snapshot-on-exit=true
# max number of snapshots which will be kept on the disk at some point
# if set to -1 the max number of snapshots is unlimited
---max-retained-snapshots=3
+--snapshot-max-retained=3
# by default query engine runs in interpret mode
--interpret=true
-# database recovering is disabled by default
---recover-on-startup=true
+--snapshot-recover-on-startup=true
# use ast caching
--ast-cache=false
diff --git a/config/benchmarking_latency.conf b/config/benchmarking_latency.conf
index fe669c8e9..665c430fb 100644
--- a/config/benchmarking_latency.conf
+++ b/config/benchmarking_latency.conf
@@ -29,17 +29,17 @@
--query_execution_time_sec=-1
# create snapshot disabled on db exit
---snapshot-on-db-exit=false
+--snapshot-on-exit=false
# max number of snapshots which will be kept on the disk at some point
# if set to -1 the max number of snapshots is unlimited
---max-retained-snapshots=-1
+--snapshot-max-retained=-1
# by default query engine runs in interpret mode
--interpret=true
# database recovering is disabled by default
---recover-on-startup=false
+--snapshot-recover-on-startup=false
# use ast caching
--ast-cache=true
diff --git a/config/benchmarking_throughput.conf b/config/benchmarking_throughput.conf
index 357d93b53..1c56c9b58 100644
--- a/config/benchmarking_throughput.conf
+++ b/config/benchmarking_throughput.conf
@@ -21,17 +21,17 @@
--query_execution_time_sec=-1
# create snapshot disabled on db exit
---snapshot-on-db-exit=false
+--snapshot-on-exit=false
# max number of snapshots which will be kept on the disk at some point
# if set to -1 the max number of snapshots is unlimited
---max-retained-snapshots=-1
+--snapshot-max-retained=-1
# by default query engine runs in interpret mode
--interpret=true
# database recovering is disabled by default
---recover-on-startup=false
+--snapshot-recover-on-startup=false
# use ast caching
--ast-cache=true
diff --git a/config/stress.conf b/config/stress.conf
index af3cbf47c..ec3442b22 100644
--- a/config/stress.conf
+++ b/config/stress.conf
@@ -21,17 +21,17 @@
--snapshot-cycle-sec=600
# create snapshot enabled on db exit
---snapshot-on-db-exit=true
+--snapshot-on-exit=true
# max number of snapshots which will be kept on the disk at some point
# if set to -1 the max number of snapshots is unlimited
---max-retained-snapshots=1
+--snapshot-max-retained=1
# by default query engine runs in interpret mode
--interpret=true
# database recovering is disabled by default
---recover-on-startup=false
+--snapshot-recover-on-startup=false
# use ast caching
--ast-cache=true
diff --git a/config/testing.conf b/config/testing.conf
index 5f8b754ca..09a5814f8 100644
--- a/config/testing.conf
+++ b/config/testing.conf
@@ -21,17 +21,17 @@
--snapshot-cycle-sec=-1
# create snapshot disabled on db exit
---snapshot-on-db-exit=true
+--snapshot-on-exit=true
# max number of snapshots which will be kept on the disk at some point
# if set to -1 the max number of snapshots is unlimited
---max-retained-snapshots=-1
+--snapshot-max-retained=-1
# by default query engine runs in interpret mode
--interpret=true
# database recovering is disabled by default
---recover-on-startup=false
+--snapshot-recover-on-startup=false
# use ast caching
--ast-cache=true
diff --git a/docs/user_technical/installation.md b/docs/user_technical/installation.md
index 4c3599381..6f1b1d4c2 100644
--- a/docs/user_technical/installation.md
+++ b/docs/user_technical/installation.md
@@ -68,9 +68,9 @@ parameters:
--port | integer | 7687 | Communication port on which to listen.
--num-workers | integer | CPU count[^1] | Number of Memgraph worker threads.
--snapshot-cycle-sec | integer | 300 | Interval (seconds) between database snapshots.
Value of -1 turns taking snapshots off.
- --max-retained-snapshots | integer | 3 | Number of retained snapshots.
Value -1 means without limit.
- --snapshot-on-db-exit | bool | false | Make a snapshot when closing Memgraph.
- --recover-on-startup | bool | false | Recover the database on startup using the last
stored snapshot.
+ --snapshot-max-retained | integer | 3 | Number of retained snapshots.
Value -1 means without limit.
+ --snapshot-on-exit | bool | false | Make a snapshot when closing Memgraph.
+ --snapshot-recover-on-startup | bool | false | Recover the database on startup using the last
stored snapshot.
--query-execution-time-sec | integer | 180 | Maximum allowed query execution time.
Queries exceeding this limit will be aborted. Value of -1 means no limit.
[^1]: Maximum number of concurrent executions on the current CPU.
diff --git a/src/database/dbms.cpp b/src/database/dbms.cpp
index 4d6ae6803..54a55c6a7 100644
--- a/src/database/dbms.cpp
+++ b/src/database/dbms.cpp
@@ -4,7 +4,7 @@
DEFINE_string(snapshot_directory, "snapshots",
"Relative path to directory in which to save snapshots.");
-DEFINE_bool(recover_on_startup, false, "Recover database on startup.");
+DEFINE_bool(snapshot_recover_on_startup, false, "Recover database on startup.");
std::unique_ptr Dbms::active() {
return std::make_unique(
diff --git a/src/database/dbms.hpp b/src/database/dbms.hpp
index 0e478cc6d..7b9ffb855 100644
--- a/src/database/dbms.hpp
+++ b/src/database/dbms.hpp
@@ -13,7 +13,7 @@
#include "utils/exceptions.hpp"
DECLARE_string(snapshot_directory);
-DECLARE_bool(recover_on_startup);
+DECLARE_bool(snapshot_recover_on_startup);
namespace fs = std::experimental::filesystem;
@@ -45,7 +45,7 @@ class Dbms {
throw utils::BasicException("Specified snapshot directory is a file!");
}
- if (FLAGS_recover_on_startup) {
+ if (FLAGS_snapshot_recover_on_startup) {
if (fs::exists(snapshot_root_dir)) {
auto accessor = dbs.access();
for (auto &snapshot_db_dir :
diff --git a/src/database/graph_db.cpp b/src/database/graph_db.cpp
index d253921c2..49ad4afae 100644
--- a/src/database/graph_db.cpp
+++ b/src/database/graph_db.cpp
@@ -13,7 +13,7 @@
DEFINE_int32(gc_cycle_sec, 30,
"Amount of time between starts of two cleaning cycles in seconds. "
"-1 to turn off.");
-DEFINE_int32(max_retained_snapshots, -1,
+DEFINE_int32(snapshot_max_retained, -1,
"Number of retained snapshots, -1 means without limit.");
DEFINE_int32(snapshot_cycle_sec, -1,
"Amount of time between starts of two snapshooters in seconds. -1 "
@@ -22,7 +22,7 @@ DEFINE_int32(query_execution_time_sec, 180,
"Maximum allowed query execution time. Queries exceeding this "
"limit will be aborted. Value of -1 means no limit.");
-DEFINE_bool(snapshot_on_db_exit, false, "Snapshot on exiting the database.");
+DEFINE_bool(snapshot_on_exit, false, "Snapshot on exiting the database.");
DECLARE_string(snapshot_directory);
@@ -61,7 +61,7 @@ void GraphDb::StartSnapshooting() {
GraphDbAccessor db_accessor(*this);
snapshooter_.MakeSnapshot(db_accessor,
fs::path(FLAGS_snapshot_directory) / name_,
- FLAGS_max_retained_snapshots);
+ FLAGS_snapshot_max_retained);
};
snapshot_creator_.Run(std::chrono::seconds(FLAGS_snapshot_cycle_sec),
create_snapshot);
@@ -134,12 +134,12 @@ GraphDb::~GraphDb() {
transaction_killer_.Stop();
// Create last database snapshot
- if (FLAGS_snapshot_on_db_exit == true) {
+ if (FLAGS_snapshot_on_exit == true) {
GraphDbAccessor db_accessor(*this);
LOG(INFO) << "Creating snapshot on shutdown..." << std::endl;
const bool status = snapshooter_.MakeSnapshot(
db_accessor, fs::path(FLAGS_snapshot_directory) / name_,
- FLAGS_max_retained_snapshots);
+ FLAGS_snapshot_max_retained);
if (status) {
std::cout << "Snapshot created successfully." << std::endl;
} else {
diff --git a/src/durability/snapshooter.cpp b/src/durability/snapshooter.cpp
index 5fcca944b..a3765dbd1 100644
--- a/src/durability/snapshooter.cpp
+++ b/src/durability/snapshooter.cpp
@@ -11,7 +11,7 @@
bool Snapshooter::MakeSnapshot(GraphDbAccessor &db_accessor_,
const fs::path &snapshot_folder,
- const int max_retained_snapshots) {
+ const int snapshot_max_retained) {
if (!fs::exists(snapshot_folder) &&
!fs::create_directories(snapshot_folder)) {
LOG(ERROR) << "Error while creating directory " << snapshot_folder;
@@ -20,7 +20,7 @@ bool Snapshooter::MakeSnapshot(GraphDbAccessor &db_accessor_,
const auto snapshot_file = GetSnapshotFileName(snapshot_folder);
if (fs::exists(snapshot_file)) return false;
if (Encode(snapshot_file, db_accessor_)) {
- MaintainMaxRetainedFiles(snapshot_folder, max_retained_snapshots);
+ MaintainMaxRetainedFiles(snapshot_folder, snapshot_max_retained);
return true;
}
return false;
@@ -80,12 +80,12 @@ std::vector Snapshooter::GetSnapshotFiles(
}
void Snapshooter::MaintainMaxRetainedFiles(const fs::path &snapshot_folder,
- int max_retained_snapshots) {
- if (max_retained_snapshots == -1) return;
+ int snapshot_max_retained) {
+ if (snapshot_max_retained == -1) return;
std::vector files = GetSnapshotFiles(snapshot_folder);
- if (static_cast(files.size()) <= max_retained_snapshots) return;
+ if (static_cast(files.size()) <= snapshot_max_retained) return;
sort(files.begin(), files.end());
- for (int i = 0; i < static_cast(files.size()) - max_retained_snapshots;
+ for (int i = 0; i < static_cast(files.size()) - snapshot_max_retained;
++i) {
if (!fs::remove(files[i])) {
LOG(ERROR) << "Error while removing file: " << files[i];
diff --git a/src/durability/snapshooter.hpp b/src/durability/snapshooter.hpp
index 6dc54d598..3d6d66b14 100644
--- a/src/durability/snapshooter.hpp
+++ b/src/durability/snapshooter.hpp
@@ -21,12 +21,12 @@ class Snapshooter {
* GraphDbAccessor used to access elements of GraphDb.
* @param snapshot_folder:
* folder where snapshots are stored.
- * @param max_retained_snapshots:
+ * @param snapshot_max_retained:
* maximum number of snapshots stored in snapshot folder.
*/
bool MakeSnapshot(GraphDbAccessor &db_accessor,
const fs::path &snapshot_folder,
- int max_retained_snapshots);
+ int snapshot_max_retained);
private:
/**
diff --git a/tests/public_benchmark/ldbc/config/memgraph.conf b/tests/public_benchmark/ldbc/config/memgraph.conf
index d27896bfc..5094f6397 100644
--- a/tests/public_benchmark/ldbc/config/memgraph.conf
+++ b/tests/public_benchmark/ldbc/config/memgraph.conf
@@ -21,17 +21,16 @@
--snapshot-cycle-sec=-1
# create snapshot disabled on db exit
---snapshot-on-db-exit=false
+--snapshot-on-exit=false
# max number of snapshots which will be kept on the disk at some point
# if set to -1 the max number of snapshots is unlimited
---max-retained-snapshots=-1
+--snapshot-max-retained=-1
# by default query engine runs in interpret mode
--interpret=true
-# database recovering is disabled by default
---recover-on-startup=true
+--snapshot-recover-on-startup=true
# use ast caching
--ast-cache=true
diff --git a/tests/unit/dbms_recovery.cpp b/tests/unit/dbms_recovery.cpp
index bb7f1b62e..b6aa35a97 100644
--- a/tests/unit/dbms_recovery.cpp
+++ b/tests/unit/dbms_recovery.cpp
@@ -43,7 +43,7 @@ class DbmsRecoveryTest : public ::testing::Test {
};
void CreateSnapshot() {
- FLAGS_recover_on_startup = false;
+ FLAGS_snapshot_recover_on_startup = false;
Dbms dbms;
auto dba = dbms.active();
@@ -62,7 +62,7 @@ void CreateSnapshot() {
}
void RecoverDbms() {
- FLAGS_recover_on_startup = true;
+ FLAGS_snapshot_recover_on_startup = true;
Dbms dbms;
auto dba = dbms.active();
diff --git a/tests/unit/recovery.cpp b/tests/unit/recovery.cpp
index 4620f75bb..c416c76fa 100644
--- a/tests/unit/recovery.cpp
+++ b/tests/unit/recovery.cpp
@@ -44,7 +44,7 @@ class RecoveryTest : public ::testing::Test {
CleanDbDir();
FLAGS_snapshot_cycle_sec = -1;
}
- const int max_retained_snapshots_ = 10;
+ const int snapshot_max_retained_ = 10;
};
void CreateSmallGraph(Dbms &dbms) {
@@ -78,11 +78,11 @@ void CreateBigGraph(Dbms &dbms) {
dba->Commit();
}
-void TakeSnapshot(Dbms &dbms, int max_retained_snapshots_) {
+void TakeSnapshot(Dbms &dbms, int snapshot_max_retained_) {
auto dba = dbms.active();
Snapshooter snapshooter;
snapshooter.MakeSnapshot(*dba.get(), SNAPSHOTS_RECOVERY_DEFAULT_DB_DIR,
- max_retained_snapshots_);
+ snapshot_max_retained_);
}
std::string GetLatestSnapshot() {
@@ -100,7 +100,7 @@ TEST_F(RecoveryTest, TestEncoding) {
// reading graph is tested.
Dbms dbms;
CreateSmallGraph(dbms);
- TakeSnapshot(dbms, max_retained_snapshots_);
+ TakeSnapshot(dbms, snapshot_max_retained_);
std::string snapshot = GetLatestSnapshot();
FileReaderBuffer buffer;
@@ -150,7 +150,7 @@ TEST_F(RecoveryTest, TestEncodingAndDecoding) {
// the snapshot file. After creation graph is tested.
Dbms dbms;
CreateSmallGraph(dbms);
- TakeSnapshot(dbms, max_retained_snapshots_);
+ TakeSnapshot(dbms, snapshot_max_retained_);
std::string snapshot = GetLatestSnapshot();
// New dbms is needed - old dbms has database "default"
@@ -193,7 +193,7 @@ TEST_F(RecoveryTest, TestEncodingAndRecovering) {
// the snapshot file. After creation graph is tested.
Dbms dbms;
CreateBigGraph(dbms);
- TakeSnapshot(dbms, max_retained_snapshots_);
+ TakeSnapshot(dbms, snapshot_max_retained_);
std::string snapshot = GetLatestSnapshot();
// New dbms is needed - old dbms has database "default"
@@ -236,7 +236,7 @@ TEST_F(RecoveryTest, TestLabelPropertyIndexRecovery) {
dba->BuildIndex(dba->Label("label"), dba->Property("prop"));
dba->Commit();
CreateBigGraph(dbms);
- TakeSnapshot(dbms, max_retained_snapshots_);
+ TakeSnapshot(dbms, snapshot_max_retained_);
std::string snapshot = GetLatestSnapshot();
Dbms dbms_recover;
diff --git a/tests/unit/snapshot.cpp b/tests/unit/snapshot.cpp
index 8b0cd1e06..f788c6c61 100644
--- a/tests/unit/snapshot.cpp
+++ b/tests/unit/snapshot.cpp
@@ -6,7 +6,7 @@
#include "database/dbms.hpp"
#include "durability/snapshooter.hpp"
-DECLARE_bool(snapshot_on_db_exit);
+DECLARE_bool(snapshot_on_exit);
DECLARE_int32(snapshot_cycle_sec);
DECLARE_string(snapshot_directory);
@@ -47,14 +47,14 @@ class SnapshotTest : public ::testing::Test {
};
TEST_F(SnapshotTest, CreateLessThanMaxRetainedSnapshotsTests) {
- const int max_retained_snapshots = 10;
+ const int snapshot_max_retained = 10;
Dbms dbms;
for (int i = 0; i < 3; ++i) {
auto dba = dbms.active();
Snapshooter snapshooter;
snapshooter.MakeSnapshot(*dba.get(), SNAPSHOTS_TEST_DEFAULT_DB_DIR,
- max_retained_snapshots);
+ snapshot_max_retained);
}
std::vector files = GetFilesFromDir(SNAPSHOTS_TEST_DEFAULT_DB_DIR);
@@ -62,7 +62,7 @@ TEST_F(SnapshotTest, CreateLessThanMaxRetainedSnapshotsTests) {
}
TEST_F(SnapshotTest, CreateMoreThanMaxRetainedSnapshotsTests) {
- const int max_retained_snapshots = 2;
+ const int snapshot_max_retained = 2;
Dbms dbms;
fs::path first_snapshot;
@@ -70,7 +70,7 @@ TEST_F(SnapshotTest, CreateMoreThanMaxRetainedSnapshotsTests) {
auto dba = dbms.active();
Snapshooter snapshooter;
snapshooter.MakeSnapshot(*dba.get(), SNAPSHOTS_TEST_DEFAULT_DB_DIR,
- max_retained_snapshots);
+ snapshot_max_retained);
if (i == 0) {
std::vector files_begin =
GetFilesFromDir(SNAPSHOTS_TEST_DEFAULT_DB_DIR);
@@ -86,14 +86,14 @@ TEST_F(SnapshotTest, CreateMoreThanMaxRetainedSnapshotsTests) {
}
TEST_F(SnapshotTest, CreateSnapshotWithUnlimitedMaxRetainedSnapshots) {
- const int max_retained_snapshots = -1;
+ const int snapshot_max_retained = -1;
Dbms dbms;
for (int i = 0; i < 10; ++i) {
auto dba = dbms.active();
Snapshooter snapshooter;
snapshooter.MakeSnapshot(*dba.get(), SNAPSHOTS_TEST_DEFAULT_DB_DIR,
- max_retained_snapshots);
+ snapshot_max_retained);
}
std::vector files = GetFilesFromDir(SNAPSHOTS_TEST_DEFAULT_DB_DIR);
@@ -103,7 +103,7 @@ TEST_F(SnapshotTest, CreateSnapshotWithUnlimitedMaxRetainedSnapshots) {
TEST_F(SnapshotTest, TestSnapshotFileOnDbDestruct) {
{
FLAGS_snapshot_directory = SNAPSHOTS_FOLDER_ALL_DB;
- FLAGS_snapshot_on_db_exit = true;
+ FLAGS_snapshot_on_exit = true;
Dbms dbms;
auto dba = dbms.active();
}