Skip to content
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

use grocksdb to support latest version of rocksdb #42

Merged
merged 11 commits into from
Apr 13, 2023

Conversation

yihuang
Copy link
Contributor

@yihuang yihuang commented Mar 6, 2023

Closes: #43 #44
also add API NewRocksDBWithRawDB to support read-only open mode and customize options.

The impact on existing user is it requires to build with rocksdb v7.10.2 now, otherwise, it behaves the same as before.

@yihuang yihuang requested a review from a team as a code owner March 6, 2023 02:48
also add API `NewRocksDBWithRawDB` to support read-only open mode and customize options
@thanethomson
Copy link
Contributor

@yihuang, could you please provide a more detailed explanation (ideally in an issue) as to why this change is necessary?

Also, it appears as though the tests in CI are failing.

@yihuang
Copy link
Contributor Author

yihuang commented Mar 8, 2023

@yihuang, could you please provide a more detailed explanation (ideally in an issue) as to why this change is necessary?

Also, it appears as though the tests in CI are failing.

done, added issue #43 and #44 which are fixed by this PR at once.

The ci failure is due to rocksdb version, I updated the version number in the docker file, not sure if that'll update the image automatically.

@thanethomson thanethomson added the dependencies Pull requests that update a dependency file label Mar 8, 2023
@adizere
Copy link
Member

adizere commented Mar 8, 2023

Thanks for this proposal @yihuang !

Copying @faddat, do you see any concerns in replacing github.com/tecbot/gorocksdb with github.com/linxGnu/grocksdb ?

@yihuang
Copy link
Contributor Author

yihuang commented Mar 9, 2023

Thanks for this proposal @yihuang !

Copying @faddat, do you see any concerns in replacing github.com/tecbot/gorocksdb with github.com/linxGnu/grocksdb ?

we already used on production, so far so good, the only thing different is the building dependency change, no side-effect observed in runtime, other than the changes caused by our tuning of rocksdb options.

@adizere
Copy link
Member

adizere commented Mar 9, 2023

Re: the CI failure for the "Docker testing image" workflow --

Not sure what the fix is, but I managed to repro the same problem in a separate PR (#45). Is it possible that the DockerHub secrets are not propagated into forks (such as this) of this repo and that is causing the failure?

@thanethomson FYI have installed fresh new access tokens (DOCKERHUB_USERNAME/DOCKERHUB_TOKEN) for bftbot in this repo, so the tokens should be fine.

@thanethomson
Copy link
Contributor

@yihuang please address the failing test. This failure is independent of the Docker build failure (we're investigating what's causing that).

@yihuang
Copy link
Contributor Author

yihuang commented Mar 15, 2023

@yihuang please address the failing test. This failure is independent of the Docker build failure (we're investigating what's causing that).

I think it's just due to incompatible rocksdb dependency, which can be fixed by updating the image with newer rocksdb library.

/go/pkg/mod/github.com/linx!gnu/grocksdb@v1.7.15/cache.go:86:2: could not determine kind of name for C.rocksdb_lru_cache_options_set_num_shard_bits

Copy link

@robert-zaremba robert-zaremba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tecbot/gorocksdb is outdated, and missing a maintainer.

linxGnu/grocksdb is definitely a way to go.

  • pending test fixes

@facundomedica
Copy link

@yihuang please address the failing test. This failure is independent of the Docker build failure (we're investigating what's causing that).

I think it's just due to incompatible rocksdb dependency, which can be fixed by updating the image with newer rocksdb library.

/go/pkg/mod/github.com/linx!gnu/grocksdb@v1.7.15/cache.go:86:2: could not determine kind of name for C.rocksdb_lru_cache_options_set_num_shard_bits

Looks like that was added on 7.5.3 any ideas why it's failing? Right now building Cosmos SDK with Rocks DB is not possible without using a fork + some replaces :(

Copy link

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK. Let's get this merged and released ASAP :)

tools/Dockerfile Outdated
@@ -17,7 +17,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \

FROM build AS install
ARG LEVELDB=1.20
ARG ROCKSDB=6.24.2
ARG ROCKSDB=7.9.2

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Latest version is now v8 BTW

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

@yihuang yihuang Mar 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

linxGnu/grocksdb#111
Need a few tweaks to build with v8.0

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you rock!

@yihuang
Copy link
Contributor Author

yihuang commented Mar 20, 2023

@yihuang please address the failing test. This failure is independent of the Docker build failure (we're investigating what's causing that).

I think it's just due to incompatible rocksdb dependency, which can be fixed by updating the image with newer rocksdb library.

/go/pkg/mod/github.com/linx!gnu/grocksdb@v1.7.15/cache.go:86:2: could not determine kind of name for C.rocksdb_lru_cache_options_set_num_shard_bits

Looks like that was added on 7.5.3 any ideas why it's failing? Right now building Cosmos SDK with Rocks DB is not possible without using a fork + some replaces :(

I guess become the CI image not updated?

@thanethomson
Copy link
Contributor

@yihuang we updated the CI to now use a Docker image built from the current branch (as opposed to one previously built from Docker Hub) and it still seems as though the test is failing.

dependabot bot and others added 5 commits March 24, 2023 15:14
…etbft#47)

Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 2.4.1 to 2.5.0.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](docker/setup-buildx-action@v2.4.1...v2.5.0)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@codecov
Copy link

