mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Add option --celldb-cache-size (#988)
Co-authored-by: SpyCheese <mikle98@yandex.ru>
This commit is contained in:
parent
136b99b8d1
commit
1433f23eff
9 changed files with 62 additions and 19 deletions
|
@ -832,7 +832,10 @@ void ArchiveManager::start_up() {
|
|||
if (!opts_->get_disable_rocksdb_stats()) {
|
||||
statistics_.init();
|
||||
}
|
||||
index_ = std::make_shared<td::RocksDb>(td::RocksDb::open(db_root_ + "/files/globalindex", statistics_.rocksdb_statistics).move_as_ok());
|
||||
td::RocksDbOptions db_options;
|
||||
db_options.statistics = statistics_.rocksdb_statistics;
|
||||
index_ = std::make_shared<td::RocksDb>(
|
||||
td::RocksDb::open(db_root_ + "/files/globalindex", std::move(db_options)).move_as_ok());
|
||||
std::string value;
|
||||
auto v = index_->get(create_serialize_tl_object<ton_api::db_files_index_key>().as_slice(), value);
|
||||
v.ensure();
|
||||
|
|
|
@ -554,7 +554,9 @@ void ArchiveSlice::get_archive_id(BlockSeqno masterchain_seqno, td::Promise<td::
|
|||
void ArchiveSlice::before_query() {
|
||||
if (status_ == st_closed) {
|
||||
LOG(DEBUG) << "Opening archive slice " << db_path_;
|
||||
kv_ = std::make_unique<td::RocksDb>(td::RocksDb::open(db_path_, statistics_.rocksdb_statistics).move_as_ok());
|
||||
td::RocksDbOptions db_options;
|
||||
db_options.statistics = statistics_.rocksdb_statistics;
|
||||
kv_ = std::make_unique<td::RocksDb>(td::RocksDb::open(db_path_, std::move(db_options)).move_as_ok());
|
||||
std::string value;
|
||||
auto R2 = kv_->get("status", value);
|
||||
R2.ensure();
|
||||
|
|
|
@ -88,7 +88,13 @@ void CellDbIn::start_up() {
|
|||
statistics_ = td::RocksDb::create_statistics();
|
||||
statistics_flush_at_ = td::Timestamp::in(60.0);
|
||||
}
|
||||
cell_db_ = std::make_shared<td::RocksDb>(td::RocksDb::open(path_, statistics_).move_as_ok());
|
||||
td::RocksDbOptions db_options;
|
||||
db_options.statistics = statistics_;
|
||||
if (opts_->get_celldb_cache_size()) {
|
||||
db_options.block_cache_size = opts_->get_celldb_cache_size().value();
|
||||
LOG(WARNING) << "Set CellDb block cache size to " << td::format::as_size(db_options.block_cache_size);
|
||||
}
|
||||
cell_db_ = std::make_shared<td::RocksDb>(td::RocksDb::open(path_, std::move(db_options)).move_as_ok());
|
||||
|
||||
|
||||
boc_ = vm::DynamicBagOfCellsDb::create();
|
||||
|
|
|
@ -129,6 +129,9 @@ struct ValidatorManagerOptionsImpl : public ValidatorManagerOptions {
|
|||
bool nonfinal_ls_queries_enabled() const override {
|
||||
return nonfinal_ls_queries_enabled_;
|
||||
}
|
||||
td::optional<td::uint64> get_celldb_cache_size() const override {
|
||||
return celldb_cache_size_;
|
||||
}
|
||||
|
||||
void set_zero_block_id(BlockIdExt block_id) override {
|
||||
zero_block_id_ = block_id;
|
||||
|
@ -197,6 +200,9 @@ struct ValidatorManagerOptionsImpl : public ValidatorManagerOptions {
|
|||
void set_nonfinal_ls_queries_enabled(bool value) override {
|
||||
nonfinal_ls_queries_enabled_ = value;
|
||||
}
|
||||
void set_celldb_cache_size(td::uint64 value) override {
|
||||
celldb_cache_size_ = value;
|
||||
}
|
||||
|
||||
ValidatorManagerOptionsImpl *make_copy() const override {
|
||||
return new ValidatorManagerOptionsImpl(*this);
|
||||
|
@ -244,6 +250,7 @@ struct ValidatorManagerOptionsImpl : public ValidatorManagerOptions {
|
|||
double archive_preload_period_ = 0.0;
|
||||
bool disable_rocksdb_stats_;
|
||||
bool nonfinal_ls_queries_enabled_ = false;
|
||||
td::optional<td::uint64> celldb_cache_size_;
|
||||
};
|
||||
|
||||
} // namespace validator
|
||||
|
|
|
@ -86,6 +86,7 @@ struct ValidatorManagerOptions : public td::CntObject {
|
|||
virtual double get_archive_preload_period() const = 0;
|
||||
virtual bool get_disable_rocksdb_stats() const = 0;
|
||||
virtual bool nonfinal_ls_queries_enabled() const = 0;
|
||||
virtual td::optional<td::uint64> get_celldb_cache_size() const = 0;
|
||||
|
||||
virtual void set_zero_block_id(BlockIdExt block_id) = 0;
|
||||
virtual void set_init_block_id(BlockIdExt block_id) = 0;
|
||||
|
@ -110,6 +111,7 @@ struct ValidatorManagerOptions : public td::CntObject {
|
|||
virtual void set_archive_preload_period(double value) = 0;
|
||||
virtual void set_disable_rocksdb_stats(bool value) = 0;
|
||||
virtual void set_nonfinal_ls_queries_enabled(bool value) = 0;
|
||||
virtual void set_celldb_cache_size(td::uint64 value) = 0;
|
||||
|
||||
static td::Ref<ValidatorManagerOptions> create(
|
||||
BlockIdExt zero_block_id, BlockIdExt init_block_id,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue