[#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 <p.karpy@yadro.com>
This commit is contained in:
Pavel Karpy 2023-02-17 17:23:09 +03:00 committed by Pavel Karpy
parent 5303736acd
commit 3beef10f89
2 changed files with 7 additions and 9 deletions

View file

@ -39,6 +39,7 @@ Changelog for FrostFS Node
- Storage ID update by write-cache (#2244) - Storage ID update by write-cache (#2244)
- `neo-go` client deadlock on subscription restoration (#2244) - `neo-go` client deadlock on subscription restoration (#2244)
- Possible panic during write-cache initialization (#2234) - Possible panic during write-cache initialization (#2234)
- Do not fetch an object if `meta` is missing it (#61)
### Removed ### Removed
### Updated ### Updated

View file

@ -102,16 +102,19 @@ func (s *Shard) fetchObjectData(addr oid.Address, skipMeta bool, cb storFetcher,
mRes meta.ExistsRes mRes meta.ExistsRes
) )
var exists bool
if !skipMeta { if !skipMeta {
var mPrm meta.ExistsPrm var mPrm meta.ExistsPrm
mPrm.SetAddress(addr) mPrm.SetAddress(addr)
mRes, mErr = s.metaBase.Exists(mPrm) mRes, mErr = s.metaBase.Exists(mPrm)
if mErr != nil && !s.info.Mode.NoMetabase() { if mErr != nil && !s.info.Mode.NoMetabase() {
return nil, false, mErr 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() { if s.hasWriteCache() {
@ -119,7 +122,6 @@ func (s *Shard) fetchObjectData(addr oid.Address, skipMeta bool, cb storFetcher,
if err == nil || IsErrOutOfRange(err) { if err == nil || IsErrOutOfRange(err) {
return res, false, err return res, false, err
} }
if IsErrNotFound(err) { if IsErrNotFound(err) {
s.log.Debug("object is missing in write-cache", s.log.Debug("object is missing in write-cache",
zap.Stringer("addr", addr), zap.Stringer("addr", addr),
@ -131,16 +133,11 @@ func (s *Shard) fetchObjectData(addr oid.Address, skipMeta bool, cb storFetcher,
zap.Bool("skip_meta", skipMeta)) zap.Bool("skip_meta", skipMeta))
} }
} }
if skipMeta || mErr != nil { if skipMeta || mErr != nil {
res, err := cb(s.blobStor, nil) res, err := cb(s.blobStor, nil)
return res, false, err return res, false, err
} }
if !exists {
return nil, false, logicerr.Wrap(apistatus.ObjectNotFound{})
}
var mPrm meta.StorageIDPrm var mPrm meta.StorageIDPrm
mPrm.SetAddress(addr) mPrm.SetAddress(addr)