From 291300ece8d5d94b6589d28d4d882bbace39443f Mon Sep 17 00:00:00 2001 From: hackingthekernel <108101062+hackingthekernel@users.noreply.github.com> Date: Thu, 16 Mar 2023 16:57:03 -0700 Subject: [PATCH] add c-api for allowing FIFO compaction (#11156) Summary: Addressing issue https://github.com/facebook/rocksdb/issues/11079 Pull Request resolved: https://github.com/facebook/rocksdb/pull/11156 Reviewed By: pdillinger Differential Revision: D42869964 Pulled By: ajkr fbshipit-source-id: 58214901d4e072c568d4c5cf0944a0b1c60de897 --- db/c.cc | 10 ++++++++++ include/rocksdb/c.h | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/db/c.cc b/db/c.cc index 61979df58..ed382d4e4 100644 --- a/db/c.cc +++ b/db/c.cc @@ -5139,6 +5139,16 @@ rocksdb_fifo_compaction_options_t* rocksdb_fifo_compaction_options_create() { return result; } +void rocksdb_fifo_compaction_options_set_allow_compaction( + rocksdb_fifo_compaction_options_t* fifo_opts, unsigned char allow_compaction) { + fifo_opts->rep.allow_compaction = allow_compaction; +} + +unsigned char rocksdb_fifo_compaction_options_get_allow_compaction( + rocksdb_fifo_compaction_options_t* fifo_opts) { + return fifo_opts->rep.allow_compaction; +} + void rocksdb_fifo_compaction_options_set_max_table_files_size( rocksdb_fifo_compaction_options_t* fifo_opts, uint64_t size) { fifo_opts->rep.max_table_files_size = size; diff --git a/include/rocksdb/c.h b/include/rocksdb/c.h index cdc0ff2f2..1ba7fabef 100644 --- a/include/rocksdb/c.h +++ b/include/rocksdb/c.h @@ -2234,6 +2234,12 @@ extern ROCKSDB_LIBRARY_API void rocksdb_universal_compaction_options_destroy( extern ROCKSDB_LIBRARY_API rocksdb_fifo_compaction_options_t* rocksdb_fifo_compaction_options_create(void); extern ROCKSDB_LIBRARY_API void +rocksdb_fifo_compaction_options_set_allow_compaction( + rocksdb_fifo_compaction_options_t* fifo_opts, unsigned char allow_compaction); +extern ROCKSDB_LIBRARY_API unsigned char +rocksdb_fifo_compaction_options_get_allow_compaction( + rocksdb_fifo_compaction_options_t* fifo_opts); +extern ROCKSDB_LIBRARY_API void rocksdb_fifo_compaction_options_set_max_table_files_size( rocksdb_fifo_compaction_options_t* fifo_opts, uint64_t size); extern ROCKSDB_LIBRARY_API uint64_t