From e7607fff09af4a9d7b510ffc460ebee05dd266d6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 28 Feb 2022 07:21:57 -0800 Subject: [PATCH 01/11] build(deps): bump golangci/golangci-lint-action from 2 to 3.1.0 (#222) Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 2 to 3.1.0. - [Release notes](https://github.com/golangci/golangci-lint-action/releases) - [Commits](https://github.com/golangci/golangci-lint-action/compare/v2...v3.1.0) --- updated-dependencies: - dependency-name: golangci/golangci-lint-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 15e3b20cb..79c16b818 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -13,7 +13,7 @@ jobs: container: tendermintdev/docker-tm-db-testing steps: - uses: actions/checkout@v2 - - uses: golangci/golangci-lint-action@v2 + - uses: golangci/golangci-lint-action@v3.1.0 with: args: --timeout 10m github-token: ${{ secrets.github_token }} From ecb7602788977af065983b0d39661aa4e839c65a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 2 Mar 2022 14:55:55 +0100 Subject: [PATCH 02/11] build(deps): bump actions/checkout from 2 to 3 (#223) Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- .github/workflows/docker.yml | 2 +- .github/workflows/lint.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a8beee60b..a24be04ba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: runs-on: ubuntu-latest container: tendermintdev/docker-tm-db-testing steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: test & coverage report creation run: | CGO_ENABLED=1 go test ./... -mod=readonly -timeout 8m -race -coverprofile=coverage.txt -covermode=atomic -tags=memdb,goleveldb,cleveldb,boltdb,rocksdb,badgerdb -v diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 1eb94db47..05d0acb5a 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -21,7 +21,7 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@master + - uses: actions/checkout@v3 - name: Prepare id: prep run: | diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 79c16b818..25c81087b 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest container: tendermintdev/docker-tm-db-testing steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: golangci/golangci-lint-action@v3.1.0 with: args: --timeout 10m From 6902a079b22faf7935891ccbecb57951c7427975 Mon Sep 17 00:00:00 2001 From: Mark Rushakoff Date: Mon, 7 Mar 2022 16:56:20 -0500 Subject: [PATCH 03/11] Update to latest golang.org/x/sys (#224) Without this, tests against boltdb with the race detector on go tip fail --- go.mod | 2 +- go.sum | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 1de824b6b..4fdd69c9a 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,7 @@ require ( github.com/pkg/errors v0.8.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect golang.org/x/net v0.0.0-20201021035429-f5854403a974 // indirect - golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f // indirect + golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9 // indirect golang.org/x/text v0.3.3 // indirect google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect google.golang.org/protobuf v1.25.0 // indirect diff --git a/go.sum b/go.sum index b7cf93b88..485bee483 100644 --- a/go.sum +++ b/go.sum @@ -181,8 +181,9 @@ golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9 h1:nhht2DYV/Sn3qOayu8lM+cU1ii9sTLUeBQwQQfUHtrs= +golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= From 76ee3fb698322edafaa69da33bdf5124f38a5a26 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 10 Mar 2022 11:03:08 +0000 Subject: [PATCH 04/11] build(deps): bump google.golang.org/grpc from 1.44.0 to 1.45.0 Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.44.0 to 1.45.0. - [Release notes](https://github.com/grpc/grpc-go/releases) - [Commits](https://github.com/grpc/grpc-go/compare/v1.44.0...v1.45.0) --- updated-dependencies: - dependency-name: google.golang.org/grpc dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 6 +++--- go.sum | 15 ++++++++++----- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index 4fdd69c9a..e546745ee 100644 --- a/go.mod +++ b/go.mod @@ -6,13 +6,13 @@ require ( github.com/cosmos/gorocksdb v1.2.0 github.com/dgraph-io/badger/v2 v2.2007.2 github.com/gogo/protobuf v1.3.2 - github.com/golang/protobuf v1.4.3 // indirect + github.com/golang/protobuf v1.5.2 // indirect github.com/google/btree v1.0.0 github.com/jmhodges/levigo v1.0.0 github.com/stretchr/testify v1.7.0 github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca go.etcd.io/bbolt v1.3.6 - google.golang.org/grpc v1.44.0 + google.golang.org/grpc v1.45.0 ) require ( @@ -29,7 +29,7 @@ require ( golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9 // indirect golang.org/x/text v0.3.3 // indirect google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect - google.golang.org/protobuf v1.25.0 // indirect + google.golang.org/protobuf v1.26.0 // indirect gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect ) diff --git a/go.sum b/go.sum index 485bee483..47087d510 100644 --- a/go.sum +++ b/go.sum @@ -66,8 +66,10 @@ github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:W github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= @@ -76,8 +78,9 @@ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5a github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= @@ -214,8 +217,8 @@ google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.44.0 h1:weqSxi/TMs1SqFRMHCtBgXRs8k3X39QIDEZ0pRcttUg= -google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.45.0 h1:NEpgUqV3Z+ZjkqMsxMg11IaDrXY4RY6CQukSGK0uI1M= +google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -224,8 +227,10 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From 1d577cf8e2b4b6279c15e085eb329525f3c4f4e6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 16 Mar 2022 07:52:30 -0700 Subject: [PATCH 05/11] build(deps): bump github.com/stretchr/testify from 1.7.0 to 1.7.1 (#226) --- go.mod | 2 +- go.sum | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index e546745ee..73a8a59b0 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/google/btree v1.0.0 github.com/jmhodges/levigo v1.0.0 - github.com/stretchr/testify v1.7.0 + github.com/stretchr/testify v1.7.1 github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca go.etcd.io/bbolt v1.3.6 google.golang.org/grpc v1.45.0 diff --git a/go.sum b/go.sum index 47087d510..8d33ae2c0 100644 --- a/go.sum +++ b/go.sum @@ -128,8 +128,9 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca h1:Ld/zXl5t4+D69SiV4JoN7kkfvJdOWlPpfxrzxpLMoUk= github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= From a822e7dfc9f6dba09f3f73912ef1821bb756dd62 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 6 Apr 2022 07:51:01 -0700 Subject: [PATCH 06/11] build(deps): bump codecov/codecov-action from 2.0.3 to 3 (#227) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 2.0.3 to 3. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/master/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v2.0.3...v3) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a24be04ba..1de0967c7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,7 @@ jobs: - name: test & coverage report creation run: | CGO_ENABLED=1 go test ./... -mod=readonly -timeout 8m -race -coverprofile=coverage.txt -covermode=atomic -tags=memdb,goleveldb,cleveldb,boltdb,rocksdb,badgerdb -v - - uses: codecov/codecov-action@v2.0.3 + - uses: codecov/codecov-action@v3 with: file: ./coverage.txt fail_ci_if_error: true From 044c14d1323cfc57f2be344d93cd6316fc3d819b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Apr 2022 04:59:37 -0700 Subject: [PATCH 07/11] build(deps): bump actions/stale from 4 to 5 (#228) --- .github/workflows/stale.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 032ca431e..ba7e1b42e 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -7,7 +7,7 @@ jobs: stale: runs-on: ubuntu-latest steps: - - uses: actions/stale@v4 + - uses: actions/stale@v5 with: repo-token: ${{ secrets.GITHUB_TOKEN }} stale-pr-message: "This pull request has been automatically marked as stale because it has not had From 002aa1ced3168537a4ddbe9016b07638bda6c6e4 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Tue, 12 Apr 2022 03:16:48 +0700 Subject: [PATCH 08/11] upgrade gorocksdb library to grocksdb, supporting rocksdb v7 --- README.md | 2 +- db.go | 2 +- go.mod | 5 +++-- go.sum | 13 ++++--------- rocksdb.go | 32 ++++++++++++++++---------------- rocksdb_batch.go | 8 ++++---- rocksdb_iterator.go | 16 ++++++++-------- rocksdb_test.go | 17 ++++++++++++++++- 8 files changed, 53 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index 2aa6efb53..61a615583 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Go 1.13+ - **[BoltDB](https://github.com/etcd-io/bbolt) [experimental]:** A [fork](https://github.com/etcd-io/bbolt) of [BoltDB](https://github.com/boltdb/bolt). Uses B+trees for on-disk storage, which have good performance for read-heavy workloads and range scans. Supports serializable ACID transactions. -- **[RocksDB](https://github.com/cosmos/gorocksdb) [experimental]:** A [Go wrapper](https://github.com/cosmos/gorocksdb) around [RocksDB](https://rocksdb.org). Similarly to LevelDB (above) it uses LSM-trees for on-disk storage, but is optimized for fast storage media such as SSDs and memory. Supports atomic transactions, but not full ACID transactions. +- **[RocksDB](https://github.com/linxGnu/grocksdb) [experimental]:** A [Go wrapper](https://github.com/linxGnu/grocksdb) around [RocksDB](https://rocksdb.org). Similarly to LevelDB (above) it uses LSM-trees for on-disk storage, but is optimized for fast storage media such as SSDs and memory. Supports atomic transactions, but not full ACID transactions. - **[BadgerDB](https://github.com/dgraph-io/badger) [experimental]:** A key-value database written as a pure-Go alternative to e.g. LevelDB and RocksDB, with LSM-tree storage. Makes use of multiple goroutines for performance, and includes advanced features such as serializable ACID transactions, write batches, compression, and more. diff --git a/db.go b/db.go index ef573f17e..f859ae749 100644 --- a/db.go +++ b/db.go @@ -28,7 +28,7 @@ const ( // - may be faster is some use-cases (random reads - indexer) // - use boltdb build tag (go build -tags boltdb) BoltDBBackend BackendType = "boltdb" - // RocksDBBackend represents rocksdb (uses github.com/cosmos/gorocksdb) + // RocksDBBackend represents rocksdb (uses github.com/linxGnu/grocksdb) // - EXPERIMENTAL // - requires gcc // - use rocksdb build tag (go build -tags rocksdb) diff --git a/go.mod b/go.mod index 73a8a59b0..ca0549440 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,6 @@ module github.com/tendermint/tm-db go 1.17 require ( - github.com/cosmos/gorocksdb v1.2.0 github.com/dgraph-io/badger/v2 v2.2007.2 github.com/gogo/protobuf v1.3.2 github.com/golang/protobuf v1.5.2 // indirect @@ -15,6 +14,8 @@ require ( google.golang.org/grpc v1.45.0 ) +require github.com/linxGnu/grocksdb v1.7.1-0.20220327020612-ee0c6690507f + require ( github.com/DataDog/zstd v1.4.1 // indirect github.com/cespare/xxhash v1.1.0 // indirect @@ -30,7 +31,7 @@ require ( golang.org/x/text v0.3.3 // indirect google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect google.golang.org/protobuf v1.26.0 // indirect - gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) // Breaking changes were released with the wrong tag (use v0.6.6 or later). diff --git a/go.sum b/go.sum index 8d33ae2c0..21bd901a9 100644 --- a/go.sum +++ b/go.sum @@ -21,8 +21,6 @@ github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWH github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/cosmos/gorocksdb v1.2.0 h1:d0l3jJG8M4hBouIZq0mDUHZ+zjOx044J3nGRskwTb4Y= -github.com/cosmos/gorocksdb v1.2.0/go.mod h1:aaKvKItm514hKfNJpUJXnnOWeBnk2GL4+Qw9NHizILw= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -41,12 +39,6 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0= -github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= -github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= -github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= -github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk= -github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= @@ -95,6 +87,8 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/linxGnu/grocksdb v1.7.1-0.20220327020612-ee0c6690507f h1:YZe3TyOTZ3EhMetKIYikAAN4mxSo83n/e9PyBwmj7EM= +github.com/linxGnu/grocksdb v1.7.1-0.20220327020612-ee0c6690507f/go.mod h1:JcMMDBFaDNhRXFYcYXmgQwb/RarSld1PulTI7UzE+w0= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= @@ -243,7 +237,8 @@ gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/rocksdb.go b/rocksdb.go index dd9be2a36..8db41d5ba 100644 --- a/rocksdb.go +++ b/rocksdb.go @@ -1,4 +1,4 @@ -// +build rocksdb +//go:build rocksdb package db @@ -7,7 +7,7 @@ import ( "path/filepath" "runtime" - "github.com/cosmos/gorocksdb" + "github.com/linxGnu/grocksdb" ) func init() { @@ -19,10 +19,10 @@ func init() { // RocksDB is a RocksDB backend. type RocksDB struct { - db *gorocksdb.DB - ro *gorocksdb.ReadOptions - wo *gorocksdb.WriteOptions - woSync *gorocksdb.WriteOptions + db *grocksdb.DB + ro *grocksdb.ReadOptions + wo *grocksdb.WriteOptions + woSync *grocksdb.WriteOptions } var _ DB = (*RocksDB)(nil) @@ -31,11 +31,11 @@ func NewRocksDB(name string, dir string) (*RocksDB, error) { // default rocksdb option, good enough for most cases, including heavy workloads. // 1GB table cache, 512MB write buffer(may use 50% more on heavy workloads). // compression: snappy as default, need to -lsnappy to enable. - bbto := gorocksdb.NewDefaultBlockBasedTableOptions() - bbto.SetBlockCache(gorocksdb.NewLRUCache(1 << 30)) - bbto.SetFilterPolicy(gorocksdb.NewBloomFilter(10)) + bbto := grocksdb.NewDefaultBlockBasedTableOptions() + bbto.SetBlockCache(grocksdb.NewLRUCache(1 << 30)) + bbto.SetFilterPolicy(grocksdb.NewBloomFilter(10)) - opts := gorocksdb.NewDefaultOptions() + opts := grocksdb.NewDefaultOptions() opts.SetBlockBasedTableFactory(bbto) // SetMaxOpenFiles to 4096 seems to provide a reliable performance boost opts.SetMaxOpenFiles(4096) @@ -46,15 +46,15 @@ func NewRocksDB(name string, dir string) (*RocksDB, error) { return NewRocksDBWithOptions(name, dir, opts) } -func NewRocksDBWithOptions(name string, dir string, opts *gorocksdb.Options) (*RocksDB, error) { +func NewRocksDBWithOptions(name string, dir string, opts *grocksdb.Options) (*RocksDB, error) { dbPath := filepath.Join(dir, name+".db") - db, err := gorocksdb.OpenDb(opts, dbPath) + db, err := grocksdb.OpenDb(opts, dbPath) if err != nil { return nil, err } - ro := gorocksdb.NewDefaultReadOptions() - wo := gorocksdb.NewDefaultWriteOptions() - woSync := gorocksdb.NewDefaultWriteOptions() + ro := grocksdb.NewDefaultReadOptions() + wo := grocksdb.NewDefaultWriteOptions() + woSync := grocksdb.NewDefaultWriteOptions() woSync.SetSync(true) database := &RocksDB{ db: db, @@ -140,7 +140,7 @@ func (db *RocksDB) DeleteSync(key []byte) error { return nil } -func (db *RocksDB) DB() *gorocksdb.DB { +func (db *RocksDB) DB() *grocksdb.DB { return db.db } diff --git a/rocksdb_batch.go b/rocksdb_batch.go index af7e65c60..5aaf1b9cf 100644 --- a/rocksdb_batch.go +++ b/rocksdb_batch.go @@ -1,12 +1,12 @@ -// +build rocksdb +//go:build rocksdb package db -import "github.com/cosmos/gorocksdb" +import "github.com/linxGnu/grocksdb" type rocksDBBatch struct { db *RocksDB - batch *gorocksdb.WriteBatch + batch *grocksdb.WriteBatch } var _ Batch = (*rocksDBBatch)(nil) @@ -14,7 +14,7 @@ var _ Batch = (*rocksDBBatch)(nil) func newRocksDBBatch(db *RocksDB) *rocksDBBatch { return &rocksDBBatch{ db: db, - batch: gorocksdb.NewWriteBatch(), + batch: grocksdb.NewWriteBatch(), } } diff --git a/rocksdb_iterator.go b/rocksdb_iterator.go index 9970c169e..53fa9a917 100644 --- a/rocksdb_iterator.go +++ b/rocksdb_iterator.go @@ -1,3 +1,4 @@ +//go:build rocksdb // +build rocksdb package db @@ -5,11 +6,11 @@ package db import ( "bytes" - "github.com/cosmos/gorocksdb" + "github.com/linxGnu/grocksdb" ) type rocksDBIterator struct { - source *gorocksdb.Iterator + source *grocksdb.Iterator start, end []byte isReverse bool isInvalid bool @@ -17,7 +18,7 @@ type rocksDBIterator struct { var _ Iterator = (*rocksDBIterator)(nil) -func newRocksDBIterator(source *gorocksdb.Iterator, start, end []byte, isReverse bool) *rocksDBIterator { +func newRocksDBIterator(source *grocksdb.Iterator, start, end []byte, isReverse bool) *rocksDBIterator { if isReverse { if end == nil { source.SeekToLast() @@ -55,7 +56,6 @@ func (itr *rocksDBIterator) Domain() ([]byte, []byte) { // Valid implements Iterator. func (itr *rocksDBIterator) Valid() bool { - // Once invalid, forever invalid. if itr.isInvalid { return false @@ -74,9 +74,9 @@ func (itr *rocksDBIterator) Valid() bool { } // If key is end or past it, invalid. - var start = itr.start - var end = itr.end - var key = moveSliceToBytes(itr.source.Key()) + start := itr.start + end := itr.end + key := moveSliceToBytes(itr.source.Key()) if itr.isReverse { if start != nil && bytes.Compare(key, start) < 0 { itr.isInvalid = true @@ -135,7 +135,7 @@ func (itr *rocksDBIterator) assertIsValid() { // moveSliceToBytes will free the slice and copy out a go []byte // This function can be applied on *Slice returned from Key() and Value() // of an Iterator, because they are marked as freed. -func moveSliceToBytes(s *gorocksdb.Slice) []byte { +func moveSliceToBytes(s *grocksdb.Slice) []byte { defer s.Free() if !s.Exists() { return nil diff --git a/rocksdb_test.go b/rocksdb_test.go index 6bbe51133..b3c6589f5 100644 --- a/rocksdb_test.go +++ b/rocksdb_test.go @@ -1,4 +1,4 @@ -// +build rocksdb +//go:build rocksdb package db @@ -32,4 +32,19 @@ func TestRocksDBStats(t *testing.T) { assert.NotEmpty(t, db.Stats()) } +func BenchmarkRocksDBRandomReadsWrites(b *testing.B) { + name := fmt.Sprintf("test_%x", randStr(12)) + dir := os.TempDir() + db, err := NewDB(name, RocksDBBackend, dir) + if err != nil { + b.Fatal(err) + } + defer func() { + db.Close() + cleanupDBDir("", name) + }() + + benchmarkRandomReadsWrites(b, db) +} + // TODO: Add tests for rocksdb From 44c7d2eef2a7deb7e555a5d468ca19f3729eb54c Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Tue, 12 Apr 2022 03:39:49 +0700 Subject: [PATCH 09/11] update Dockerfile --- Dockerfile | 3 +++ tools/Dockerfile | 46 +++------------------------------------------- 2 files changed, 6 insertions(+), 43 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..eb5beb87e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,3 @@ +FROM faddat/archlinux + +RUN pacman -Syyu --noconfirm go git rocksdb leveldb diff --git a/tools/Dockerfile b/tools/Dockerfile index 855414aab..94f7ff813 100644 --- a/tools/Dockerfile +++ b/tools/Dockerfile @@ -1,44 +1,4 @@ -# This file defines the container image used to build and test tm-db in CI. -# The CI workflows use the latest tag of tendermintdev/docker-tm-db-testing -# built from these settings. -# -# The jobs defined in the Build & Push workflow will build and update the image -# when changes to this file are merged. If you have other changes that require -# updates here, merge the changes here first and let the image get updated (or -# push a new version manually) before PRs that depend on them. +FROM faddat/archlinux -FROM golang:1.17-bullseye AS build - -ENV LD_LIBRARY_PATH=/usr/local/lib - -RUN apt-get update && apt-get install -y --no-install-recommends \ - libbz2-dev libgflags-dev libsnappy-dev libzstd-dev zlib1g-dev \ - make tar wget - -FROM build AS install -ARG LEVELDB=1.20 -ARG ROCKSDB=6.24.2 - -# Install cleveldb -RUN \ - wget -q https://github.com/google/leveldb/archive/v${LEVELDB}.tar.gz \ - && tar xvf v${LEVELDB}.tar.gz \ - && cd leveldb-${LEVELDB} \ - && make \ - && cp -a out-static/lib* out-shared/lib* /usr/local/lib \ - && cd include \ - && cp -a leveldb /usr/local/include \ - && ldconfig \ - && cd ../.. \ - && rm -rf v${LEVELDB}.tar.gz leveldb-${LEVELDB} - -# Install Rocksdb -RUN \ - wget -q https://github.com/facebook/rocksdb/archive/v${ROCKSDB}.tar.gz \ - && tar -zxf v${ROCKSDB}.tar.gz \ - && cd rocksdb-${ROCKSDB} \ - && DEBUG_LEVEL=0 make -j4 shared_lib \ - && make install-shared \ - && ldconfig \ - && cd .. \ - && rm -rf v${ROCKSDB}.tar.gz rocksdb-${ROCKSDB} +RUN pacman -Sy --noconfirm archlinux-keyring +RUN pacman -Syyu --noconfirm go git rocksdb leveldb From ce7694c8ba04d79140e0a151e1c11db7d5f124c9 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Tue, 12 Apr 2022 03:42:39 +0700 Subject: [PATCH 10/11] update version of rocksdb in Dockerfile :) --- tools/Dockerfile | 46 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/tools/Dockerfile b/tools/Dockerfile index 94f7ff813..51f9195af 100644 --- a/tools/Dockerfile +++ b/tools/Dockerfile @@ -1,4 +1,44 @@ -FROM faddat/archlinux +# This file defines the container image used to build and test tm-db in CI. +# The CI workflows use the latest tag of tendermintdev/docker-tm-db-testing +# built from these settings. +# +# The jobs defined in the Build & Push workflow will build and update the image +# when changes to this file are merged. If you have other changes that require +# updates here, merge the changes here first and let the image get updated (or +# push a new version manually) before PRs that depend on them. -RUN pacman -Sy --noconfirm archlinux-keyring -RUN pacman -Syyu --noconfirm go git rocksdb leveldb +FROM golang:1.17-bullseye AS build + +ENV LD_LIBRARY_PATH=/usr/local/lib + +RUN apt-get update && apt-get install -y --no-install-recommends \ + libbz2-dev libgflags-dev libsnappy-dev libzstd-dev zlib1g-dev \ + make tar wget + +FROM build AS install +ARG LEVELDB=1.20 +ARG ROCKSDB=7.0.3 + +# Install cleveldb +RUN \ + wget -q https://github.com/google/leveldb/archive/v${LEVELDB}.tar.gz \ + && tar xvf v${LEVELDB}.tar.gz \ + && cd leveldb-${LEVELDB} \ + && make \ + && cp -a out-static/lib* out-shared/lib* /usr/local/lib \ + && cd include \ + && cp -a leveldb /usr/local/include \ + && ldconfig \ + && cd ../.. \ + && rm -rf v${LEVELDB}.tar.gz leveldb-${LEVELDB} + +# Install Rocksdb +RUN \ + wget -q https://github.com/facebook/rocksdb/archive/v${ROCKSDB}.tar.gz \ + && tar -zxf v${ROCKSDB}.tar.gz \ + && cd rocksdb-${ROCKSDB} \ + && DEBUG_LEVEL=0 make -j4 shared_lib \ + && make install-shared \ + && ldconfig \ + && cd .. \ + && rm -rf v${ROCKSDB}.tar.gz rocksdb-${ROCKSDB} \ No newline at end of file From 005528ec7117cbd8a9fad9740e8101d7eb7baeb6 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Tue, 12 Apr 2022 04:57:24 +0700 Subject: [PATCH 11/11] Delete Dockerfile --- Dockerfile | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index eb5beb87e..000000000 --- a/Dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -FROM faddat/archlinux - -RUN pacman -Syyu --noconfirm go git rocksdb leveldb