From 3beef10f89e7a33b2675e341d46672d9302c1369 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Fri, 17 Feb 2023 17:23:09 +0300 Subject: [PATCH] [#61] node: Do not fetch missing objects If an object is missing in a `meta`, shard should not look for it in a `blobstor`. Signed-off-by: Pavel Karpy --- CHANGELOG.md | 1 + pkg/local_object_storage/shard/get.go | 15 ++++++--------- 2 files changed, 7 insertions(+), 9 deletions(-) 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)