From c114b7d537f8fa69565a105496aff20e0841ff61 Mon Sep 17 00:00:00 2001 From: Matus Kysel Date: Tue, 9 May 2023 13:56:19 +0200 Subject: [PATCH] chore: disable snapshots during db rebuild --- libraries/core_libs/node/src/node.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libraries/core_libs/node/src/node.cpp b/libraries/core_libs/node/src/node.cpp index 2e6002d89e..33d89035a6 100644 --- a/libraries/core_libs/node/src/node.cpp +++ b/libraries/core_libs/node/src/node.cpp @@ -63,7 +63,9 @@ void FullNode::init() { conf_.db_config.db_max_open_files, conf_.db_config.db_max_snapshots, conf_.db_config.db_revert_to_period, node_addr, true); } - db_ = std::make_shared(conf_.db_path, conf_.db_config.db_snapshot_each_n_pbft_block, + db_ = std::make_shared(conf_.db_path, + // Snapshots should be disabled while rebuilding + conf_.db_config.rebuild_db ? 0 : conf_.db_config.db_snapshot_each_n_pbft_block, conf_.db_config.db_max_open_files, conf_.db_config.db_max_snapshots, conf_.db_config.db_revert_to_period, node_addr, false); @@ -74,7 +76,8 @@ void FullNode::init() { old_db_ = std::make_shared(conf_.db_path, conf_.db_config.db_snapshot_each_n_pbft_block, conf_.db_config.db_max_open_files, conf_.db_config.db_max_snapshots, conf_.db_config.db_revert_to_period, node_addr, true); - db_ = std::make_shared(conf_.db_path, conf_.db_config.db_snapshot_each_n_pbft_block, + db_ = std::make_shared(conf_.db_path, + 0, // Snapshots should be disabled while rebuilding conf_.db_config.db_max_open_files, conf_.db_config.db_max_snapshots, conf_.db_config.db_revert_to_period, node_addr); } else if (db_->hasMinorVersionChanged()) {