From 91757329ae5ac6253ef2ea3f38ebdbdf7fc3b048 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 17 Jan 2023 18:48:16 +0300 Subject: [PATCH] [#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 Signed-off-by: Evgenii Stratonikov --- CHANGELOG.md | 1 + pkg/local_object_storage/shard/get.go | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ea8b3df0..2c4108975 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/pkg/local_object_storage/shard/get.go b/pkg/local_object_storage/shard/get.go index c728dc1d2..a5da288f9 100644 --- a/pkg/local_object_storage/shard/get.go +++ b/pkg/local_object_storage/shard/get.go @@ -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 }