facebook / rocksdb

A library that provides an embeddable, persistent key-value store for fast storage.
http://rocksdb.org
GNU General Public License v2.0
28.25k stars 6.27k forks source link

CreateColumnFamilies with column family descriptors is not available via the C API #12887

Open sadderchris opened 1 month ago

sadderchris commented 1 month ago

Note: Please use Issues only for bug reports. For questions, discussions, feature requests, etc. post to dev group: https://groups.google.com/forum/#!forum/rocksdb or https://www.facebook.com/groups/rocksdb.dev

Expected behavior

Using the C API, I can batch create column families from column family descriptors

Actual behavior

It's possible to create a single column family (1), or a batch of column families that all use the same options (2), but not from column family descriptors

Steps to reproduce the behavior

N/A

rhubner commented 1 month ago

Hello @sadderchris ,

I'm looking into C API and it looks like column family descriptors are not exposed at all. Usually where API expect column family descriptor, we pass two parameters, column_family_names and column_family_options. This obviously missing for rocksdb_create_column_families. Can you please check API proposal bellow if it describe your requirements ?

rocksdb_column_family_handle_t** rocksdb_create_column_families(
    rocksdb_t* db, 
    int num_column_families,
    const char* const* column_family_names,
    const rocksdb_options_t* const* column_family_options,
    size_t* lencfs, char** errptr);

Radek

cc: @adamretter @pdillinger

sadderchris commented 1 month ago

Wouldn't this break any existing callers of rocksdb_create_column_families? Or is backwards compatibility in the C API not a concern?

rhubner commented 1 month ago

Hello @sadderchris ,

of course you are correct. Too much time in Java/C++ that I almost forgot C doesn't support overloading.

rocksdb_column_family_handle_t** rocksdb_create_column_families_with_options(
                               rocksdb_t* db,
                               int num_column_families,
                               const char* const* column_family_names,
                               const rocksdb_options_t* const* column_family_options,
                               size_t* lencfs, char** errptr);

Radek

sadderchris commented 1 month ago

Thanks for the quick turnaround, this looks like it would work for our purposes.