0. change(db): Use Ribbon filters for database index lookups (#4040)
* Use Ribbon filters for RocksDB lookups Ribbon filters are like Bloom filters, but more efficient. * Fix an outdated comment
This commit is contained in:
parent
1a4f8f6573
commit
7f351ab9af
|
@ -285,10 +285,17 @@ impl DiskDb {
|
|||
/// Returns the database options for the finalized state database.
|
||||
fn options() -> rocksdb::Options {
|
||||
let mut opts = rocksdb::Options::default();
|
||||
let mut block_based_opts = rocksdb::BlockBasedOptions::default();
|
||||
|
||||
opts.create_if_missing(true);
|
||||
opts.create_missing_column_families(true);
|
||||
|
||||
// Use the recommended Ribbon filter setting for all column families.
|
||||
// (Ribbon filters are faster than Bloom filters in Zebra, as of April 2022.)
|
||||
//
|
||||
// (They aren't needed for single-valued column families, but they don't hurt either.)
|
||||
block_based_opts.set_ribbon_filter(9.9);
|
||||
|
||||
let open_file_limit = DiskDb::increase_open_file_limit();
|
||||
let db_file_limit = DiskDb::get_db_open_file_limit(open_file_limit);
|
||||
|
||||
|
@ -300,6 +307,9 @@ impl DiskDb {
|
|||
|
||||
opts.set_max_open_files(db_file_limit);
|
||||
|
||||
// Set the block-based options
|
||||
opts.set_block_based_table_factory(&block_based_opts);
|
||||
|
||||
opts
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue