[#1449] policer: Fix selection of new storage candidates

`Policer` should pass list of selected candidates into `WithNodes`
method of `replicator.Task`. In previous implementation `processNodes`
method passed an opposite list: failed nodes and/or the local one.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2022-05-30 08:19:59 +03:00 committed by LeL
parent 855cbf5a3a
commit e96ea4635c

View file

@ -97,17 +97,17 @@ func (p *Policer) processNodes(ctx *processPlacementContext, addr *addressSDK.Ad
ctx.needLocalCopy = true ctx.needLocalCopy = true
shortage-- shortage--
} else {
continue
}
callCtx, cancel := context.WithTimeout(ctx, p.headTimeout) callCtx, cancel := context.WithTimeout(ctx, p.headTimeout)
_, err := p.remoteHeader.Head(callCtx, prm.WithNodeInfo(nodes[i].NodeInfo)) _, err := p.remoteHeader.Head(callCtx, prm.WithNodeInfo(nodes[i].NodeInfo))
cancel() cancel()
if !client.IsErrObjectNotFound(err) { if client.IsErrObjectNotFound(err) {
continue
}
if err != nil { if err != nil {
log.Error("receive object header to check policy compliance", log.Error("receive object header to check policy compliance",
zap.String("error", err.Error()), zap.String("error", err.Error()),
@ -115,8 +115,6 @@ func (p *Policer) processNodes(ctx *processPlacementContext, addr *addressSDK.Ad
} else { } else {
shortage-- shortage--
} }
continue
} }
nodes = append(nodes[:i], nodes[i+1:]...) nodes = append(nodes[:i], nodes[i+1:]...)