-
Notifications
You must be signed in to change notification settings - Fork 6.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add rocksdb_create_column_families_with_options to C API. #12896
base: main
Are you sure you want to change the base?
Conversation
db/c_test.c
Outdated
CheckNoError(err); | ||
|
||
char** list_const_cf_names = (char**)malloc(2 * sizeof(char*)); | ||
list_const_cf_names[0] = "cf_with_options"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you make the names more distinct ?
db/c_test.c
Outdated
list_const_cf_names[0] = "cf_with_options"; | ||
list_const_cf_names[1] = "cf_with_option"; | ||
size_t cflen; | ||
const rocksdb_options_t* create_cf_options[2] = {db_options, db_options}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you
- create the 2x CF with different options
- do basic write/read tests just to validate that the correct distinct CFs have been returned by the new API
- confirm that each has received these distinct options i.e. something in the use of CF that differs by option
Maybe some of this can be copied from the tests that exist already ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for expanding the tests. Is there anything that demonstrates the correct (different) options have been sent to the different CFs ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently get_options(cfh)
is not implemented in the 'C' API. We really should add it, and use it to verify the correct options go to the correct CF on this creation. In the meantime, let's proceed with this PR.
@@ -1145,6 +1145,34 @@ rocksdb_column_family_handle_t** rocksdb_create_column_families( | |||
return c_handles; | |||
} | |||
|
|||
rocksdb_column_family_handle_t** rocksdb_create_column_families_with_options( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I approve of changing the parameter order so as not to allow confusion of options[] and options* ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry @alanpaxton, I don't understand what are you saying. Can you please describe it more?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are different rocksdb_create_column_famil[y|ies]
methods with different orders of parameters. I was confused by the different orders of parameters. But I think your function has the "correct" order of parameters for what it does.
@@ -1145,6 +1145,34 @@ rocksdb_column_family_handle_t** rocksdb_create_column_families( | |||
return c_handles; | |||
} | |||
|
|||
rocksdb_column_family_handle_t** rocksdb_create_column_families_with_options( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know the other APIs don't have method comments, but maybe we could start ? In particular state that this method takes a set of options per CF.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but wasn't be better to add doc comments to c.h file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are correct, at least in this case where we are documenting the API. Thanks for doing that.
@@ -1145,6 +1145,34 @@ rocksdb_column_family_handle_t** rocksdb_create_column_families( | |||
return c_handles; | |||
} | |||
|
|||
rocksdb_column_family_handle_t** rocksdb_create_column_families_with_options( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we implement a TTL variant, or is that enough scope ? I prefer to restrict the scope but worth thinking about.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the first C API. I would like to start small and then we can add more later. Once API is out, it's hard to remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree.
5e7039e
to
e134e79
Compare
e134e79
to
7ac10a4
Compare
7ac10a4
to
1d3aeda
Compare
1d3aeda
to
40b5fb6
Compare
This method allow to create Column Families in same was as we do in C++ with ColumnFamilyDescriptor.
Fix #12887