diff --git a/db/c.cc b/db/c.cc index 17ace20577..9cc69558b1 100644 --- a/db/c.cc +++ b/db/c.cc @@ -2745,6 +2745,24 @@ void rocksdb_options_set_block_based_table_factory( } } +void rocksdb_block_based_options_set_top_level_index_pinning_tier( + rocksdb_block_based_table_options_t* options, int v) { + options->rep.metadata_cache_options.top_level_index_pinning = + static_cast(v); +} + +void rocksdb_block_based_options_set_partition_pinning_tier( + rocksdb_block_based_table_options_t* options, int v) { + options->rep.metadata_cache_options.partition_pinning = + static_cast(v); +} + +void rocksdb_block_based_options_set_unpartitioned_pinning_tier( + rocksdb_block_based_table_options_t* options, int v) { + options->rep.metadata_cache_options.unpartitioned_pinning = + static_cast(v); +} + rocksdb_cuckoo_table_options_t* rocksdb_cuckoo_options_create() { return new rocksdb_cuckoo_table_options_t; } diff --git a/db/c_test.c b/db/c_test.c index b392bf59bf..81291dce5b 100644 --- a/db/c_test.c +++ b/db/c_test.c @@ -704,6 +704,10 @@ int main(int argc, char** argv) { rocksdb_block_based_options_set_block_cache(table_options, cache); rocksdb_block_based_options_set_data_block_index_type(table_options, 1); rocksdb_block_based_options_set_data_block_hash_ratio(table_options, 0.75); + rocksdb_block_based_options_set_top_level_index_pinning_tier(table_options, + 1); + rocksdb_block_based_options_set_partition_pinning_tier(table_options, 2); + rocksdb_block_based_options_set_unpartitioned_pinning_tier(table_options, 3); rocksdb_options_set_block_based_table_factory(options, table_options); rocksdb_options_set_compression(options, rocksdb_no_compression); diff --git a/include/rocksdb/c.h b/include/rocksdb/c.h index 85622bf55a..6e20676dad 100644 --- a/include/rocksdb/c.h +++ b/include/rocksdb/c.h @@ -1064,6 +1064,21 @@ rocksdb_block_based_options_set_pin_top_level_index_and_filter( rocksdb_block_based_table_options_t*, unsigned char); extern ROCKSDB_LIBRARY_API void rocksdb_options_set_block_based_table_factory( rocksdb_options_t* opt, rocksdb_block_based_table_options_t* table_options); +enum { + rocksdb_block_based_k_fallback_pinning_tier = 0, + rocksdb_block_based_k_none_pinning_tier = 1, + rocksdb_block_based_k_flush_and_similar_pinning_tier = 2, + rocksdb_block_based_k_all_pinning_tier = 3, +}; +extern ROCKSDB_LIBRARY_API void +rocksdb_block_based_options_set_top_level_index_pinning_tier( + rocksdb_block_based_table_options_t*, int); +extern ROCKSDB_LIBRARY_API void +rocksdb_block_based_options_set_partition_pinning_tier( + rocksdb_block_based_table_options_t*, int); +extern ROCKSDB_LIBRARY_API void +rocksdb_block_based_options_set_unpartitioned_pinning_tier( + rocksdb_block_based_table_options_t*, int); extern ROCKSDB_LIBRARY_API void rocksdb_options_set_write_buffer_manager( rocksdb_options_t* opt, rocksdb_write_buffer_manager_t* wbm); diff --git a/unreleased_history/public_api_changes/expose_block_based_metadata_cache_options_via_c_api.md b/unreleased_history/public_api_changes/expose_block_based_metadata_cache_options_via_c_api.md new file mode 100644 index 0000000000..8ba77be402 --- /dev/null +++ b/unreleased_history/public_api_changes/expose_block_based_metadata_cache_options_via_c_api.md @@ -0,0 +1 @@ +Exposed block based metadata cache options via C API