From a4602e1183e4067a3b9f26bb98284d819edf2487 Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Tue, 2 Jul 2024 23:34:40 +0300 Subject: [PATCH] [#9999] metabase: Fix SetMode after db engine change to pebble Signed-off-by: Dmitrii Stepanov --- pkg/local_object_storage/metabase/mode.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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)