Skip to content

Commit

Permalink
feat(config): add the partition_filters option to disable the parti…
Browse files Browse the repository at this point in the history
…tioned filters (#2688)
  • Loading branch information
fukua95 authored Dec 6, 2024
1 parent d3bca42 commit 698c3d4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions kvrocks.conf
Original file line number Diff line number Diff line change
Expand Up @@ -1016,6 +1016,11 @@ rocksdb.write_options.memtable_insert_hint_per_batch no
# Default: yes
rocksdb.rate_limiter_auto_tuned yes

# If enabled, rocksdb will use partitioned full filters for each SST file.
#
# Default: yes
rocksdb.partition_filters yes

# Enable this option will schedule the deletion of obsolete files in a background thread
# on iterator destruction. It can reduce the latency if there are many files to be removed.
# see https://github.com/facebook/rocksdb/wiki/IO#avoid-blocking-io
Expand Down
1 change: 1 addition & 0 deletions src/config/config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ Config::Config() {
{"rocksdb.max_background_jobs", false, new IntField(&rocks_db.max_background_jobs, 4, 0, 32)},
{"rocksdb.rate_limiter_auto_tuned", true, new YesNoField(&rocks_db.rate_limiter_auto_tuned, true)},
{"rocksdb.avoid_unnecessary_blocking_io", true, new YesNoField(&rocks_db.avoid_unnecessary_blocking_io, true)},
{"rocksdb.partition_filters", true, new YesNoField(&rocks_db.partition_filters, true)},

/* rocksdb write options */
{"rocksdb.write_options.sync", true, new YesNoField(&rocks_db.write_options.sync, false)},
Expand Down
1 change: 1 addition & 0 deletions src/config/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ struct Config {
int max_background_jobs;
bool rate_limiter_auto_tuned;
bool avoid_unnecessary_blocking_io = true;
bool partition_filters;

struct WriteOptions {
bool sync;
Expand Down
2 changes: 1 addition & 1 deletion src/storage/storage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ rocksdb::BlockBasedTableOptions Storage::InitTableOptions() {
table_options.format_version = 5;
table_options.index_type = rocksdb::BlockBasedTableOptions::IndexType::kTwoLevelIndexSearch;
table_options.filter_policy.reset(rocksdb::NewBloomFilterPolicy(10, false));
table_options.partition_filters = true;
table_options.partition_filters = config_->rocks_db.partition_filters;
table_options.optimize_filters_for_memory = true;
table_options.metadata_block_size = 4096;
table_options.data_block_index_type = rocksdb::BlockBasedTableOptions::DataBlockIndexType::kDataBlockBinaryAndHash;
Expand Down

0 comments on commit 698c3d4

Please sign in to comment.