Skip to content

Commit 603e2f3

Browse files
authored
Merge branch 'main' into main
2 parents 94576ef + fd7cdd6 commit 603e2f3

File tree

4 files changed

+6
-87
lines changed

4 files changed

+6
-87
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ Ref: https://keepachangelog.com/en/1.0.0/
3737

3838
## [Unreleased]
3939

40+
41+
### API Breaking Changes
42+
43+
* (types) [\#12355](https://github.com/cosmos/cosmos-sdk/pull/12355) Remove the compile-time `types.DBbackend` variable. Removes usage of the same in server/util.go
4044
### Features
4145

4246
* (cli) [#12028](https://github.com/cosmos/cosmos-sdk/pull/12028) Add the `tendermint key-migrate` to perform Tendermint v0.35 DB key migration.

server/util.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,9 +365,7 @@ func WaitForQuitSignals() ErrorCode {
365365
// GetAppDBBackend gets the backend type to use for the application DBs.
366366
func GetAppDBBackend(opts types.AppOptions) dbm.BackendType {
367367
rv := cast.ToString(opts.Get("app-db-backend"))
368-
if len(rv) == 0 {
369-
rv = sdk.DBBackend
370-
}
368+
371369
if len(rv) == 0 {
372370
rv = cast.ToString(opts.Get("db-backend"))
373371
}

server/util_test.go

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,15 @@ import (
1111
"testing"
1212

1313
"github.com/spf13/cobra"
14-
"github.com/stretchr/testify/assert"
1514
"github.com/stretchr/testify/require"
1615
tmcfg "github.com/tendermint/tendermint/config"
17-
dbm "github.com/tendermint/tm-db"
1816

1917
"github.com/cosmos/cosmos-sdk/client"
2018
"github.com/cosmos/cosmos-sdk/client/flags"
2119
"github.com/cosmos/cosmos-sdk/server"
2220
"github.com/cosmos/cosmos-sdk/server/config"
2321
servertypes "github.com/cosmos/cosmos-sdk/server/types"
2422
"github.com/cosmos/cosmos-sdk/simapp"
25-
"github.com/cosmos/cosmos-sdk/types"
2623
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
2724
genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
2825
)
@@ -450,76 +447,3 @@ func (m mapGetter) Get(key string) interface{} {
450447
}
451448

452449
var _ servertypes.AppOptions = mapGetter{}
453-
454-
func TestGetAppDBBackend(t *testing.T) {
455-
origDBBackend := types.DBBackend
456-
defer func() {
457-
types.DBBackend = origDBBackend
458-
}()
459-
tests := []struct {
460-
name string
461-
dbBack string
462-
opts mapGetter
463-
exp dbm.BackendType
464-
}{
465-
{
466-
name: "nothing set",
467-
dbBack: "",
468-
opts: mapGetter{},
469-
exp: dbm.GoLevelDBBackend,
470-
},
471-
472-
{
473-
name: "only db-backend set",
474-
dbBack: "",
475-
opts: mapGetter{"db-backend": "db-backend value 1"},
476-
exp: dbm.BackendType("db-backend value 1"),
477-
},
478-
{
479-
name: "only DBBackend set",
480-
dbBack: "DBBackend value 2",
481-
opts: mapGetter{},
482-
exp: dbm.BackendType("DBBackend value 2"),
483-
},
484-
{
485-
name: "only app-db-backend set",
486-
dbBack: "",
487-
opts: mapGetter{"app-db-backend": "app-db-backend value 3"},
488-
exp: dbm.BackendType("app-db-backend value 3"),
489-
},
490-
491-
{
492-
name: "app-db-backend and db-backend set",
493-
dbBack: "",
494-
opts: mapGetter{"db-backend": "db-backend value 4", "app-db-backend": "app-db-backend value 5"},
495-
exp: dbm.BackendType("app-db-backend value 5"),
496-
},
497-
{
498-
name: "app-db-backend and DBBackend set",
499-
dbBack: "DBBackend value 6",
500-
opts: mapGetter{"app-db-backend": "app-db-backend value 7"},
501-
exp: dbm.BackendType("app-db-backend value 7"),
502-
},
503-
{
504-
name: "db-backend and DBBackend set",
505-
dbBack: "DBBackend value 8",
506-
opts: mapGetter{"db-backend": "db-backend value 9"},
507-
exp: dbm.BackendType("DBBackend value 8"),
508-
},
509-
510-
{
511-
name: "all of app-db-backend db-backend DBBackend set",
512-
dbBack: "DBBackend value 10",
513-
opts: mapGetter{"db-backend": "db-backend value 11", "app-db-backend": "app-db-backend value 12"},
514-
exp: dbm.BackendType("app-db-backend value 12"),
515-
},
516-
}
517-
518-
for _, tc := range tests {
519-
t.Run(tc.name, func(st *testing.T) {
520-
types.DBBackend = tc.dbBack
521-
act := server.GetAppDBBackend(tc.opts)
522-
assert.Equal(st, tc.exp, act)
523-
})
524-
}
525-
}

types/utils.go

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,9 @@ import (
1212

1313
var (
1414
// This is set at compile time. Could be cleveldb, defaults is goleveldb.
15-
DBBackend = "" // Deprecated: Use tendermint config's DBBackend value instead.
16-
backend = dbm.GoLevelDBBackend
15+
backend = dbm.GoLevelDBBackend
1716
)
1817

19-
func init() {
20-
if len(DBBackend) != 0 {
21-
backend = dbm.BackendType(DBBackend)
22-
}
23-
}
24-
2518
// SortedJSON takes any JSON and returns it sorted by keys. Also, all white-spaces
2619
// are removed.
2720
// This method can be used to canonicalize JSON to be returned by GetSignBytes,

0 commit comments

Comments
 (0)