Add missing parameter in C API (#11542)

Summary:
The class `NewCompactOnDeletionCollectorFactory` exposes the parameter `delete_ratio`.

The C API `rocksdb_options_add_compact_on_deletion_collector_factory` does not allow a user to pass a delete ration to be passed down the the C++ class bellow.

The class has default value for the delete ratio which makes it pass the compilation and the tests.

closes https://github.com/facebook/rocksdb/issues/11541

Pull Request resolved: https://github.com/facebook/rocksdb/pull/11542

Reviewed By: ajkr

Differential Revision: D46770908

Pulled By: cbi42

fbshipit-source-id: 7b5162fe459896052e392e2d85a8f6c01db3b464
oxigraph-main
Alexandre Lavigne 1 year ago committed by Facebook GitHub Bot
parent 022d89549d
commit 2926e0718c
  1. 7
      db/c.cc
  2. 2
      db/c_test.c
  3. 3
      include/rocksdb/c.h
  4. 1
      unreleased_history/public_api_changes/add_new_compaction_parameter.md

@ -3881,10 +3881,11 @@ void rocksdb_options_set_row_cache(rocksdb_options_t* opt,
} }
void rocksdb_options_add_compact_on_deletion_collector_factory( void rocksdb_options_add_compact_on_deletion_collector_factory(
rocksdb_options_t* opt, size_t window_size, size_t num_dels_trigger) { rocksdb_options_t* opt, size_t window_size, size_t num_dels_trigger,
double deletion_ratio) {
std::shared_ptr<ROCKSDB_NAMESPACE::TablePropertiesCollectorFactory> std::shared_ptr<ROCKSDB_NAMESPACE::TablePropertiesCollectorFactory>
compact_on_del = compact_on_del = NewCompactOnDeletionCollectorFactory(
NewCompactOnDeletionCollectorFactory(window_size, num_dels_trigger); window_size, num_dels_trigger, deletion_ratio);
opt->rep.table_properties_collector_factories.emplace_back(compact_on_del); opt->rep.table_properties_collector_factories.emplace_back(compact_on_del);
} }

@ -720,7 +720,7 @@ int main(int argc, char** argv) {
rocksdb_compactoptions_set_exclusive_manual_compaction(coptions, 1); rocksdb_compactoptions_set_exclusive_manual_compaction(coptions, 1);
rocksdb_options_add_compact_on_deletion_collector_factory(options, 10000, rocksdb_options_add_compact_on_deletion_collector_factory(options, 10000,
10001); 10001, 0.0);
StartPhase("destroy"); StartPhase("destroy");
rocksdb_destroy_db(options, dbname, &err); rocksdb_destroy_db(options, dbname, &err);

@ -1615,7 +1615,8 @@ extern ROCKSDB_LIBRARY_API void rocksdb_options_set_row_cache(
extern ROCKSDB_LIBRARY_API void extern ROCKSDB_LIBRARY_API void
rocksdb_options_add_compact_on_deletion_collector_factory( rocksdb_options_add_compact_on_deletion_collector_factory(
rocksdb_options_t*, size_t window_size, size_t num_dels_trigger); rocksdb_options_t*, size_t window_size, size_t num_dels_trigger,
double deletion_ratio);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_manual_wal_flush( extern ROCKSDB_LIBRARY_API void rocksdb_options_set_manual_wal_flush(
rocksdb_options_t* opt, unsigned char); rocksdb_options_t* opt, unsigned char);
extern ROCKSDB_LIBRARY_API unsigned char rocksdb_options_get_manual_wal_flush( extern ROCKSDB_LIBRARY_API unsigned char rocksdb_options_get_manual_wal_flush(

@ -0,0 +1 @@
Add parameter `deletion_ratio` to C API `rocksdb_options_add_compact_on_deletion_collector_factory`.
Loading…
Cancel
Save