Skip to content

Commit 399fec5

Browse files
yihuangmmsqe
andcommitted
Problem: rocksdb 8.0 is not used (#940)
* Problem: rocksdb 8.0 is not used Solution: - fix build issue in grocksdb - update dependencies - enable OptimizeFiltersForMemory * fix resolve * rocksdb 8.1.1 * fix resolve * changelog * install golangci-lint separately * fix workflow * fix deps * fix unittest workflow * fix workflow * fix unittest workflow --------- Signed-off-by: yihuang <huang@crypto.com> Co-authored-by: mmsqe <mavis@crypto.com>
1 parent 3b28f30 commit 399fec5

File tree

11 files changed

+22
-26
lines changed

11 files changed

+22
-26
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252

5353
unittest:
5454
runs-on: ubuntu-latest
55-
timeout-minutes: 10
55+
timeout-minutes: 40
5656
steps:
5757
- uses: actions/checkout@v3
5858
- uses: cachix/install-nix-action@v22
@@ -78,16 +78,8 @@ jobs:
7878
make test
7979
8080
# run versiondb tests
81-
nix registry add nixpkgs github:NixOS/nixpkgs/23.05
82-
nix profile install nixpkgs#rocksdb
83-
export PKG_CONFIG_PATH=$HOME/.nix-profile/lib/pkgconfig
84-
export CGO_CFLAGS="$(pkg-config --cflags rocksdb)" CGO_LDFLAGS="$(pkg-config --libs rocksdb)"
85-
export LD_LIBRARY_PATH=$HOME/.nix-profile/lib
86-
export GLIBC="$(nix build nixpkgs#stdenv.cc.libc.out --no-link --print-out-paths)"
87-
export CGO_LDFLAGS="$CGO_LDFLAGS -Wl,--dynamic-linker=$GLIBC/lib/ld-linux-x86-64.so.2"
88-
echo $CGO_LDFLAGS
8981
cd ./versiondb
90-
go test -v -mod=readonly ./... -tags rocksdb,grocksdb_clean_link -coverprofile=coverage.txt
82+
nix-shell -I nixpkgs=../nix -p rocksdb go_1_20 --run "go test -v -mod=readonly ./... -tags rocksdb,grocksdb_clean_link -coverprofile=coverage.txt"
9183
if: steps.changed-files.outputs.any_changed == 'true'
9284
- name: filter out proto files
9385
run: |

.github/workflows/lint.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
golangci:
1818
name: Run golangci-lint
1919
runs-on: ubuntu-latest
20-
timeout-minutes: 10
20+
timeout-minutes: 40
2121
steps:
2222
- uses: actions/setup-go@v3
2323
with:
@@ -40,8 +40,8 @@ jobs:
4040
*.sum
4141
- name: run golangci-lint
4242
run: |
43-
nix registry add nixpkgs github:NixOS/nixpkgs/23.05
44-
nix profile install nixpkgs#rocksdb nixpkgs#golangci-lint
43+
nix profile install nixpkgs#golangci-lint
44+
nix profile install -f ./nix rocksdb
4545
export PKG_CONFIG_PATH=$HOME/.nix-profile/lib/pkgconfig
4646
export CGO_CFLAGS="$(pkg-config --cflags rocksdb)" CGO_LDFLAGS="$(pkg-config --libs rocksdb)"
4747
golangci-lint version

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
- Avoid channel get changed when concurrent subscribe happens ([ethermint commit](https://github.com/crypto-org-chain/ethermint/commit/72bbe0a80dfd3c586868e2f0b4fbed72593c45bf)).
1313
- call Close method on app to cleanup resource on graceful shutdown ([ethermint commit](https://github.com/crypto-org-chain/ethermint/commit/0ea7b86532a1144f229961f94b4524d5889e874d)).
1414
- [#1081](https://github.com/crypto-org-chain/cronos/pull/1081) Build with nativebyteorder by default, the released binaries only support little-endian machines, big-endian machines need to build custom binary for themselves.
15+
- [#940](https://github.com/crypto-org-chain/cronos/pull/940) Update rocksdb dependency to 8.1.1.
1516

1617
### Bug Fixes
1718

cmd/cronosd/opendb/opendb_rocksdb.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ func NewRocksdbOptions(opts *grocksdb.Options, sstFileWriter bool) *grocksdb.Opt
107107
// http://rocksdb.org/blog/2017/05/12/partitioned-index-filter.html
108108
bbto.SetIndexType(grocksdb.KTwoLevelIndexSearchIndexType)
109109
bbto.SetPartitionFilters(true)
110+
bbto.SetOptimizeFiltersForMemory(true)
110111

111112
// hash index is better for iavl tree which mostly do point lookup.
112113
bbto.SetDataBlockIndexType(grocksdb.KDataBlockIndexTypeBinarySearchAndHash)

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ require (
1616
github.com/golang/protobuf v1.5.3
1717
github.com/gorilla/mux v1.8.0
1818
github.com/grpc-ecosystem/grpc-gateway v1.16.0
19-
github.com/linxGnu/grocksdb v1.7.16
19+
github.com/linxGnu/grocksdb v1.8.0
2020
github.com/peggyjv/gravity-bridge/module/v2 v2.0.0-00010101000000-000000000000
2121
github.com/rakyll/statik v0.1.7
2222
github.com/spf13/cast v1.5.0
@@ -26,6 +26,7 @@ require (
2626
github.com/tendermint/tendermint v0.34.28
2727
github.com/tendermint/tm-db v0.6.7
2828
golang.org/x/exp v0.0.0-20230310171629-522b1b587ee0
29+
golang.org/x/sys v0.8.0
2930
google.golang.org/genproto v0.0.0-20230323212658-478b75c54725
3031
google.golang.org/grpc v1.54.0
3132
google.golang.org/protobuf v1.30.0
@@ -207,7 +208,6 @@ require (
207208
golang.org/x/net v0.10.0 // indirect
208209
golang.org/x/oauth2 v0.6.0 // indirect
209210
golang.org/x/sync v0.1.0 // indirect
210-
golang.org/x/sys v0.8.0 // indirect
211211
golang.org/x/term v0.8.0 // indirect
212212
golang.org/x/text v0.9.0 // indirect
213213
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect

go.sum

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1943,8 +1943,9 @@ github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-b
19431943
github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4=
19441944
github.com/linuxkit/virtsock v0.0.0-20201010232012-f8cee7dfc7a3/go.mod h1:3r6x7q95whyfWQpmGZTu3gk3v2YkMi05HEzl7Tf7YEo=
19451945
github.com/linxGnu/grocksdb v1.7.15/go.mod h1:pY55D0o+r8yUYLq70QmhdudxYvoDb9F+9puf4m3/W+U=
1946-
github.com/linxGnu/grocksdb v1.7.16 h1:Q2co1xrpdkr5Hx3Fp+f+f7fRGhQFQhvi/+226dtLmA8=
19471946
github.com/linxGnu/grocksdb v1.7.16/go.mod h1:JkS7pl5qWpGpuVb3bPqTz8nC12X3YtPZT+Xq7+QfQo4=
1947+
github.com/linxGnu/grocksdb v1.8.0 h1:H4L/LhP7GOMf1j17oQAElHgVlbEje2h14A8Tz9cM2BE=
1948+
github.com/linxGnu/grocksdb v1.8.0/go.mod h1:09CeBborffXhXdNpEcOeZrLKEnRtrZFEpFdPNI9Zjjg=
19481949
github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4=
19491950
github.com/lucasjones/reggen v0.0.0-20180717132126-cdb49ff09d77/go.mod h1:5ELEyG+X8f+meRWHuqUOewBOhvHkl7M76pdGEansxW4=
19501951
github.com/lufeee/execinquery v1.2.1/go.mod h1:EC7DrEKView09ocscGHC+apXMIaorh4xqSxS/dy8SbM=

gomod2nix.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,8 @@ schema = 3
381381
version = "v0.1.0"
382382
hash = "sha256-wQqGTtRWsfR9n0O/SXHVgECebbnNmHddxJIbG63OJBQ="
383383
[mod."github.com/linxGnu/grocksdb"]
384-
version = "v1.7.16"
385-
hash = "sha256-XJG6LqvXvlwpkAsuSYR+IPTDzByNdcS7oQA+eg98+D4="
384+
version = "v1.8.0"
385+
hash = "sha256-o6zj18at4oN6pqSioFqd1AXduR/cx0xDgtL1rPPw+1M="
386386
[mod."github.com/magiconair/properties"]
387387
version = "v1.8.6"
388388
hash = "sha256-xToSfpuePctkTdhJtsuKIEkXwfMZbnkFT98ahIfd4wY="

nix/rocksdb.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121

2222
stdenv.mkDerivation rec {
2323
pname = "rocksdb";
24-
version = "7.10.2";
24+
version = "8.1.1";
2525

2626
src = fetchFromGitHub {
2727
owner = "facebook";
2828
repo = pname;
2929
rev = "v${version}";
30-
sha256 = "sha256-U2ReSrJwjAXUdRmwixC0DQXht/h/6rV8SOf5e2NozIs=";
30+
sha256 = "sha256-79hRtc5QSWLLyjRGCmuYZSoIc9IcIsnl8UCinz2sVw4=";
3131
};
3232

3333
nativeBuildInputs = [ cmake ninja ];

versiondb/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ require (
1111
github.com/gogo/protobuf v1.3.3
1212
github.com/golang/snappy v0.0.4
1313
github.com/hashicorp/go-multierror v1.1.1
14-
github.com/linxGnu/grocksdb v1.7.16
14+
github.com/linxGnu/grocksdb v1.8.0
1515
github.com/spf13/cast v1.5.0
1616
github.com/spf13/cobra v1.6.1
17-
github.com/stretchr/testify v1.8.2
17+
github.com/stretchr/testify v1.8.3
1818
github.com/tendermint/tendermint v0.34.28
1919
github.com/tendermint/tm-db v0.6.7
2020
)

versiondb/go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -680,8 +680,8 @@ github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6
680680
github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg=
681681
github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM=
682682
github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4=
683-
github.com/linxGnu/grocksdb v1.7.16 h1:Q2co1xrpdkr5Hx3Fp+f+f7fRGhQFQhvi/+226dtLmA8=
684-
github.com/linxGnu/grocksdb v1.7.16/go.mod h1:JkS7pl5qWpGpuVb3bPqTz8nC12X3YtPZT+Xq7+QfQo4=
683+
github.com/linxGnu/grocksdb v1.8.0 h1:H4L/LhP7GOMf1j17oQAElHgVlbEje2h14A8Tz9cM2BE=
684+
github.com/linxGnu/grocksdb v1.8.0/go.mod h1:09CeBborffXhXdNpEcOeZrLKEnRtrZFEpFdPNI9Zjjg=
685685
github.com/lucasjones/reggen v0.0.0-20180717132126-cdb49ff09d77/go.mod h1:5ELEyG+X8f+meRWHuqUOewBOhvHkl7M76pdGEansxW4=
686686
github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ=
687687
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
@@ -971,8 +971,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
971971
github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals=
972972
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
973973
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
974-
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
975-
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
974+
github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY=
975+
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
976976
github.com/subosito/gotenv v1.4.1 h1:jyEFiXpy21Wm81FBN71l9VoMMV8H8jG+qIK3GCpY6Qs=
977977
github.com/subosito/gotenv v1.4.1/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0=
978978
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc=

0 commit comments

Comments
 (0)