[#1143] shard: Support degraded mode in Get and GetRange

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2022-03-14 12:49:41 +03:00 committed by fyrchik
parent f058cead8f
commit 68903c9fd9

View file

@ -122,7 +122,15 @@ func (s *Shard) fetchObjectData(addr *addressSDK.Address, skipMeta bool, big, sm
}
}
if skipMeta {
var exists bool
if !skipMeta {
exists, err = meta.Exists(s.metaBase, addr)
if err != nil && s.GetMode() != ModeDegraded {
return res, false, err
}
}
if skipMeta || err != nil {
res, err = small(s.blobStor, nil)
if err == nil || errors.Is(err, object.ErrRangeOutOfBounds) {
return res, false, err
@ -131,11 +139,6 @@ func (s *Shard) fetchObjectData(addr *addressSDK.Address, skipMeta bool, big, sm
return res, false, err
}
exists, err := meta.Exists(s.metaBase, addr)
if err != nil {
return nil, false, err
}
if !exists {
var errNotFound apistatus.ObjectNotFound