diff --git a/go/oasis-node/cmd/debug/dumpdb/dumpdb.go b/go/oasis-node/cmd/debug/dumpdb/dumpdb.go index 61b2e487af8..01c913d6248 100644 --- a/go/oasis-node/cmd/debug/dumpdb/dumpdb.go +++ b/go/oasis-node/cmd/debug/dumpdb/dumpdb.go @@ -6,6 +6,7 @@ import ( "fmt" "os" "path/filepath" + "strings" "time" "github.com/spf13/cobra" @@ -14,6 +15,7 @@ import ( beacon "github.com/oasisprotocol/oasis-core/go/beacon/api" "github.com/oasisprotocol/oasis-core/go/common/logging" + "github.com/oasisprotocol/oasis-core/go/config" "github.com/oasisprotocol/oasis-core/go/consensus/cometbft/abci" abciState "github.com/oasisprotocol/oasis-core/go/consensus/cometbft/abci/state" cmtAPI "github.com/oasisprotocol/oasis-core/go/consensus/cometbft/api" @@ -37,7 +39,7 @@ import ( scheduler "github.com/oasisprotocol/oasis-core/go/scheduler/api" staking "github.com/oasisprotocol/oasis-core/go/staking/api" storage "github.com/oasisprotocol/oasis-core/go/storage/api" - storageDB "github.com/oasisprotocol/oasis-core/go/storage/database" + storageDatabase "github.com/oasisprotocol/oasis-core/go/storage/database" "github.com/oasisprotocol/oasis-core/go/storage/mkvs/checkpoint" ) @@ -101,11 +103,18 @@ func doDumpDB(cmd *cobra.Command, _ []string) { // read-only mode because it needs to truncate the value log. // // Hope you have backups if you ever run into this. + b := strings.ToLower(config.GlobalConfig.Storage.Backend) + switch b { + case storageDatabase.BackendNameBadgerDB, storageDatabase.BackendNameRocksDB: + default: + logger.Error("unsupported storage backend", "backend", b) + return + } ctx := context.Background() ldb, _, stateRoot, err := abci.InitStateStorage( &abci.ApplicationConfig{ DataDir: filepath.Join(dataDir, cmtCommon.StateDir), - StorageBackend: storageDB.BackendNameBadgerDB, // No other backend for now. + StorageBackend: b, MemoryOnlyStorage: false, ReadOnlyStorage: viper.GetBool(cfgDumpReadOnlyDB), DisableCheckpointer: true, diff --git a/go/oasis-node/cmd/debug/storage/export.go b/go/oasis-node/cmd/debug/storage/export.go index 8ad848cbd04..d6394f7f8dd 100644 --- a/go/oasis-node/cmd/debug/storage/export.go +++ b/go/oasis-node/cmd/debug/storage/export.go @@ -167,7 +167,7 @@ func newDirectStorageBackend(dataDir string, namespace common.Namespace) (storag } switch b { - case storageDatabase.BackendNameBadgerDB: + case storageDatabase.BackendNameBadgerDB, storageDatabase.BackendNameRocksDB: cfg.DB = filepath.Join(cfg.DB, storageDatabase.DefaultFileName(cfg.Backend)) return storageDatabase.New(cfg) default: