Skip to content

Commit

Permalink
Revert "use only one celldb"
Browse files Browse the repository at this point in the history
This reverts commit 5f296f7.
  • Loading branch information
oker authored and oker committed Oct 30, 2024
1 parent 1c05fae commit cb8b0fb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
23 changes: 11 additions & 12 deletions validator/db/rootdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,17 +264,16 @@ void RootDb::get_block_state(ConstBlockHandle handle, td::Promise<td::Ref<ShardS
promise.set_value(S.move_as_ok());
}
});
td::actor::send_closure(cell_db_, &CellDb::load_cell, handle->state(), 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"));
}
Expand Down Expand Up @@ -432,9 +431,9 @@ void RootDb::start_up() {
auto rock_db = std::make_shared<td::RocksDb>(td::RocksDb::open(path, std::move(db_options)).move_as_ok());

cell_db_ = td::actor::create_actor<CellDb>("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>("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>("celldb", actor_id(this), path, opts_, rock_db);
}
// cell_db_ = td::actor::create_actor<CellDb>("celldb", actor_id(this), root_path_ + "/celldb/", opts_);
state_db_ = td::actor::create_actor<StateDb>("statedb", actor_id(this), root_path_ + "/state/");
static_files_db_ = td::actor::create_actor<StaticFilesDb>("staticfilesdb", actor_id(this), root_path_ + "/static/");
Expand Down
2 changes: 1 addition & 1 deletion validator/db/rootdb.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class RootDb : public Db {
td::Ref<ValidatorManagerOptions> opts_;

td::actor::ActorOwn<CellDb> cell_db_;
// td::actor::ActorOwn<CellDb> cell_db_read_[THREAD_COUNTS];
td::actor::ActorOwn<CellDb> cell_db_read_[THREAD_COUNTS];
td::actor::ActorOwn<StateDb> state_db_;
td::actor::ActorOwn<StaticFilesDb> static_files_db_;
td::actor::ActorOwn<ArchiveManager> archive_db_;
Expand Down

0 comments on commit cb8b0fb

Please sign in to comment.