OptimisticTransactionDBOptions support for C/FFI API #14206
+281
−22
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I am trying to use
rocksdb::OptimisticTransactionDBover FFI and noticed the option I need,occ_lock_buckets, isn't settable. I noticed this related issue #11703 was marked up for grabs and I went ahead and introducedOptimisticTransactionDBOptionsto the C API.Unfortunately, this contains a breaking change in the C API, in that I decided to include
rocksdb_optimistictransactiondb_options_t *in the signature ofrocksdb_optimistictransactiondb_open()androcksdb_optimistictransactiondb_open_column_families().We could preserve backwards compatibility by adding logical overloads that include the options pointer, but I am a bit partial to keeping the APIs consistent with
transactiondbif possible. Happy to go the other way if the community feels otherwise. For the open functions, settingrocksdb_optimistictransactiondb_options_t *to null causes the defaults ofOptimisticTransactionDBto get applied. Passing an options pointer without any of the fields mutated will assume the defaults inOptimisticTransactionDB.I added a new overload for
OptimisticTransactionDB::Open()that imitates the "simple" overload signature. It omits the CF-handle related arguments, but allows the caller to passOptimisticTransactionDBOptions. The original "simple" overload now calls this new overload, assuming the default constructedOptimisticTransactionDBOptions. This allowed me to reduce CF-handle related logic in the C interface, and centralize more in the core RocksDB layer. ThisOpen()refactor could stand to be its own PR, since it's useful when using the C++ interface.