From 2926e0718c479c5852f3bca7a4ff8c48b69afbbd Mon Sep 17 00:00:00 2001 From: Alexandre Lavigne Date: Tue, 20 Jun 2023 13:18:04 -0700 Subject: [PATCH] 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 --- db/c.cc | 7 ++++--- db/c_test.c | 2 +- include/rocksdb/c.h | 3 ++- .../public_api_changes/add_new_compaction_parameter.md | 1 + 4 files changed, 8 insertions(+), 5 deletions(-) create mode 100644 unreleased_history/public_api_changes/add_new_compaction_parameter.md diff --git a/db/c.cc b/db/c.cc index dde8f69fb..2a3d7b3bc 100644 --- a/db/c.cc +++ b/db/c.cc @@ -3881,10 +3881,11 @@ void rocksdb_options_set_row_cache(rocksdb_options_t* opt, } 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 - compact_on_del = - NewCompactOnDeletionCollectorFactory(window_size, num_dels_trigger); + compact_on_del = NewCompactOnDeletionCollectorFactory( + window_size, num_dels_trigger, deletion_ratio); opt->rep.table_properties_collector_factories.emplace_back(compact_on_del); } diff --git a/db/c_test.c b/db/c_test.c index 57877c06b..da3e1c66c 100644 --- a/db/c_test.c +++ b/db/c_test.c @@ -720,7 +720,7 @@ int main(int argc, char** argv) { rocksdb_compactoptions_set_exclusive_manual_compaction(coptions, 1); rocksdb_options_add_compact_on_deletion_collector_factory(options, 10000, - 10001); + 10001, 0.0); StartPhase("destroy"); rocksdb_destroy_db(options, dbname, &err); diff --git a/include/rocksdb/c.h b/include/rocksdb/c.h index 6e0ad08c8..159d58466 100644 --- a/include/rocksdb/c.h +++ b/include/rocksdb/c.h @@ -1615,7 +1615,8 @@ extern ROCKSDB_LIBRARY_API void rocksdb_options_set_row_cache( extern ROCKSDB_LIBRARY_API void 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( rocksdb_options_t* opt, unsigned char); extern ROCKSDB_LIBRARY_API unsigned char rocksdb_options_get_manual_wal_flush( diff --git a/unreleased_history/public_api_changes/add_new_compaction_parameter.md b/unreleased_history/public_api_changes/add_new_compaction_parameter.md new file mode 100644 index 000000000..4278ff4a6 --- /dev/null +++ b/unreleased_history/public_api_changes/add_new_compaction_parameter.md @@ -0,0 +1 @@ +Add parameter `deletion_ratio` to C API `rocksdb_options_add_compact_on_deletion_collector_factory`. \ No newline at end of file