[#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
|
### Fixed
|
||||||
- Big object removal with non-local parts (#1978)
|
- Big object removal with non-local parts (#1978)
|
||||||
- Disable pilorama when moving to degraded mode (#2197)
|
- 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)
|
- Correct status error for expired session token (#2207)
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
|
@ -94,8 +94,8 @@ func (s *Shard) Get(prm GetPrm) (GetRes, error) {
|
||||||
// fetchObjectData looks through writeCache and blobStor to find object.
|
// 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) {
|
func (s *Shard) fetchObjectData(addr oid.Address, skipMeta bool, cb storFetcher, wc func(w writecache.Cache) (*objectSDK.Object, error)) (*objectSDK.Object, bool, error) {
|
||||||
var (
|
var (
|
||||||
err error
|
mErr error
|
||||||
res *objectSDK.Object
|
mRes meta.ExistsRes
|
||||||
)
|
)
|
||||||
|
|
||||||
var exists bool
|
var exists bool
|
||||||
|
@ -103,15 +103,15 @@ func (s *Shard) fetchObjectData(addr oid.Address, skipMeta bool, cb storFetcher,
|
||||||
var mPrm meta.ExistsPrm
|
var mPrm meta.ExistsPrm
|
||||||
mPrm.SetAddress(addr)
|
mPrm.SetAddress(addr)
|
||||||
|
|
||||||
mRes, err := s.metaBase.Exists(mPrm)
|
mRes, mErr = s.metaBase.Exists(mPrm)
|
||||||
if err != nil && !s.info.Mode.NoMetabase() {
|
if mErr != nil && !s.info.Mode.NoMetabase() {
|
||||||
return res, false, err
|
return nil, false, mErr
|
||||||
}
|
}
|
||||||
exists = mRes.Exists()
|
exists = mRes.Exists()
|
||||||
}
|
}
|
||||||
|
|
||||||
if s.hasWriteCache() {
|
if s.hasWriteCache() {
|
||||||
res, err = wc(s.writeCache)
|
res, err := wc(s.writeCache)
|
||||||
if err == nil || IsErrOutOfRange(err) {
|
if err == nil || IsErrOutOfRange(err) {
|
||||||
return res, false, err
|
return res, false, err
|
||||||
}
|
}
|
||||||
|
@ -123,8 +123,8 @@ func (s *Shard) fetchObjectData(addr oid.Address, skipMeta bool, cb storFetcher,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if skipMeta || err != 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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,12 +135,12 @@ func (s *Shard) fetchObjectData(addr oid.Address, skipMeta bool, cb storFetcher,
|
||||||
var mPrm meta.StorageIDPrm
|
var mPrm meta.StorageIDPrm
|
||||||
mPrm.SetAddress(addr)
|
mPrm.SetAddress(addr)
|
||||||
|
|
||||||
mRes, err := s.metaBase.StorageID(mPrm)
|
mExRes, err := s.metaBase.StorageID(mPrm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, true, fmt.Errorf("can't fetch blobovnicza id from metabase: %w", err)
|
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
|
return res, true, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue