From 3d6defd3e8b9e4e0e702b3ed60e45bf21b3acb5b Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 15 Nov 2022 15:43:38 +0300 Subject: [PATCH] [#2057] meta: Do not lock the whole meta on `GET` Signed-off-by: Pavel Karpy --- pkg/local_object_storage/metabase/get.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/local_object_storage/metabase/get.go b/pkg/local_object_storage/metabase/get.go index b4d399a9b..d754a86ef 100644 --- a/pkg/local_object_storage/metabase/get.go +++ b/pkg/local_object_storage/metabase/get.go @@ -47,8 +47,12 @@ func (r GetRes) Header() *objectSDK.Object { // Returns an error of type apistatus.ObjectAlreadyRemoved if object has been placed in graveyard. // Returns the object.ErrObjectIsExpired if the object is presented but already expired. func (db *DB) Get(prm GetPrm) (res GetRes, err error) { - db.modeMtx.Lock() - defer db.modeMtx.Unlock() + db.modeMtx.RLock() + defer db.modeMtx.RUnlock() + + if db.mode.NoMetabase() { + return res, ErrDegradedMode + } currEpoch := db.epochState.CurrentEpoch()