Improve logging for the on-disk storage (#1079)
This commit is contained in:
parent
3b9133fd5a
commit
fae039c215
@ -177,7 +177,7 @@ class ReplicationModificationInMulticommandTxException : public QueryException {
|
|||||||
|
|
||||||
class ReplicationDisabledOnDiskStorage : public QueryException {
|
class ReplicationDisabledOnDiskStorage : public QueryException {
|
||||||
public:
|
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 {
|
class LockPathModificationInMulticommandTxException : public QueryException {
|
||||||
@ -250,7 +250,7 @@ class CreateSnapshotInMulticommandTxException final : public QueryException {
|
|||||||
|
|
||||||
class CreateSnapshotDisabledOnDiskStorage final : public QueryException {
|
class CreateSnapshotDisabledOnDiskStorage final : public QueryException {
|
||||||
public:
|
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 {
|
class SettingConfigInMulticommandTxException final : public QueryException {
|
||||||
|
@ -2361,31 +2361,30 @@ Callback SwitchMemoryDevice(storage::StorageMode current_mode, storage::StorageM
|
|||||||
}
|
}
|
||||||
if (SwitchingFromDiskToInMemory(current_mode, requested_mode)) {
|
if (SwitchingFromDiskToInMemory(current_mode, requested_mode)) {
|
||||||
throw utils::BasicException(
|
throw utils::BasicException(
|
||||||
"You cannot switch from on-disk storage to in-memory storage while the database is running. "
|
"You cannot switch from the on-disk storage mode to an in-memory storage mode while the database is running. "
|
||||||
"Please delete your data directory and restart the database. Once restarted, the Memgraph will automatically "
|
"To make the switch, delete the data directory and restart the database. Once restarted, Memgraph will automatically "
|
||||||
"start to use in-memory storage.");
|
"start in the default in-memory transactional storage mode.");
|
||||||
}
|
}
|
||||||
if (SwitchingFromInMemoryToDisk(current_mode, requested_mode)) {
|
if (SwitchingFromInMemoryToDisk(current_mode, requested_mode)) {
|
||||||
std::unique_lock main_guard{interpreter_context->db->main_lock_};
|
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) {
|
if (auto vertex_cnt_approx = interpreter_context->db->GetInfo().vertex_count; vertex_cnt_approx > 0) {
|
||||||
throw utils::BasicException(
|
throw utils::BasicException(
|
||||||
"You cannot switch from in-memory storage to on-disk storage when the database "
|
"You cannot switch from an in-memory storage mode to the on-disk storage mode when the database "
|
||||||
"contains data. Please delete all entries from the database, run FREE MEMORY and then repeat this "
|
"contains data. Delete all entries from the database, run FREE MEMORY and then repeat this "
|
||||||
"query. ");
|
"query. ");
|
||||||
}
|
}
|
||||||
|
|
||||||
main_guard.unlock();
|
main_guard.unlock();
|
||||||
if (interpreter_context->interpreters->size() > 1) {
|
if (interpreter_context->interpreters->size() > 1) {
|
||||||
throw utils::BasicException(
|
throw utils::BasicException(
|
||||||
"You cannot switch from in-memory storage to on-disk storage when there are "
|
"You cannot switch from an in-memory storage mode to the on-disk storage mode when there are "
|
||||||
"multiple sessions active. Please close all other sessions and try again. If you are using Memgraph Lab, "
|
"multiple sessions active. Close all other sessions and try again. As Memgraph Lab uses "
|
||||||
"please start mgconsole "
|
"multiple sessions to run queries in parallel, "
|
||||||
"and run the STORAGE MODE ON_DISK_TRANSACTIONAL there first. Memgraph Lab is using multiple sessions to "
|
"it is currently impossible to switch to the on-disk storage mode within Lab. "
|
||||||
"run queries in parallel "
|
"Close it, connect to the instance with mgconsole "
|
||||||
"so it is currently impossible to switch to on-disk storage while the Lab is running. After you switch "
|
"and change the storage mode to on-disk from there. Then, you can reconnect with the Lab "
|
||||||
"from the mgconsole, you can "
|
"and continue to use the instance as usual.");
|
||||||
"continue to use Memgraph Lab as you wish.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto db_config = interpreter_context->db->config_;
|
auto db_config = interpreter_context->db->config_;
|
||||||
|
Loading…
Reference in New Issue
Block a user