[#2057] meta: Do not lock the whole meta on GET

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2022-11-15 15:43:38 +03:00 committed by fyrchik
parent fa231b8c56
commit 3d6defd3e8

View file

@ -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()