[#2213] node: Do not return object expired object

"Object is expired" means that object is presented in `meta` but it is not
`ObjectNotFound` error. Previous implementation made `shard` search for an
object without `meta` which was an error.

Signed-off-by: Pavel Karpy <p.karpy@yadro.com>
This commit is contained in:
Pavel Karpy 2023-01-25 18:48:13 +03:00 committed by fyrchik
parent ad93d4db7c
commit 40822adb51
2 changed files with 7 additions and 1 deletions

View file

@ -27,6 +27,7 @@ Changelog for FrostFS Node
- Fix `dirty` suffix in debian package version (#53) - Fix `dirty` suffix in debian package version (#53)
- Prevent node process from killing by systemd when shutting down (#1465) - Prevent node process from killing by systemd when shutting down (#1465)
- Restore subscriptions correctly on morph client switch (#2212) - Restore subscriptions correctly on morph client switch (#2212)
- Expired objects could be returned if not marked with GC yet (#2213)
### Removed ### Removed
### Updated ### Updated

View file

@ -74,6 +74,7 @@ func (e *StorageEngine) get(prm GetPrm) (GetRes, error) {
shPrm.SetAddress(prm.addr) shPrm.SetAddress(prm.addr)
var hasDegraded bool var hasDegraded bool
var objectExpired bool
e.iterateOverSortedShards(prm.addr, func(_ int, sh hashedShard) (stop bool) { e.iterateOverSortedShards(prm.addr, func(_ int, sh hashedShard) (stop bool) {
noMeta := sh.GetMode().NoMetabase() noMeta := sh.GetMode().NoMetabase()
@ -113,7 +114,7 @@ func (e *StorageEngine) get(prm GetPrm) (GetRes, error) {
case shard.IsErrObjectExpired(err): case shard.IsErrObjectExpired(err):
// object is found but should not // object is found but should not
// be returned // be returned
outError = errNotFound objectExpired = true
return true return true
default: default:
e.reportShardError(sh, "could not get object from shard", err) e.reportShardError(sh, "could not get object from shard", err)
@ -130,6 +131,10 @@ func (e *StorageEngine) get(prm GetPrm) (GetRes, error) {
return GetRes{}, logicerr.Wrap(objectSDK.NewSplitInfoError(outSI)) return GetRes{}, logicerr.Wrap(objectSDK.NewSplitInfoError(outSI))
} }
if objectExpired {
return GetRes{}, errNotFound
}
if obj == nil { if obj == nil {
if !hasDegraded && shardWithMeta.Shard == nil || !shard.IsErrNotFound(outError) { if !hasDegraded && shardWithMeta.Shard == nil || !shard.IsErrNotFound(outError) {
return GetRes{}, outError return GetRes{}, outError