forked from TrueCloudLab/frostfs-sdk-go
[#279] pool: Count maintenance mode errors in object search
Signed-off-by: Marina Biryukova <m.biryukova@yadro.com>
This commit is contained in:
parent
d7872061f8
commit
8da1a69d2b
1 changed files with 8 additions and 2 deletions
10
pool/pool.go
10
pool/pool.go
|
@ -1085,7 +1085,7 @@ func (c *clientWrapper) objectSearch(ctx context.Context, prm PrmObjectSearch) (
|
|||
return ResObjectSearch{}, fmt.Errorf("init object searching on client: %w", err)
|
||||
}
|
||||
|
||||
return ResObjectSearch{r: res}, nil
|
||||
return ResObjectSearch{r: res, incErrorRate: c.incErrorRate}, nil
|
||||
}
|
||||
|
||||
// sessionCreate invokes sdkClient.SessionCreate parse response status to error and return result as is.
|
||||
|
@ -2708,7 +2708,8 @@ func (p *Pool) ObjectRange(ctx context.Context, prm PrmObjectRange) (ResObjectRa
|
|||
//
|
||||
// Must be initialized using Pool.SearchObjects, any other usage is unsafe.
|
||||
type ResObjectSearch struct {
|
||||
r *sdkClient.ObjectListReader
|
||||
r *sdkClient.ObjectListReader
|
||||
incErrorRate func()
|
||||
}
|
||||
|
||||
// Read reads another list of the object identifiers.
|
||||
|
@ -2720,6 +2721,11 @@ func (x *ResObjectSearch) Read(buf []oid.ID) (int, error) {
|
|||
return n, io.EOF
|
||||
}
|
||||
|
||||
switch err.(type) {
|
||||
case *apistatus.NodeUnderMaintenance:
|
||||
x.incErrorRate()
|
||||
}
|
||||
|
||||
return n, err
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue