summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMark Nelson <mnelson@redhat.com>2022-11-28 17:32:16 +0100
committerGitHub <noreply@github.com>2022-11-28 17:32:16 +0100
commit85e2757e85eb5939a202e878b9a8ca694d7acc29 (patch)
tree9b223e3cb767ec0e70607e2c7f4d1849e5e12f6d /src
parentMerge pull request #48875 from yuvalif/wip-yuval-fix-58014 (diff)
parentkv/RocksDBStore: Add CompactOnDeletion support (diff)
downloadceph-85e2757e85eb5939a202e878b9a8ca694d7acc29.tar.xz
ceph-85e2757e85eb5939a202e878b9a8ca694d7acc29.zip
Merge pull request #47221 from markhpc/wip-faster-rocksdb
[WIP] kv/RocksDBStore: Improved RocksDB Settings and Tombstone behavior
Diffstat (limited to 'src')
-rw-r--r--src/common/options/global.yaml.in32
-rw-r--r--src/kv/RocksDBStore.cc9
2 files changed, 40 insertions, 1 deletions
diff --git a/src/common/options/global.yaml.in b/src/common/options/global.yaml.in
index bfab547af22..08d388c4e05 100644
--- a/src/common/options/global.yaml.in
+++ b/src/common/options/global.yaml.in
@@ -3548,6 +3548,36 @@ options:
# osd_*_priority determines the ratio of available io between client and
# recovery. Each option may be set between
# 1..63.
+- name: rocksdb_cf_compact_on_deletion
+ type: bool
+ level: dev
+ desc: Compact the column family when a certain number of tombstones are observed within a given window.
+ long_desc: 'This setting instructs RocksDB to compact a column family when a certain
+ number of tombstones are observed during iteration within a certain sliding window.
+ For instance if rocksdb_cf_compact_on_deletion_sliding_window is 8192 and
+ rocksdb_cf_compact_on_deletion_trigger is 4096, then once 4096 tombstones are
+ observed after iteration over 8192 entries, the column family will be compacted.'
+ default: true
+ with_legacy: true
+ see_also:
+ - rocksdb_cf_compact_on_deletion_sliding_window
+ - rocksdb_cf_compact_on_deletion_trigger
+- name: rocksdb_cf_compact_on_deletion_sliding_window
+ type: int
+ level: dev
+ desc: The sliding window to use when rocksdb_cf_compact_on_deletion is enabled.
+ default: 32768
+ with_legacy: true
+ see_also:
+ - rocksdb_cf_compact_on_deletion
+- name: rocksdb_cf_compact_on_deletion_trigger
+ type: int
+ level: dev
+ desc: The trigger to use when rocksdb_cf_compact_on_deletion is enabled.
+ default: 16384
+ with_legacy: true
+ see_also:
+ - rocksdb_cf_compact_on_deletion
- name: osd_client_op_priority
type: uint
level: advanced
@@ -4911,7 +4941,7 @@ options:
type: str
level: advanced
desc: Full set of rocksdb settings to override
- default: compression=kNoCompression,max_write_buffer_number=4,min_write_buffer_number_to_merge=1,recycle_log_file_num=4,write_buffer_size=268435456,writable_file_max_buffer_size=0,compaction_readahead_size=2097152,max_background_compactions=2,max_total_wal_size=1073741824
+ default: compression=kNoCompression,max_write_buffer_number=128,min_write_buffer_number_to_merge=16,compaction_style=kCompactionStyleLevel,write_buffer_size=8388608,max_background_jobs=4,level0_file_num_compaction_trigger=8,max_bytes_for_level_base=1073741824,max_bytes_for_level_multiplier=8,compaction_readahead_size=2MB,max_total_wal_size=1073741824,writable_file_max_buffer_size=0,ttl=21600
with_legacy: true
- name: bluestore_rocksdb_options_annex
type: str
diff --git a/src/kv/RocksDBStore.cc b/src/kv/RocksDBStore.cc
index be032b4fa86..a3ecf3a5a1f 100644
--- a/src/kv/RocksDBStore.cc
+++ b/src/kv/RocksDBStore.cc
@@ -18,6 +18,7 @@
#include "rocksdb/cache.h"
#include "rocksdb/filter_policy.h"
#include "rocksdb/utilities/convenience.h"
+#include "rocksdb/utilities/table_properties_collectors.h"
#include "rocksdb/merge_operator.h"
#include "common/perf_counters.h"
@@ -934,6 +935,14 @@ int RocksDBStore::update_column_family_options(const std::string& base_name,
return r;
}
}
+
+ // Set Compact on Deletion Factory
+ if (cct->_conf->rocksdb_cf_compact_on_deletion) {
+ size_t sliding_window = cct->_conf->rocksdb_cf_compact_on_deletion_sliding_window;
+ size_t trigger = cct->_conf->rocksdb_cf_compact_on_deletion_trigger;
+ cf_opt->table_properties_collector_factories.emplace_back(
+ rocksdb::NewCompactOnDeletionCollectorFactory(sliding_window, trigger));
+ }
return 0;
}