[#2200] shard: Fix blobstor obj fetching
In the previous implementation any non-nil error that preceded object fetching from blobstor led to iterating over every storage (in other words, no storage ID information was taken into account). Now storage ID is skipped only if metabase (storage ID source) returns any error. Signed-off-by: Pavel Karpy <p.karpy@yadro.com> Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
cf1a91a758
commit
91757329ae
2 changed files with 11 additions and 10 deletions
|
@ -10,6 +10,7 @@ Changelog for FrostFS Node
|
|||
### Fixed
|
||||
- Big object removal with non-local parts (#1978)
|
||||
- Disable pilorama when moving to degraded mode (#2197)
|
||||
- Fetching blobovnicza objects that not found in write-cache (#2206)
|
||||
- Correct status error for expired session token (#2207)
|
||||
|
||||
### Removed
|
||||
|
|
|
@ -94,8 +94,8 @@ func (s *Shard) Get(prm GetPrm) (GetRes, error) {
|
|||
// fetchObjectData looks through writeCache and blobStor to find object.
|
||||
func (s *Shard) fetchObjectData(addr oid.Address, skipMeta bool, cb storFetcher, wc func(w writecache.Cache) (*objectSDK.Object, error)) (*objectSDK.Object, bool, error) {
|
||||
var (
|
||||
err error
|
||||
res *objectSDK.Object
|
||||
mErr error
|
||||
mRes meta.ExistsRes
|
||||
)
|
||||
|
||||
var exists bool
|
||||
|
@ -103,15 +103,15 @@ func (s *Shard) fetchObjectData(addr oid.Address, skipMeta bool, cb storFetcher,
|
|||
var mPrm meta.ExistsPrm
|
||||
mPrm.SetAddress(addr)
|
||||
|
||||
mRes, err := s.metaBase.Exists(mPrm)
|
||||
if err != nil && !s.info.Mode.NoMetabase() {
|
||||
return res, false, err
|
||||
mRes, mErr = s.metaBase.Exists(mPrm)
|
||||
if mErr != nil && !s.info.Mode.NoMetabase() {
|
||||
return nil, false, mErr
|
||||
}
|
||||
exists = mRes.Exists()
|
||||
}
|
||||
|
||||
if s.hasWriteCache() {
|
||||
res, err = wc(s.writeCache)
|
||||
res, err := wc(s.writeCache)
|
||||
if err == nil || IsErrOutOfRange(err) {
|
||||
return res, false, err
|
||||
}
|
||||
|
@ -123,8 +123,8 @@ func (s *Shard) fetchObjectData(addr oid.Address, skipMeta bool, cb storFetcher,
|
|||
}
|
||||
}
|
||||
|
||||
if skipMeta || err != nil {
|
||||
res, err = cb(s.blobStor, nil)
|
||||
if skipMeta || mErr != nil {
|
||||
res, err := cb(s.blobStor, nil)
|
||||
return res, false, err
|
||||
}
|
||||
|
||||
|
@ -135,12 +135,12 @@ func (s *Shard) fetchObjectData(addr oid.Address, skipMeta bool, cb storFetcher,
|
|||
var mPrm meta.StorageIDPrm
|
||||
mPrm.SetAddress(addr)
|
||||
|
||||
mRes, err := s.metaBase.StorageID(mPrm)
|
||||
mExRes, err := s.metaBase.StorageID(mPrm)
|
||||
if err != nil {
|
||||
return nil, true, fmt.Errorf("can't fetch blobovnicza id from metabase: %w", err)
|
||||
}
|
||||
|
||||
res, err = cb(s.blobStor, mRes.StorageID())
|
||||
res, err := cb(s.blobStor, mExRes.StorageID())
|
||||
|
||||
return res, true, err
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue