[#2200] shard: Do not fetch big objects from blobovniczas

Signed-off-by: Pavel Karpy <p.karpy@yadro.com>
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
carpawell/fix/multiple-cache-update-requests-FROST
Pavel Karpy 2023-01-17 18:58:26 +03:00 committed by fyrchik
parent 91757329ae
commit 64a5294b27
2 changed files with 14 additions and 1 deletions

View File

@ -11,6 +11,7 @@ Changelog for FrostFS Node
- 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)
- Do not search for the small objects in FSTree (#2206)
- Correct status error for expired session token (#2207)
### Removed

View File

@ -91,6 +91,10 @@ func (s *Shard) Get(prm GetPrm) (GetRes, error) {
}, err
}
// emptyStorageID is an empty storageID that indicates that
// an object is big (and is stored in an FSTree, not in a blobovnicza).
var emptyStorageID = make([]byte, 0)
// 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 (
@ -140,7 +144,15 @@ func (s *Shard) fetchObjectData(addr oid.Address, skipMeta bool, cb storFetcher,
return nil, true, fmt.Errorf("can't fetch blobovnicza id from metabase: %w", err)
}
res, err := cb(s.blobStor, mExRes.StorageID())
storageID := mExRes.StorageID()
if storageID == nil {
// `nil` storageID returned without any error
// means that object is big, `cb` expects an
// empty (but non-nil) storageID in such cases
storageID = emptyStorageID
}
res, err := cb(s.blobStor, storageID)
return res, true, err
}