diff --git a/db/c.cc b/db/c.cc index 372874efd..c9a411bed 100644 --- a/db/c.cc +++ b/db/c.cc @@ -2154,6 +2154,10 @@ void rocksdb_options_destroy(rocksdb_options_t* options) { delete options; } +rocksdb_options_t* rocksdb_options_create_copy(rocksdb_options_t* options) { + return new rocksdb_options_t(*options); +} + void rocksdb_options_increase_parallelism( rocksdb_options_t* opt, int total_threads) { opt->rep.IncreaseParallelism(total_threads); diff --git a/db/c_test.c b/db/c_test.c index 80dcb7e07..d07306f6f 100644 --- a/db/c_test.c +++ b/db/c_test.c @@ -1461,6 +1461,23 @@ int main(int argc, char** argv) { rocksdb_cuckoo_options_destroy(cuckoo_options); } + StartPhase("options"); + { + rocksdb_options_t* o; + o = rocksdb_options_create(); + rocksdb_options_set_create_if_missing(o, 1); + + rocksdb_options_t* copy; + copy = rocksdb_options_create_copy(o); + // TODO: some way to check that *copy == *o + + rocksdb_options_set_create_if_missing(copy, 0); + // TODO: some way to check that *copy != *o + + rocksdb_options_destroy(copy); + rocksdb_options_destroy(o); + } + StartPhase("iterate_upper_bound"); { // Create new empty database diff --git a/include/rocksdb/c.h b/include/rocksdb/c.h index 8c6c0e28b..ecca73b6f 100644 --- a/include/rocksdb/c.h +++ b/include/rocksdb/c.h @@ -771,6 +771,8 @@ extern ROCKSDB_LIBRARY_API void rocksdb_set_options_cf( extern ROCKSDB_LIBRARY_API rocksdb_options_t* rocksdb_options_create(); extern ROCKSDB_LIBRARY_API void rocksdb_options_destroy(rocksdb_options_t*); +extern ROCKSDB_LIBRARY_API rocksdb_options_t* rocksdb_options_create_copy( + rocksdb_options_t*); extern ROCKSDB_LIBRARY_API void rocksdb_options_increase_parallelism( rocksdb_options_t* opt, int total_threads); extern ROCKSDB_LIBRARY_API void rocksdb_options_optimize_for_point_lookup(