diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e5592195..6b448e265 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ Changelog for FrostFS Node - Storage ID update by write-cache (#2244) - `neo-go` client deadlock on subscription restoration (#2244) - Possible panic during write-cache initialization (#2234) +- Do not fetch an object if `meta` is missing it (#61) ### Removed ### Updated diff --git a/pkg/local_object_storage/shard/get.go b/pkg/local_object_storage/shard/get.go index 607d508d3..934684655 100644 --- a/pkg/local_object_storage/shard/get.go +++ b/pkg/local_object_storage/shard/get.go @@ -102,16 +102,19 @@ func (s *Shard) fetchObjectData(addr oid.Address, skipMeta bool, cb storFetcher, mRes meta.ExistsRes ) - var exists bool if !skipMeta { var mPrm meta.ExistsPrm mPrm.SetAddress(addr) - mRes, mErr = s.metaBase.Exists(mPrm) if mErr != nil && !s.info.Mode.NoMetabase() { return nil, false, mErr } - exists = mRes.Exists() + + if !mRes.Exists() { + return nil, false, logicerr.Wrap(apistatus.ObjectNotFound{}) + } + } else { + s.log.Warn("fetching object without meta", zap.Stringer("addr", addr)) } if s.hasWriteCache() { @@ -119,7 +122,6 @@ func (s *Shard) fetchObjectData(addr oid.Address, skipMeta bool, cb storFetcher, if err == nil || IsErrOutOfRange(err) { return res, false, err } - if IsErrNotFound(err) { s.log.Debug("object is missing in write-cache", zap.Stringer("addr", addr), @@ -131,16 +133,11 @@ func (s *Shard) fetchObjectData(addr oid.Address, skipMeta bool, cb storFetcher, zap.Bool("skip_meta", skipMeta)) } } - if skipMeta || mErr != nil { res, err := cb(s.blobStor, nil) return res, false, err } - if !exists { - return nil, false, logicerr.Wrap(apistatus.ObjectNotFound{}) - } - var mPrm meta.StorageIDPrm mPrm.SetAddress(addr)