1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

Add --celldb-direct-io and --celldb-preload-all (#993)

Co-authored-by: SpyCheese <mikle98@yandex.ru>
This commit is contained in:
EmelyanenkoK 2024-05-14 16:05:29 +03:00 committed by GitHub
parent 816dd9cf2d
commit 561f342639
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 108 additions and 17 deletions

View file

@ -1372,6 +1372,8 @@ td::Status ValidatorEngine::load_global_config() {
if (celldb_cache_size_) {
validator_options_.write().set_celldb_cache_size(celldb_cache_size_.value());
}
validator_options_.write().set_celldb_direct_io(celldb_direct_io_);
validator_options_.write().set_celldb_preload_all(celldb_preload_all_);
if (catchain_max_block_delay_) {
validator_options_.write().set_catchain_max_block_delay(catchain_max_block_delay_.value());
}
@ -3984,6 +3986,14 @@ int main(int argc, char *argv[]) {
acts.push_back([&x, v]() { td::actor::send_closure(x, &ValidatorEngine::set_celldb_cache_size, v); });
return td::Status::OK();
});
p.add_option('\0', "celldb-direct-io", "enable direct I/O mode for RocksDb in CellDb", [&]() {
acts.push_back([&x]() { td::actor::send_closure(x, &ValidatorEngine::set_celldb_direct_io); });
});
p.add_option(
'\0', "celldb-preload-all",
"preload all cells from CellDb on startup (recommended to use with big enough celldb-cache-size and "
"celldb-direct-io)",
[&]() { acts.push_back([&x]() { td::actor::send_closure(x, &ValidatorEngine::set_celldb_preload_all); }); });
p.add_checked_option(
'\0', "catchain-max-block-delay", "delay before creating a new catchain block, in seconds (default: 0.5)",
[&](td::Slice s) -> td::Status {

View file

@ -210,6 +210,8 @@ class ValidatorEngine : public td::actor::Actor {
bool disable_rocksdb_stats_ = false;
bool nonfinal_ls_queries_enabled_ = false;
td::optional<td::uint64> celldb_cache_size_;
bool celldb_direct_io_ = false;
bool celldb_preload_all_ = false;
td::optional<double> catchain_max_block_delay_;
bool read_config_ = false;
bool started_keyring_ = false;
@ -286,6 +288,12 @@ class ValidatorEngine : public td::actor::Actor {
void set_celldb_cache_size(td::uint64 value) {
celldb_cache_size_ = value;
}
void set_celldb_direct_io() {
celldb_direct_io_ = true;
}
void set_celldb_preload_all() {
celldb_preload_all_ = true;
}
void set_catchain_max_block_delay(double value) {
catchain_max_block_delay_ = value;
}