]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
kv/RocksDBStore: Configure compact-on-deletion for all CFs 57403/head
authorJoshua Baergen <jbaergen@digitalocean.com>
Tue, 20 Feb 2024 21:04:19 +0000 (14:04 -0700)
committerKonstantin Shalygin <k0ste@k0ste.ru>
Tue, 9 Jul 2024 14:06:08 +0000 (21:06 +0700)
update_column_family_options() is called only for non-default CFs,
whereas load_rocksdb_options() sets options for all CFs, including
default. This isn't really a problem for new installs, where the default
CF isn't used for very much, but for upgrades where resharding has not
yet happened, the bulk of rocksdb data is still in the default CF and so
it's important that it also gets compact-on-deletion configured, if
desired.

Fixes: https://tracker.ceph.com/issues/64511
Signed-off-by: Joshua Baergen <jbaergen@digitalocean.com>
(cherry picked from commit e31c7249b3984d40fd0c2abfef1d2402112ed655)

src/kv/RocksDBStore.cc

index fd2b26f3803e2f5ae5c08098a50aa4e92ee71ebd..28217118609ecaf2a3cdcd5b1e2ef077c299c44b 100644 (file)
@@ -585,6 +585,14 @@ int RocksDBStore::load_rocksdb_options(bool create_if_missing, rocksdb::Options&
   if (cct->_conf.get_val<Option::size_t>("rocksdb_metadata_block_size") > 0)
     bbt_opts.metadata_block_size = cct->_conf.get_val<Option::size_t>("rocksdb_metadata_block_size");
 
+  // 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;
+    opt.table_properties_collector_factories.emplace_back(
+        rocksdb::NewCompactOnDeletionCollectorFactory(sliding_window, trigger));
+  }
+
   opt.table_factory.reset(rocksdb::NewBlockBasedTableFactory(bbt_opts));
   dout(10) << __func__ << " block size " << cct->_conf->rocksdb_block_size
            << ", block_cache size " << byte_u_t(block_cache_size)
@@ -934,14 +942,6 @@ 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;
 }