-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add rocksdb #12
Add rocksdb #12
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 looking good. left a few comments. would be great to have more tests!
db/rocks_db.go
Outdated
ro := gorocksdb.NewDefaultReadOptions() | ||
wo := gorocksdb.NewDefaultWriteOptions() | ||
woSync := gorocksdb.NewDefaultWriteOptions() | ||
woSync.SetSync(true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what this line does?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean these variables? read/write options?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean woSync.SetSync(true)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
woSync.SetSync(true)
prepares a sync write option. https://godoc.org/github.com/tecbot/gorocksdb#WriteOptions.SetSync
db/rocks_db.go
Outdated
key = nonNilBytes(key) | ||
res, err := db.db.Get(db.ro, key) | ||
if err != nil { | ||
res.Free() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not put this above with defer
? that way we'll avoid duplication s.Free() in moveSliceToBytes and here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
turns out res.Free()
when err != nil
is not necessary, removed. I would prefer to have a function that moves c bytes to go slice.
9b8d7d8
to
f50c457
Compare
Have you tried to contribute back to original lib? |
Nope, as vendoring was suggested for gorocksdb anyway. I just sent an issue in the upstream, let's see how it goes. |
@melekes , the upstream has not respond to the issue yet. tecbot/gorocksdb#167 |
Rocksdb's stats does not work with https://github.com/cosmos/cosmos-sdk/blob/e4c8bd72b72b18035ede103cb4a47da5825d330e/server/export.go#L95. |
Co-Authored-By: Anton Kaliaev <[email protected]>
@Stumble it seems gorocksdb has picked up steam could you rebase your fork until your PR get merged? |
@marbar3778 The PR is merged, I suggest we switch to the original branch. |
Closes #3831 The support for rocksdb was added a while back in tendermint/tm-db#12. This commit merely updates the documentation.
Closes #3831 The support for rocksdb was added a while back in tendermint/tm-db#12. This commit merely updates the documentation.
* Create codeql-analysis.yml * Update codeql-analysis.yml Co-authored-by: Marko <[email protected]>
tendermint/tendermint#3831
Using my fork of gorocksdb from https://github.com/tecbot/gorocksdb for two reasons: 1. The upstream repo encourages vendoring for API stability. 2. The default LDFLAGS setting in upstream repo enforces linking unnecessary compression libraries(https://github.com/tecbot/gorocksdb/blob/162552197222a834c6857385ae890e4decdd5049/dynflag.go#L5), so that if the library is not installed, link will fail. IMHO, tendermint should fork this wrapper and use it here.
To run tests:
First, install rocksdb,
Run tests: