[#1689] getSvc: Stop node addresses iteratation on logical errors
All checks were successful
Vulncheck / Vulncheck (push) Successful in 1m38s
Pre-commit hooks / Pre-commit (push) Successful in 2m12s
Build / Build Components (push) Successful in 2m14s
Tests and linters / Run gofumpt (push) Successful in 2m8s
Tests and linters / Staticcheck (push) Successful in 3m2s
Tests and linters / Tests (push) Successful in 3m37s
Tests and linters / Lint (push) Successful in 4m7s
OCI image / Build container images (push) Successful in 4m39s
Tests and linters / Tests with -race (push) Successful in 4m43s
Tests and linters / gopls check (push) Successful in 4m46s

Before this fix: If first node address returns non-logical error (context
deadline exceeded, context canceled, etc), then this error will override
logical error from second node address.

Change-Id: Ib30d0209828fdc83b55308ca2e33a361aa4caee6
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2025-05-05 16:20:13 +03:00
parent e0a4835ea3
commit 6cedfbc17a
Signed by: dstepanov-yadro
GPG key ID: 237AF1A763293BC0

View file

@ -3,6 +3,7 @@ package getsvc
import (
"context"
"crypto/sha256"
"errors"
"hash"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/client"
@ -358,19 +359,20 @@ func groupAddressRequestForwarder(f func(context.Context, network.Address, clien
info.AddressGroup().IterateAddresses(func(addr network.Address) (stop bool) {
var err error
defer func() {
stop = err == nil
if stop || firstErr == nil {
firstErr = err
}
// would be nice to log otherwise
}()
res, err = f(ctx, addr, c, key)
// non-status logic error that could be returned
// from the SDK client; should not be considered
// as a connection error
var siErr *objectSDK.SplitInfoError
var eiErr *objectSDK.ECInfoError
stop = err == nil || errors.As(err, &siErr) || errors.As(err, &eiErr)
if stop || firstErr == nil {
firstErr = err
}
return
})