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

2 level index and filter for state ttl >= 30 days

This commit is contained in:
Marat S 2025-02-28 23:57:45 +00:00
parent 34f80e8f1b
commit 7f1ee5e9e1
3 changed files with 9 additions and 0 deletions

View file

@ -78,6 +78,12 @@ Result<RocksDb> RocksDb::open(std::string path, RocksDbOptions options) {
}
if (options.enable_bloom_filter) {
table_options.filter_policy.reset(rocksdb::NewBloomFilterPolicy(10, false));
if (options.two_level_index_and_filter) {
table_options.index_type = rocksdb::BlockBasedTableOptions::IndexType::kTwoLevelIndexSearch;
table_options.partition_filters = true;
table_options.cache_index_and_filter_blocks = true;
table_options.pin_l0_filter_and_index_blocks_in_cache = true;
}
}
db_options.table_factory.reset(rocksdb::NewBlockBasedTableFactory(table_options));

View file

@ -64,6 +64,7 @@ struct RocksDbOptions {
bool use_direct_reads = false;
bool no_block_cache = false;
bool enable_bloom_filter = false;
bool two_level_index_and_filter = false;
};
class RocksDb : public KeyValue {

View file

@ -102,6 +102,8 @@ void CellDbIn::start_up() {
}
db_options.use_direct_reads = opts_->get_celldb_direct_io();
db_options.enable_bloom_filter = !opts_->get_celldb_disable_bloom_filter();
db_options.two_level_index_and_filter = db_options.enable_bloom_filter
&& opts_->state_ttl() >= 60 * 60 * 24 * 30; // 30 days
if (opts_->get_celldb_in_memory()) {
td::RocksDbOptions read_db_options;