From e8d401e28df588543228a6abf676f02900ca2518 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 b4d399a9b4..d754a86efe 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()