diff --git a/CHANGELOG.md b/CHANGELOG.md index 7bee2e25..07732cc5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -69,6 +69,7 @@ Changelog for NeoFS Node - Prevent leaking goroutines in the tree service (#2162) - Do not search for LOCK objects when delete container when session provided (#2152) - Race conditions on shard's mode switch (#1956) +- Returning expired/removed objects from write-cache (#2016) ### Removed - `-g` option from `neofs-cli control ...` and `neofs-cli container create` commands (#2089) diff --git a/pkg/local_object_storage/shard/get.go b/pkg/local_object_storage/shard/get.go index 0ff846e9..c728dc1d 100644 --- a/pkg/local_object_storage/shard/get.go +++ b/pkg/local_object_storage/shard/get.go @@ -98,19 +98,6 @@ func (s *Shard) fetchObjectData(addr oid.Address, skipMeta bool, cb storFetcher, res *objectSDK.Object ) - if s.hasWriteCache() { - res, err := wc(s.writeCache) - if err == nil || IsErrOutOfRange(err) { - return res, false, err - } - - if IsErrNotFound(err) { - s.log.Debug("object is missing in write-cache") - } else { - s.log.Error("failed to fetch object from write-cache", zap.Error(err)) - } - } - var exists bool if !skipMeta { var mPrm meta.ExistsPrm @@ -123,6 +110,19 @@ func (s *Shard) fetchObjectData(addr oid.Address, skipMeta bool, cb storFetcher, exists = mRes.Exists() } + if s.hasWriteCache() { + res, err = wc(s.writeCache) + if err == nil || IsErrOutOfRange(err) { + return res, false, err + } + + if IsErrNotFound(err) { + s.log.Debug("object is missing in write-cache") + } else { + s.log.Error("failed to fetch object from write-cache", zap.Error(err)) + } + } + if skipMeta || err != nil { res, err = cb(s.blobStor, nil) return res, false, err