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
  • Loading branch information
fukua95 committed Dec 6, 2024
1 parent d3bca42 commit 27b8738
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
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
5 changes: 3 additions & 2 deletions src/config/config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ Status SetRocksdbCompression(Server *srv, const rocksdb::CompressionType compres
for (size_t i = compression_start_level; i < KVROCKS_MAX_LSM_LEVEL; i++) {
compression_per_level_builder.emplace_back(compression_option);
}
const std::string compression_per_level = util::StringJoin(
compression_per_level_builder, [](const auto &s) -> decltype(auto) { return s; }, ":");
const std::string compression_per_level =
util::StringJoin(compression_per_level_builder, [](const auto &s) -> decltype(auto) { return s; }, ":");
return srv->storage->SetOptionForAllColumnFamilies("compression_per_level", compression_per_level);
};

Expand Down 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 27b8738

Please sign in to comment.