From fae039c2153d5ed7a68fb8494fccbb6d654e2f4e Mon Sep 17 00:00:00 2001 From: Vlasta <95473291+vpavicic@users.noreply.github.com> Date: Wed, 19 Jul 2023 22:54:42 +0200 Subject: [PATCH] Improve logging for the on-disk storage (#1079) --- src/query/exceptions.hpp | 4 ++-- src/query/interpreter.cpp | 25 ++++++++++++------------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/query/exceptions.hpp b/src/query/exceptions.hpp index 9b5c6651e..8ba00830b 100644 --- a/src/query/exceptions.hpp +++ b/src/query/exceptions.hpp @@ -177,7 +177,7 @@ class ReplicationModificationInMulticommandTxException : public QueryException { class ReplicationDisabledOnDiskStorage : public QueryException { public: - ReplicationDisabledOnDiskStorage() : QueryException("Replication not support with disk storage. ") {} + ReplicationDisabledOnDiskStorage() : QueryException("Replication is not supported while in on-disk storage mode.") {} }; class LockPathModificationInMulticommandTxException : public QueryException { @@ -250,7 +250,7 @@ class CreateSnapshotInMulticommandTxException final : public QueryException { class CreateSnapshotDisabledOnDiskStorage final : public QueryException { public: - CreateSnapshotDisabledOnDiskStorage() : QueryException("Data is already persisted when using disk storage. ") {} + CreateSnapshotDisabledOnDiskStorage() : QueryException("In the on-disk storage mode data is already persistent.") {} }; class SettingConfigInMulticommandTxException final : public QueryException { diff --git a/src/query/interpreter.cpp b/src/query/interpreter.cpp index 8b95b5ee2..4a224626c 100644 --- a/src/query/interpreter.cpp +++ b/src/query/interpreter.cpp @@ -2361,31 +2361,30 @@ Callback SwitchMemoryDevice(storage::StorageMode current_mode, storage::StorageM } if (SwitchingFromDiskToInMemory(current_mode, requested_mode)) { throw utils::BasicException( - "You cannot switch from on-disk storage to in-memory storage while the database is running. " - "Please delete your data directory and restart the database. Once restarted, the Memgraph will automatically " - "start to use in-memory storage."); + "You cannot switch from the on-disk storage mode to an in-memory storage mode while the database is running. " + "To make the switch, delete the data directory and restart the database. Once restarted, Memgraph will automatically " + "start in the default in-memory transactional storage mode."); } if (SwitchingFromInMemoryToDisk(current_mode, requested_mode)) { std::unique_lock main_guard{interpreter_context->db->main_lock_}; if (auto vertex_cnt_approx = interpreter_context->db->GetInfo().vertex_count; vertex_cnt_approx > 0) { throw utils::BasicException( - "You cannot switch from in-memory storage to on-disk storage when the database " - "contains data. Please delete all entries from the database, run FREE MEMORY and then repeat this " + "You cannot switch from an in-memory storage mode to the on-disk storage mode when the database " + "contains data. Delete all entries from the database, run FREE MEMORY and then repeat this " "query. "); } main_guard.unlock(); if (interpreter_context->interpreters->size() > 1) { throw utils::BasicException( - "You cannot switch from in-memory storage to on-disk storage when there are " - "multiple sessions active. Please close all other sessions and try again. If you are using Memgraph Lab, " - "please start mgconsole " - "and run the STORAGE MODE ON_DISK_TRANSACTIONAL there first. Memgraph Lab is using multiple sessions to " - "run queries in parallel " - "so it is currently impossible to switch to on-disk storage while the Lab is running. After you switch " - "from the mgconsole, you can " - "continue to use Memgraph Lab as you wish."); + "You cannot switch from an in-memory storage mode to the on-disk storage mode when there are " + "multiple sessions active. Close all other sessions and try again. As Memgraph Lab uses " + "multiple sessions to run queries in parallel, " + "it is currently impossible to switch to the on-disk storage mode within Lab. " + "Close it, connect to the instance with mgconsole " + "and change the storage mode to on-disk from there. Then, you can reconnect with the Lab " + "and continue to use the instance as usual."); } auto db_config = interpreter_context->db->config_;