diff --git a/pkg/local_object_storage/metabase/mode.go b/pkg/local_object_storage/metabase/mode.go index c49437f97..6f09227de 100644 --- a/pkg/local_object_storage/metabase/mode.go +++ b/pkg/local_object_storage/metabase/mode.go @@ -1,8 +1,10 @@ package meta import ( + "context" "fmt" + "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/metaerr" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard/mode" ) @@ -17,7 +19,7 @@ func (db *DB) SetMode(m mode.Mode) error { } if !db.mode.NoMetabase() { - if err := db.Close(); err != nil { + if err := db.close(); err != nil { return fmt.Errorf("can't set metabase mode (old=%s, new=%s): %w", db.mode, m, err) } } @@ -27,7 +29,7 @@ func (db *DB) SetMode(m mode.Mode) error { } else { err := db.openDB(m) if err == nil && !m.ReadOnly() { - err = db.Init() + err = metaerr.Wrap(db.init(context.TODO(), false)) } if err != nil { return fmt.Errorf("can't set metabase mode (old=%s, new=%s): %w", db.mode, m, err)