Rust-rocksdb: TxnDB : Transactions via rocksdb_transaction_t

Created on 19 Oct 2017  ·  7Comments  ·  Source: rust-rocksdb/rust-rocksdb

Transaction functionality is exposed in rocksdb via a parallel implementation of the rocksdb_t called rocksdb_transaction_t . Now that we have bindgen (#143) we get access to it for "free".

First, for brevity, I propose a new acronym that is the RocksDB parallel of CRUD, I call it
PIGMED , that's Put Iterate MErge Delete. Not catchy, I know.

The question is how to best expose the Transaction functionality while :

  1. Not duplicating the entire DB impl for TxnDB
  2. Maintaining type safety.

There are quite a few new methods for TxnDb that would need to be wrapped, some of them might make sense as guards or even closures.

I don't think there is a way to unify the PIGMED operations of DB and TxnDB while retaining type safety or even ergonomics. But there isn't actually a ton of PIGMED functionality in DB.

I propose we move all of the utility/environment functionality, that is anything that doesn't require a rocksdb_t into a separate utility module or modules (e.g. rocksdb::cf::create for rocksdb_create_cf)

We then slim down DB to just the PIGMED operations.

My hope is that we would be able to leverage the same Iterator functionality. There is a rocksdb_transaction_create_iterator but the iterator_t is the same.

Thoughts?

enhancement

Most helpful comment

@hnakamur submitted facebook/rocksdb#5077 to add the missing APIs. Once they become available in a release, I'll work on adding support for it here in the Rust binding.

All 7 comments

Looks like this has been there for a while. Just thought I'll drop a quick to see if there's any update on this? I'm holding off using rocksdb for some rust services due to transactions.

Is this satisfied by #250?

I think so. Looking forward to it getting merged :)

I reread @rrichardson earlier comments and I think this issue is referring to the "pessimistic" version of transactional RocksDB, whereas #250 is adding the "optimistic" version. I think we should be able to land both, leveraging much of the work in #250.

I'm currently working on some internal restructuring in #268 that will make it easier to implement both TransactionalDB and OptimisticTransactionalDB without a lot of code duplication.

There are some missing methods in C API to make TransactionalDB roughly equivalent DB (see facebook/rocksdb#4999). That needs to be resolved before we can land this feature.

@hnakamur submitted facebook/rocksdb#5077 to add the missing APIs. Once they become available in a release, I'll work on adding support for it here in the Rust binding.

@iSynaptic
https://github.com/facebook/rocksdb/pull/5077 already merged, and I saw the update appeared in the latest release version.

Can you please revisit current PR?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yiyanwannian picture yiyanwannian  ·  6Comments

mvines picture mvines  ·  10Comments

spacejam picture spacejam  ·  3Comments

zach-schoenberger picture zach-schoenberger  ·  5Comments

iSynaptic picture iSynaptic  ·  11Comments