Fix/Do not fetch missing objects #61

Merged
carpawell merged 1 commit from fix/do-not-fetch-missing-obj into master 2023-02-20 11:47:39 +00:00
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)
- `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

View file

@ -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 {
carpawell commented 2023-02-20 11:33:34 +00:00 (Migrated from github.com)
Review

5303736acd/pkg/local_object_storage/shard/get.go (L85)

that line saves us from that if branch execution without meta

https://github.com/TrueCloudLab/frostfs-node/blob/5303736acd240809c67847c2c898f97a3e419d05/pkg/local_object_storage/shard/get.go#L85 that line saves us from that `if` branch execution without meta
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)