From bfdc91017c0667e05cd2f2b49337446e0fb5c1b1 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Tue, 27 Jun 2023 12:30:28 -0700 Subject: [PATCH] C-API: Expose remaining PlainTableOptions (#11442) Summary: Expose the remaining fields of PlainTableOptions as arguments to `rocksdb_options_set_plain_table_factory` in the C API. Pull Request resolved: https://github.com/facebook/rocksdb/pull/11442 Reviewed By: ajkr Differential Revision: D46786962 Pulled By: hx235 fbshipit-source-id: 8862083dde332bfecc5ff02f9375776ad35c11f5 --- db/c.cc | 15 ++++++++++----- db/c_test.c | 3 ++- include/rocksdb/c.h | 3 ++- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/db/c.cc b/db/c.cc index 93df6da6a..88527f99c 100644 --- a/db/c.cc +++ b/db/c.cc @@ -3770,16 +3770,21 @@ void rocksdb_options_set_hash_link_list_rep(rocksdb_options_t* opt, ROCKSDB_NAMESPACE::NewHashLinkListRepFactory(bucket_count)); } -void rocksdb_options_set_plain_table_factory(rocksdb_options_t* opt, - uint32_t user_key_len, - int bloom_bits_per_key, - double hash_table_ratio, - size_t index_sparseness) { +void rocksdb_options_set_plain_table_factory( + rocksdb_options_t* opt, uint32_t user_key_len, int bloom_bits_per_key, + double hash_table_ratio, size_t index_sparseness, size_t huge_page_tlb_size, + char encoding_type, unsigned char full_scan_mode, + unsigned char store_index_in_file) { ROCKSDB_NAMESPACE::PlainTableOptions options; options.user_key_len = user_key_len; options.bloom_bits_per_key = bloom_bits_per_key; options.hash_table_ratio = hash_table_ratio; options.index_sparseness = index_sparseness; + options.huge_page_tlb_size = huge_page_tlb_size; + options.encoding_type = + static_cast(encoding_type); + options.full_scan_mode = full_scan_mode; + options.store_index_in_file = store_index_in_file; ROCKSDB_NAMESPACE::TableFactory* factory = ROCKSDB_NAMESPACE::NewPlainTableFactory(options); diff --git a/db/c_test.c b/db/c_test.c index 1b8fa5ff8..454aa1622 100644 --- a/db/c_test.c +++ b/db/c_test.c @@ -1672,7 +1672,8 @@ int main(int argc, char** argv) { rocksdb_options_set_prefix_extractor( options, rocksdb_slicetransform_create_fixed_prefix(3)); rocksdb_options_set_hash_skip_list_rep(options, 5000, 4, 4); - rocksdb_options_set_plain_table_factory(options, 4, 10, 0.75, 16); + rocksdb_options_set_plain_table_factory(options, 4, 10, 0.75, 16, 0, 0, 0, + 0); rocksdb_options_set_allow_concurrent_memtable_write(options, 0); db = rocksdb_open(options, dbname, &err); diff --git a/include/rocksdb/c.h b/include/rocksdb/c.h index c2ab139f8..808617db6 100644 --- a/include/rocksdb/c.h +++ b/include/rocksdb/c.h @@ -1528,7 +1528,8 @@ extern ROCKSDB_LIBRARY_API void rocksdb_options_set_hash_skip_list_rep( extern ROCKSDB_LIBRARY_API void rocksdb_options_set_hash_link_list_rep( rocksdb_options_t*, size_t); extern ROCKSDB_LIBRARY_API void rocksdb_options_set_plain_table_factory( - rocksdb_options_t*, uint32_t, int, double, size_t); + rocksdb_options_t*, uint32_t, int, double, size_t, size_t, char, + unsigned char, unsigned char); extern ROCKSDB_LIBRARY_API void rocksdb_options_set_min_level_to_compress( rocksdb_options_t* opt, int level);