From b07e713f9e1584fbcea5df36dc525909637aed90 Mon Sep 17 00:00:00 2001 From: Bill Katz Date: Fri, 3 May 2024 22:32:25 -0400 Subject: [PATCH] complete mods to deprecate basholeveldb as default --- README-precomputed.md | 6 +++--- conf/config.example | 8 ++++---- datastore/badger.go | 6 +++++- datastore/basholeveldb.go | 7 +++++-- datastore/test_support.go | 2 +- datatype/imageblk/imageblk.go | 2 +- datatype/tarsupervoxels/basholeveldb_test.go | 9 --------- dvid/storage.go | 2 +- scripts/distro-files/config-full.toml | 8 ++++---- scripts/distro-files/config-simple.toml | 4 ++-- server/rpc.go | 4 ++-- server/server_local_test.go | 6 +++--- storage/badger/badger.go | 2 +- storage/kvautobus/kvautobus_test.go | 9 +++++---- storage/storage.go | 4 +++- 15 files changed, 40 insertions(+), 39 deletions(-) delete mode 100644 datatype/tarsupervoxels/basholeveldb_test.go diff --git a/README-precomputed.md b/README-precomputed.md index 889e1844..bc4e8f94 100644 --- a/README-precomputed.md +++ b/README-precomputed.md @@ -34,12 +34,12 @@ max_log_age = 30 [store] [store.mainstore] - engine = "basholeveldb" - path = "/data/dvid/db/leveldb" + engine = "badger" + path = "/data/dvid/db/mydb" [store.mutationlog] engine = "filelog" - path = "/data/dvid/db/mlog-leveldb" + path = "/data/dvid/db/mutationlog" [store.mystorage] engine = "ngprecomputed" diff --git a/conf/config.example b/conf/config.example index 531bdd9d..03dcea9e 100644 --- a/conf/config.example +++ b/conf/config.example @@ -5,9 +5,9 @@ webClient = "/console" [backend] [backend.default] - store = "mutable" - log = "mutationlog" + store = "mutable" + log = "mutationlog" [store] [store.mutable] - engine = "basholeveldb" - path = "/data/dbs/dataset" + engine = "badger" + path = "/data/dbs/dataset" diff --git a/datastore/badger.go b/datastore/badger.go index 4b554a56..c49ea4f9 100644 --- a/datastore/badger.go +++ b/datastore/badger.go @@ -1,5 +1,9 @@ +//go:build badger // +build badger package datastore -import _ "github.com/janelia-flyem/dvid/storage/badger" +import ( + _ "github.com/janelia-flyem/dvid/storage/badger" + _ "github.com/janelia-flyem/dvid/storage/filelog" +) diff --git a/datastore/basholeveldb.go b/datastore/basholeveldb.go index 76114904..3278074b 100644 --- a/datastore/basholeveldb.go +++ b/datastore/basholeveldb.go @@ -1,6 +1,9 @@ +//go:build basholeveldb // +build basholeveldb package datastore -import _ "github.com/janelia-flyem/dvid/storage/basholeveldb" -import _ "github.com/janelia-flyem/dvid/storage/filelog" +import ( + _ "github.com/janelia-flyem/dvid/storage/basholeveldb" + _ "github.com/janelia-flyem/dvid/storage/filelog" +) diff --git a/datastore/test_support.go b/datastore/test_support.go index 2d811fb6..580ae19a 100644 --- a/datastore/test_support.go +++ b/datastore/test_support.go @@ -38,7 +38,7 @@ func openStores(create bool, datamap ...DataStorageMap) { if len(datamap) > 1 { log.Fatalf("can't have more than one data mapping in opening stores") } - dvid.Infof("Opening test datastore. Create = %v\n", create) + dvid.Infof("Opening test datastore. Create (%t), Datamap: %v\n", create, datamap) if create { var err error if len(datamap) == 1 { diff --git a/datatype/imageblk/imageblk.go b/datatype/imageblk/imageblk.go index 5252653c..fe6e01f7 100644 --- a/datatype/imageblk/imageblk.go +++ b/datatype/imageblk/imageblk.go @@ -523,7 +523,7 @@ func NewType(values dvid.DataValues, interpolable bool) Type { // NewData returns a pointer to a new Voxels with default values. func (dtype *Type) NewData(uuid dvid.UUID, id dvid.InstanceID, name dvid.InstanceName, c dvid.Config) (*Data, error) { - dvid.Infof("NewData on name %q\n", name) + dvid.Infof("NewData on imageblk name %q with config: %v\n", name, c) basedata, err := datastore.NewDataService(dtype, uuid, id, name, c) if err != nil { return nil, err diff --git a/datatype/tarsupervoxels/basholeveldb_test.go b/datatype/tarsupervoxels/basholeveldb_test.go deleted file mode 100644 index 90da2a2d..00000000 --- a/datatype/tarsupervoxels/basholeveldb_test.go +++ /dev/null @@ -1,9 +0,0 @@ -// +build basholeveldb - -package tarsupervoxels - -import "testing" - -func TestBasholeveldbTarballRoundTrip(t *testing.T) { - testTarball(t, "basholeveldb") -} diff --git a/dvid/storage.go b/dvid/storage.go index 8ee579d1..00e81be9 100644 --- a/dvid/storage.go +++ b/dvid/storage.go @@ -36,7 +36,7 @@ type AutoInstanceStore interface { type StoreConfig struct { Config - // Engine is a simple name describing the engine, e.g., "basholeveldb" + // Engine is a simple name describing the engine, e.g., "badger" Engine string } diff --git a/scripts/distro-files/config-full.toml b/scripts/distro-files/config-full.toml index f183177a..f3f740b9 100644 --- a/scripts/distro-files/config-full.toml +++ b/scripts/distro-files/config-full.toml @@ -143,12 +143,12 @@ blobstore = "raid6" [store] [store.raid6] - engine = "basholeveldb" - path = "/data/dbs/basholeveldb" + engine = "badger" + path = "/data/dbs/badgerdb" [store.ssd] - engine = "basholeveldb" - path = "/datassd/dbs/basholeveldb" + engine = "badger" + path = "/datassd/dbs/badgerdb" [store.badger] engine = "badger" diff --git a/scripts/distro-files/config-simple.toml b/scripts/distro-files/config-simple.toml index 555adca2..b13ec818 100644 --- a/scripts/distro-files/config-simple.toml +++ b/scripts/distro-files/config-simple.toml @@ -41,8 +41,8 @@ max_log_age = 30 # days [store] [store.instancedata] - engine = "basholeveldb" - path = "/tmp/basholeveldb" + engine = "badger" + path = "/tmp/badgerdb" [store.mutationlog] engine = "filelog" diff --git a/server/rpc.go b/server/rpc.go index b18ed492..d356e6bf 100644 --- a/server/rpc.go +++ b/server/rpc.go @@ -120,7 +120,7 @@ EXPERIMENTAL COMMANDS "SrcStore": "source store", "DstStore": { "Path": "/path/to/store", - "Engine": "basholeveldb" + "Engine": "badger" } }, { @@ -157,7 +157,7 @@ EXPERIMENTAL COMMANDS "Versions": ["2881e9","52a13","57e8d"], "Exclusions": ["name1", "name2"], "DstStore": { - "Engine": "basholeveldb", + "Engine": "badger", "Path": "/path/to/new/metadata_db" }, "Alias": "my new repo alias", diff --git a/server/server_local_test.go b/server/server_local_test.go index 1e02c6ee..b496fd2b 100644 --- a/server/server_local_test.go +++ b/server/server_local_test.go @@ -201,11 +201,11 @@ func TestTOMLConfigAbsolutePath(t *testing.T) { c.Store = make(map[storage.Alias]storeConfig) c.Store["foo"] = make(storeConfig) - c.Store["foo"]["engine"] = "basholeveldb" + c.Store["foo"]["engine"] = "badger" c.Store["foo"]["path"] = "foo-storage-db" c.Store["bar"] = make(storeConfig) - c.Store["bar"]["engine"] = "basholeveldb" + c.Store["bar"]["engine"] = "badger" c.Store["bar"]["path"] = "/tmp/bar-storage-db" // Already absolute, should stay unchanged. // Convert relative paths to absolute @@ -227,7 +227,7 @@ func TestTOMLConfigAbsolutePath(t *testing.T) { } engine := foo["engine"] - if engine.(string) != "basholeveldb" { + if engine.(string) != "badger" { t.Errorf("[store.foo].engine should not have been touched: %s", path) } diff --git a/storage/badger/badger.go b/storage/badger/badger.go index 23b892cf..8b55b512 100644 --- a/storage/badger/badger.go +++ b/storage/badger/badger.go @@ -1033,7 +1033,7 @@ func (db *BadgerDB) DeleteAll(ctx storage.Context) error { if err != nil { return err } - name = vctx.Data().DataName() + name = string(vctx.Data().DataName()) } else { minKey, maxKey = ctx.KeyRange() name = ctx.String() diff --git a/storage/kvautobus/kvautobus_test.go b/storage/kvautobus/kvautobus_test.go index d74757fd..1e279a03 100644 --- a/storage/kvautobus/kvautobus_test.go +++ b/storage/kvautobus/kvautobus_test.go @@ -1,3 +1,4 @@ +//go:build kvautobus // +build kvautobus package kvautobus @@ -15,12 +16,12 @@ import ( const testConfig = ` [store] [store.raid6] - engine = "basholeveldb" - path = "/data/dbs/basholeveldb" + engine = "badger" + path = "/data/dbs/badgerdb" [store.ssd] - engine = "basholeveldb" - path = "/datassd/dbs/basholeveldb" + engine = "badger" + path = "/datassd/dbs/badgerdb" [store.kvautobus] engine = "kvautobus" diff --git a/storage/storage.go b/storage/storage.go index b48597c9..5cf99b7b 100644 --- a/storage/storage.go +++ b/storage/storage.go @@ -48,7 +48,7 @@ type Requirements struct { type Engine interface { fmt.Stringer - // GetName returns a simple driver identifier like "basholeveldb", "kvautobus" or "bigtable". + // GetName returns a simple driver identifier like "badger", "kvautobus" or "bigtable". GetName() string // IsDistributed returns whether the engine is a distributed DB (engine should manage request throttling) @@ -129,6 +129,7 @@ func GetTestableBackend(kvMap, logMap DataMap) (map[Alias]TestableEngine, *Backe if err != nil { dvid.Errorf("checking engine %q: %v\n", e, err) } else { + dvid.Infof("Found testable engine %q with alias %q\n", e, alias) engines[alias] = tEng found = true } @@ -136,6 +137,7 @@ func GetTestableBackend(kvMap, logMap DataMap) (map[Alias]TestableEngine, *Backe } backend.KVAssign = kvMap backend.LogAssign = logMap + dvid.Infof("For new testable backend (%v) assigned KV: %v, Log: %v\n", backend, kvMap, logMap) if !found { return nil, nil, fmt.Errorf("could not find any testable storage configuration") }