Closed ekmartin closed 5 years ago
This looks good! Out of curiosity, do you think the repeated lock acquisition is going to be a performance bottleneck here at all?
Changes look good to me -- might be good to get this merged before things diverge too much.
Is there anything that needs doing before?
I think the comment I just left is the only real question I have. Some of the code may be possible to simplify a little, but I don't think it's very important.
Actually, let's just merge this and then I'll try just moving to a regular dependency.
EDIT: I'm working on the merge now :)
Sorry about my unresponsiveness here, and thanks for fixing the git dependency (0.12.2 wasn't released when I opened this PR).
The only significant change here is that
ColumnFamily
now has a lifetime parameter which makes it harder to store as a part ofPersistentState
. I initially threaded through the lifetime parameter up toPersistentState
but couldn't get past this error:error[E0277]: *mut librocksdb_sys::rocksdb_column_family_handle_t cannot be shared between threads safely --> noria-server/dataflow/src/state/persistent_state.rs:70:10
ColumnFamily
is marked asSend
but I wonder if the way to solve this might be to mark the inner pointer asNonNull
in rust-rocksdb? Not sure.To work around it I changed the column family callsites to instead use
db.cf_handle(name)
, which takes a lock (added in https://github.com/rust-rocksdb/rust-rocksdb/pull/197) and reads from aBTreeMap
.