stephan-hof / pyrocksdb

Python bindings for RocksDB
BSD 3-Clause "New" or "Revised" License
150 stars 170 forks source link

Does pyrocksdb support multiple embedded databases #4

Closed prashanthellina closed 10 years ago

prashanthellina commented 10 years ago

As described in https://github.com/facebook/rocksdb/wiki/Rocksdb-Architecture-Guide#support-for-multiple-embedded-databases-in-the-same-process

stephan-hof commented 10 years ago

Hi,

you can create as many database objects as you like.

However each of this database will use its own environment. Having multiple databases sharing the same environment is not supported right now. Do you need multiple databases sharing the same environment ? I could have a look how hard/easy it is to integrate that feature.

prashanthellina commented 10 years ago

I'm working on a server-like wrapper around RocksDB using pyrocksdb - https://github.com/prashanthellina/rocksdbserver.

In this kind of use, it is likely that a single process will host several database objects. For RocksDB documentation, it looks like creating all the database objects from a common Env object can help them in sharing resources like connection pool and block cache.

I thought it would be useful to have support for Env in such cases. It will be great if you can fit support for Env into your roadmap.

Aside from this discussion, please do take a look at my project when you can. Any feedback is most welcome.

stephan-hof commented 10 years ago

Hi, I did a look at the rocksdb source and it seems per default the same env, called 'default', is used. https://github.com/facebook/rocksdb/blob/master/util/options.cc#L157

This is just for your information. Still it makes sense for pyrocksdb to support ENV so that different databases could use different ENVs.

However right now every database uses the same Env.

stephan-hof commented 10 years ago

I did a even closer look. For me it seems there is no way in rocksdb itself to get a independent Env-object. The only way to get a Env* is Env::Default() which returns always the same object.

For now I will close this issue. If rocksdb changes their API you can reopen it again.

prashanthellina commented 10 years ago

Got it. It wasn't obvious from the documentation that a default environment is used. Thanks for clarifying.