From cb8b0fbd34a83f3c89545890c313b0027c151816 Mon Sep 17 00:00:00 2001 From: oker Date: Wed, 30 Oct 2024 15:37:49 +0800 Subject: [PATCH] Revert "use only one celldb" This reverts commit 5f296f703d5c43bdaf795d4800c6168c8134d204. --- validator/db/rootdb.cpp | 23 +++++++++++------------ validator/db/rootdb.hpp | 2 +- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/validator/db/rootdb.cpp b/validator/db/rootdb.cpp index 025b4d285..1f3ae0ab5 100644 --- a/validator/db/rootdb.cpp +++ b/validator/db/rootdb.cpp @@ -264,17 +264,16 @@ void RootDb::get_block_state(ConstBlockHandle handle, td::Promisestate(), std::move(P)); - // int ranNum = GetDBRandomNum(); - // static int64_t ranCount = 0; - // ranCount++; - // if (ranCount % 1000 == 0) { - // LOG(ERROR) << "RootDb mailbox: " << this->get_name() << " " << this->get_actor_info_ptr()->mailbox().reader().calc_size() << ", ranNum: " << ranNum; - // ranCount = 0; - // } + int ranNum = GetDBRandomNum(); + static int64_t ranCount = 0; + ranCount++; + if (ranCount % 1000 == 0) { + LOG(ERROR) << "RootDb mailbox: " << this->get_name() << " " << this->get_actor_info_ptr()->mailbox().reader().calc_size() << ", ranNum: " << ranNum; + ranCount = 0; + } - // td::actor::send_closure(cell_db_read_[ranNum], &CellDb::load_cell, handle->state(), std::move(P)); + td::actor::send_closure(cell_db_read_[ranNum], &CellDb::load_cell, handle->state(), std::move(P)); } else { promise.set_error(td::Status::Error(ErrorCode::notready, "state not in db")); } @@ -432,9 +431,9 @@ void RootDb::start_up() { auto rock_db = std::make_shared(td::RocksDb::open(path, std::move(db_options)).move_as_ok()); cell_db_ = td::actor::create_actor("celldb", actor_id(this), path, opts_, rock_db); - // for (int i = 0; i < THREAD_COUNTS; i++){ - // cell_db_read_[i] = td::actor::create_actor("celldb", actor_id(this), path, opts_, rock_db); - // } + for (int i = 0; i < THREAD_COUNTS; i++){ + cell_db_read_[i] = td::actor::create_actor("celldb", actor_id(this), path, opts_, rock_db); + } // cell_db_ = td::actor::create_actor("celldb", actor_id(this), root_path_ + "/celldb/", opts_); state_db_ = td::actor::create_actor("statedb", actor_id(this), root_path_ + "/state/"); static_files_db_ = td::actor::create_actor("staticfilesdb", actor_id(this), root_path_ + "/static/"); diff --git a/validator/db/rootdb.hpp b/validator/db/rootdb.hpp index 677bbcebf..5189b7e1d 100644 --- a/validator/db/rootdb.hpp +++ b/validator/db/rootdb.hpp @@ -145,7 +145,7 @@ class RootDb : public Db { td::Ref opts_; td::actor::ActorOwn cell_db_; - // td::actor::ActorOwn cell_db_read_[THREAD_COUNTS]; + td::actor::ActorOwn cell_db_read_[THREAD_COUNTS]; td::actor::ActorOwn state_db_; td::actor::ActorOwn static_files_db_; td::actor::ActorOwn archive_db_;