codecov bot commented Mar 24, 2023

Codecov Report

Merging #42 (5608942) into main (317cc9f) will increase coverage by 0.01%.
The diff coverage is 93.75%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #42      +/-   ##
==========================================
+ Coverage   68.58%   68.59%   +0.01%     
==========================================
  Files          27       27              
  Lines        2123     2124       +1     
==========================================
+ Hits         1456     1457       +1     
  Misses        592      592              
  Partials       75       75              
Impacted Files Coverage Δ
rocksdb.go 72.05% <92.30%> (+0.20%) ⬆️
rocksdb_batch.go 84.31% <100.00%> (ø)
rocksdb_iterator.go 93.02% <100.00%> (ø)
Impacted Files Coverage Δ
rocksdb.go 72.05% <92.30%> (+0.20%) ⬆️
rocksdb_batch.go 84.31% <100.00%> (ø)
rocksdb_iterator.go 93.02% <100.00%> (ø)

@yihuang
Copy link
Contributor Author

yihuang commented Mar 24, 2023

@yihuang we updated the CI to now use a Docker image built from the current branch (as opposed to one previously built from Docker Hub) and it still seems as though the test is failing.

CI passed now.

@thanethomson
Copy link
Contributor

How do folks using rocksdb with the current cometbft-db release upgrade?

@@ -43,7 +43,7 @@ test-badgerdb:

test-all:
@echo "--> Running go test"
@go test $(PACKAGES) -tags cleveldb,boltdb,rocksdb,badgerdb -v
@go test $(PACKAGES) -tags cleveldb,boltdb,rocksdb,grocksdb_clean_link,badgerdb -v
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this grocksdb_clean_link tag do?

Copy link
Contributor Author

@yihuang yihuang Mar 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's to control the link flags, the default one is suitable for static linking which specifies all indirect dependencies explicitly, the clean version is suitable for dynamic linking case which only specify "-lrocksdb" and a few system dependencies

@robert-zaremba
Copy link

Does this fix the rocksdb usage with Cosmos SDK 0.46 or 0.47?

@lasarojc
Copy link
Contributor

How do folks using rocksdb with the current cometbft-db release upgrade?

Apparently simply upgrading should be fine. According to
https://github.com/facebook/rocksdb/wiki/RocksDB-Compatibility-Between-Different-Releases

Backward compatible: newer version of RocksDB should be able to open DBs generated by all previous releases for normal configuration.

@yihuang
Copy link
Contributor Author

yihuang commented Mar 31, 2023

How do folks using rocksdb with the current cometbft-db release upgrade?

In our experience, upgrading rocksdb library is totally backward compatible.

Copy link
Contributor

@thanethomson thanethomson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In our experience, upgrading rocksdb library is totally backward compatible.

Excellent. If that's the case, please add a changelog entry under the "Dependencies" section (as per https://github.com/cometbft/cometbft/blob/main/CONTRIBUTING.md#changelog) and then we can merge and ship this in a non-breaking release.

@yihuang
Copy link
Contributor Author

yihuang commented Apr 12, 2023

In our experience, upgrading rocksdb library is totally backward compatible.

Excellent. If that's the case, please add a changelog entry under the "Dependencies" section (as per https://github.com/cometbft/cometbft/blob/main/CONTRIBUTING.md#changelog) and then we can merge and ship this in a non-breaking release.

sorry for the delay, just added changelog.

CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
Contributor

@thanethomson thanethomson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thank you @yihuang!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

gorocksdb don't support rocksdb v7 and timestamp feature
7 participants