Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions db/c.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4590,6 +4590,16 @@ int rocksdb_options_get_target_file_size_multiplier(rocksdb_options_t* opt) {
return opt->rep.target_file_size_multiplier;
}

void rocksdb_options_set_target_file_size_is_upper_bound(rocksdb_options_t* opt,
unsigned char v) {
opt->rep.target_file_size_is_upper_bound = v;
}

unsigned char rocksdb_options_get_target_file_size_is_upper_bound(
rocksdb_options_t* opt) {
return opt->rep.target_file_size_is_upper_bound;
}

void rocksdb_options_set_max_bytes_for_level_base(rocksdb_options_t* opt,
uint64_t n) {
opt->rep.max_bytes_for_level_base = n;
Expand Down Expand Up @@ -5039,6 +5049,15 @@ void rocksdb_options_set_manifest_preallocation_size(rocksdb_options_t* opt,
opt->rep.manifest_preallocation_size = v;
}

int rocksdb_options_get_max_manifest_space_amp_pct(rocksdb_options_t* opt) {
return opt->rep.max_manifest_space_amp_pct;
}

void rocksdb_options_set_max_manifest_space_amp_pct(rocksdb_options_t* opt,
int v) {
opt->rep.max_manifest_space_amp_pct = v;
}

size_t rocksdb_options_get_manifest_preallocation_size(rocksdb_options_t* opt) {
return opt->rep.manifest_preallocation_size;
}
Expand Down
18 changes: 18 additions & 0 deletions db/c_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -2935,6 +2935,12 @@ int main(int argc, char** argv) {
rocksdb_options_set_prepopulate_blob_cache(o, 1 /* flush only */);
CheckCondition(1 == rocksdb_options_get_prepopulate_blob_cache(o));

rocksdb_options_set_target_file_size_is_upper_bound(o, 1);
CheckCondition(1 == rocksdb_options_get_target_file_size_is_upper_bound(o));

rocksdb_options_set_max_manifest_space_amp_pct(o, 31);
CheckCondition(31 == rocksdb_options_get_max_manifest_space_amp_pct(o));

// Create a copy that should be equal to the original.
rocksdb_options_t* copy;
copy = rocksdb_options_create_copy(o);
Expand Down Expand Up @@ -3036,6 +3042,9 @@ int main(int argc, char** argv) {
CheckCondition(1 == rocksdb_options_get_atomic_flush(copy));
CheckCondition(29.0 ==
rocksdb_options_get_experimental_mempurge_threshold(copy));
CheckCondition(31 == rocksdb_options_get_max_manifest_space_amp_pct(copy));
CheckCondition(1 ==
rocksdb_options_get_target_file_size_is_upper_bound(copy));

// Copies should be independent.
rocksdb_options_set_allow_ingest_behind(copy, 0);
Expand Down Expand Up @@ -3411,6 +3420,15 @@ int main(int argc, char** argv) {
CheckCondition(29.0 ==
rocksdb_options_get_experimental_mempurge_threshold(o));

rocksdb_options_set_max_manifest_space_amp_pct(copy, 330);
CheckCondition(330 == rocksdb_options_get_max_manifest_space_amp_pct(copy));
CheckCondition(31 == rocksdb_options_get_max_manifest_space_amp_pct(o));

rocksdb_options_set_target_file_size_is_upper_bound(copy, 0);
CheckCondition(0 ==
rocksdb_options_get_target_file_size_is_upper_bound(copy));
CheckCondition(1 == rocksdb_options_get_target_file_size_is_upper_bound(o));

rocksdb_options_destroy(copy);
rocksdb_options_destroy(o);
}
Expand Down
9 changes: 9 additions & 0 deletions include/rocksdb/c.h
Original file line number Diff line number Diff line change
Expand Up @@ -1645,6 +1645,11 @@ extern ROCKSDB_LIBRARY_API void rocksdb_options_set_target_file_size_multiplier(
rocksdb_options_t*, int);
extern ROCKSDB_LIBRARY_API int rocksdb_options_get_target_file_size_multiplier(
rocksdb_options_t*);
extern ROCKSDB_LIBRARY_API void
rocksdb_options_set_target_file_size_is_upper_bound(rocksdb_options_t*,
unsigned char);
extern ROCKSDB_LIBRARY_API unsigned char
rocksdb_options_get_target_file_size_is_upper_bound(rocksdb_options_t*);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_max_bytes_for_level_base(
rocksdb_options_t*, uint64_t);
extern ROCKSDB_LIBRARY_API uint64_t
Expand Down Expand Up @@ -1863,6 +1868,10 @@ extern ROCKSDB_LIBRARY_API void rocksdb_options_set_max_manifest_file_size(
rocksdb_options_t*, size_t);
extern ROCKSDB_LIBRARY_API size_t
rocksdb_options_get_max_manifest_file_size(rocksdb_options_t*);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_max_manifest_space_amp_pct(
rocksdb_options_t*, int);
extern ROCKSDB_LIBRARY_API int rocksdb_options_get_max_manifest_space_amp_pct(
rocksdb_options_t*);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_table_cache_numshardbits(
rocksdb_options_t*, int);
extern ROCKSDB_LIBRARY_API int rocksdb_options_get_table_cache_numshardbits(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Added `rocksdb_options_set_target_file_size_is_upper_bound`, `rocksdb_options_get_target_file_size_is_upper_bound`, `rocksdb_options_get_max_manifest_space_amp_pct`, `rocksdb_options_set_max_manifest_space_amp_pct` to the C API, exposing the exisiting options - max_manifest_space_amp_pct , target_file_size_is_upper_bound. This allows C API users (and downstream language bindings) for finer-grained control over manifest and SST file sizings.