From 4d985d8e6661c4ca832c982c769338dd73394347 Mon Sep 17 00:00:00 2001 From: Colin LeMahieu Date: Mon, 6 Nov 2023 16:41:13 +0000 Subject: [PATCH 1/3] Open/close the lmdb env once before starting the node. --- nano/nano_node/daemon.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nano/nano_node/daemon.cpp b/nano/nano_node/daemon.cpp index 6344fd8e21..1faafa86f1 100644 --- a/nano/nano_node/daemon.cpp +++ b/nano/nano_node/daemon.cpp @@ -127,6 +127,11 @@ void nano_daemon::daemon::run (std::filesystem::path const & data_path, nano::no config.node.peering_port = network_params.network.default_node_port; } + { + bool error{ false }; + nano::store::lmdb::env env{ error, data_path / "data.ldb", nano::store::lmdb::env::options::make ().set_config (config.node.lmdb_config).set_use_no_mem_init (true) }; + release_assert (!error); + } auto node (std::make_shared (io_ctx, data_path, config.node, opencl_work, flags)); if (!node->init_error ()) { From e730fd99fcce5fe597038a0be43af9e0e6e592c0 Mon Sep 17 00:00:00 2001 From: Colin LeMahieu Date: Mon, 6 Nov 2023 17:58:23 +0000 Subject: [PATCH 2/3] Initialize and reopen store --- nano/nano_node/daemon.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/nano/nano_node/daemon.cpp b/nano/nano_node/daemon.cpp index 1faafa86f1..aed3cb968a 100644 --- a/nano/nano_node/daemon.cpp +++ b/nano/nano_node/daemon.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -128,9 +129,7 @@ void nano_daemon::daemon::run (std::filesystem::path const & data_path, nano::no } { - bool error{ false }; - nano::store::lmdb::env env{ error, data_path / "data.ldb", nano::store::lmdb::env::options::make ().set_config (config.node.lmdb_config).set_use_no_mem_init (true) }; - release_assert (!error); + auto store = nano::make_store (logger, data_path, config.node.network_params.ledger); } auto node (std::make_shared (io_ctx, data_path, config.node, opencl_work, flags)); if (!node->init_error ()) From 8cc171c94fcf1675ef7b0cdf9cba2747b9099a4d Mon Sep 17 00:00:00 2001 From: Colin LeMahieu Date: Mon, 6 Nov 2023 18:00:26 +0000 Subject: [PATCH 3/3] Reopen ledger --- nano/nano_node/daemon.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nano/nano_node/daemon.cpp b/nano/nano_node/daemon.cpp index aed3cb968a..2a54c4824e 100644 --- a/nano/nano_node/daemon.cpp +++ b/nano/nano_node/daemon.cpp @@ -130,6 +130,8 @@ void nano_daemon::daemon::run (std::filesystem::path const & data_path, nano::no { auto store = nano::make_store (logger, data_path, config.node.network_params.ledger); + nano::stats stats; + nano::ledger ledger{ *store, stats, config.node.network_params.ledger }; } auto node (std::make_shared (io_ctx, data_path, config.node, opencl_work, flags)); if (!node->init_error ())