cosmos / cosmos-db

Apache License 2.0
22 stars 30 forks source link

support rocksdb column family #59

Open yihuang opened 1 year ago

yihuang commented 1 year ago

column family fits well with different iavl stores, at least it's easier to check the db states of different stores, potentially could tune db options separately.

But it seems not easy to do that transparently, without changing a few apis.

tac0turtle commented 1 year ago

I'm generally happy to accommodate changes in this repo for our use case. Would you want to submit a proposal of the api change

yihuang commented 1 year ago

Maybe the simplest way is just adding a new method to DB interface:

OpenSubDB(name string) DB

If can return nil if don't support similar concept.

And change here in cosmos-sdk into:

db := rs.db.OpenSubDB(params.key.Name())
if db == nil {
    db = NewPrefixDB(...)
}

Or the unsupported db backends can just return a PrefixDB.

yihuang commented 1 year ago

This change won't take advantage of atomic commit cross multiple column families, but that's another topic.

yihuang commented 1 year ago

It'll need an option to switch explicitly, otherwise existing rocksdb nodes will suddenly fail.