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

feat(pkg/db): remove cleveldb, fsdb and rocksdb #1714

Merged
merged 9 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ updates:
everything-else:
patterns:
- "*"
exclude-patterns:
# NOTE: grocksdb should be updated manually, to match the version
# available on Ubuntu's latest LTS release; and updated in conjunction
# with the ubuntu version on .github/workflows/db-tests.yml
- "github.com/linxGnu/grocksdb"
open-pull-requests-limit: 10
pull-request-branch-name:
separator: "-"
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/lint_template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ jobs:
go-version: ${{ inputs.go-version }}
- name: Checkout code
uses: actions/checkout@v4
- name: Install database dependencies
run: sudo apt-get install -y libleveldb-dev librocksdb-dev
- name: Lint
uses: golangci/golangci-lint-action@v5
with:
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/test_template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ jobs:
go-version: ${{ inputs.go-version }}
- name: Checkout code
uses: actions/checkout@v4
- name: Install database dependencies
run: sudo apt-get install -y libleveldb-dev librocksdb-dev
- name: Go test
run: go test -coverprofile coverage.out -covermode=atomic -timeout ${{ inputs.tests-timeout }} -v ./...
working-directory: ${{ inputs.modulepath }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tm2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- master
workflow_dispatch:
pull_request:
pull_request:
paths:
- "tm2/**"
- ".github/**"
Expand All @@ -17,4 +17,4 @@ jobs:
with:
modulepath: "tm2"
secrets:
codecov-token: ${{ secrets.CODECOV_TOKEN }}
codecov-token: ${{ secrets.CODECOV_TOKEN }}
1 change: 1 addition & 0 deletions contribs/gnodev/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ require (
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect
github.com/zondax/hid v0.9.2 // indirect
github.com/zondax/ledger-go v0.14.3 // indirect
go.etcd.io/bbolt v1.3.9 // indirect
go.opentelemetry.io/otel v1.25.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.25.0 // indirect
go.opentelemetry.io/otel/metric v1.25.0 // indirect
Expand Down
6 changes: 2 additions & 4 deletions contribs/gnodev/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions contribs/gnokeykc/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions gno.land/pkg/gnoland/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/gnolang/gno/tm2/pkg/store/iavl"

// Only goleveldb is supported for now.
_ "github.com/gnolang/gno/tm2/pkg/db/_tags"
_ "github.com/gnolang/gno/tm2/pkg/db/goleveldb"
"github.com/gnolang/gno/tm2/pkg/db/memdb"
)
Expand Down
3 changes: 0 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ require (
github.com/gorilla/mux v1.8.1
github.com/gorilla/websocket v1.5.1
github.com/gotuna/gotuna v0.6.0
github.com/jmhodges/levigo v1.0.0
github.com/libp2p/go-buffer-pool v0.1.0
github.com/linxGnu/grocksdb v1.6.20
github.com/mattn/go-runewidth v0.0.15
github.com/pelletier/go-toml v1.9.5
github.com/peterbourgon/ff/v3 v3.4.0
Expand Down Expand Up @@ -66,7 +64,6 @@ require (
github.com/zondax/ledger-go v0.14.3 // indirect
go.opentelemetry.io/otel/trace v1.25.0 // indirect
go.opentelemetry.io/proto/otlp v1.1.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de // indirect
Expand Down
16 changes: 2 additions & 14 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions tm2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,4 @@ _test.flappy:
_test.pkg.others:; go test $(GOTEST_FLAGS) `go list ./pkg/... | grep -Ev 'pkg/(amino|bft|db|iavl/benchmarks)(/|$$)'`
_test.pkg.amino:; go test $(GOTEST_FLAGS) ./pkg/amino/...
_test.pkg.bft:; go test $(GOTEST_FLAGS) ./pkg/bft/...

_test.pkg.db:
CGO_ENABLED=$(CGO_ENABLED) go test $(GOTEST_FLAGS) ./pkg/db/... ./pkg/iavl/benchmarks/...
_test.pkg.db:; go test $(GOTEST_FLAGS) ./pkg/db/... ./pkg/iavl/benchmarks/...
16 changes: 7 additions & 9 deletions tm2/pkg/bft/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"os"
"path/filepath"
"regexp"
"slices"

"dario.cat/mergo"
abci "github.com/gnolang/gno/tm2/pkg/bft/abci/types"
Expand Down Expand Up @@ -256,19 +257,15 @@ type BaseConfig struct {
// and verifying their commits
FastSyncMode bool `toml:"fast_sync" comment:"If this node is many blocks behind the tip of the chain, FastSync\n allows them to catchup quickly by downloading blocks in parallel\n and verifying their commits"`

// Database backend: goleveldb | cleveldb | boltdb
// Database backend: goleveldb | boltdb
// * goleveldb (github.com/syndtr/goleveldb - most popular implementation)
// - pure go
// - stable
// * cleveldb (uses levigo wrapper)
// - fast
// - requires gcc
// - use cleveldb build tag (go build -tags cleveldb)
// * boltdb (uses etcd's fork of bolt - go.etcd.io/bbolt)
// - EXPERIMENTAL
// - may be faster is some use-cases (random reads - indexer)
// - use boltdb build tag (go build -tags boltdb)
DBBackend string `toml:"db_backend" comment:"Database backend: goleveldb | cleveldb | boltdb\n * goleveldb (github.com/syndtr/goleveldb - most popular implementation)\n - pure go\n - stable\n * cleveldb (uses levigo wrapper)\n - fast\n - requires gcc\n - use cleveldb build tag (go build -tags cleveldb)\n * boltdb (uses etcd's fork of bolt - go.etcd.io/bbolt)\n - EXPERIMENTAL\n - may be faster is some use-cases (random reads - indexer)\n - use boltdb build tag (go build -tags boltdb)"`
DBBackend string `toml:"db_backend" comment:"Database backend: goleveldb | boltdb\n * goleveldb (github.com/syndtr/goleveldb - most popular implementation)\n - pure go\n - stable\n* boltdb (uses etcd's fork of bolt - go.etcd.io/bbolt)\n - EXPERIMENTAL\n - may be faster is some use-cases (random reads - indexer)\n - use boltdb build tag (go build -tags boltdb)"`

// Database directory
DBPath string `toml:"db_dir" comment:"Database directory"`
Expand Down Expand Up @@ -369,9 +366,10 @@ func (cfg BaseConfig) ValidateBasic() error {
}

// Verify the DB backend
if cfg.DBBackend != db.GoLevelDBBackend.String() &&
cfg.DBBackend != db.CLevelDBBackend.String() &&
cfg.DBBackend != db.BoltDBBackend.String() {
// This will reject also any databases that haven't been added with build tags.
// always reject memdb, as it shouldn't be used as a real-life database.
if cfg.DBBackend == "memdb" ||
!slices.Contains(db.BackendList(), db.BackendType(cfg.DBBackend)) {
return errInvalidDBBackend
}

Expand Down
3 changes: 3 additions & 0 deletions tm2/pkg/bft/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import (

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

// allows the default config to have a valid DB
_ "github.com/gnolang/gno/tm2/pkg/db/goleveldb"
)

func TestConfig_LoadOrMakeConfigWithOptions(t *testing.T) {
Expand Down
4 changes: 1 addition & 3 deletions tm2/pkg/bft/state/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ import (
"github.com/gnolang/gno/tm2/pkg/bft/types"
"github.com/gnolang/gno/tm2/pkg/crypto/ed25519"
dbm "github.com/gnolang/gno/tm2/pkg/db"
_ "github.com/gnolang/gno/tm2/pkg/db/_tags"
_ "github.com/gnolang/gno/tm2/pkg/db/goleveldb"
_ "github.com/gnolang/gno/tm2/pkg/db/memdb"
_ "github.com/gnolang/gno/tm2/pkg/db/_all"
"github.com/gnolang/gno/tm2/pkg/random"
)

Expand Down
5 changes: 0 additions & 5 deletions tm2/pkg/db/_all/all.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
// Package all imports all available databases. It is useful mostly in tests.
//
// cgo databases (rocksdb, cleveldb) will be excluded if CGO_ENABLED=0.
package all

import (
// Keep in sync with list of non-cgo backends.
// Add cgo backends in all_cgo.go.
_ "github.com/gnolang/gno/tm2/pkg/db/boltdb"
_ "github.com/gnolang/gno/tm2/pkg/db/fsdb"
_ "github.com/gnolang/gno/tm2/pkg/db/goleveldb"
_ "github.com/gnolang/gno/tm2/pkg/db/memdb"
)
10 changes: 0 additions & 10 deletions tm2/pkg/db/_all/all_cgo.go

This file was deleted.

5 changes: 0 additions & 5 deletions tm2/pkg/db/_tags/cleveldb.go

This file was deleted.

5 changes: 0 additions & 5 deletions tm2/pkg/db/_tags/fsdb.go

This file was deleted.

5 changes: 0 additions & 5 deletions tm2/pkg/db/_tags/rocksdb.go

This file was deleted.

Loading
Loading