From e96ea4635c0c51a3ddab516fe3d2dbcd768b9bfb Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 30 May 2022 08:19:59 +0300 Subject: [PATCH] [#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 --- pkg/services/policer/check.go | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/pkg/services/policer/check.go b/pkg/services/policer/check.go index a92e80e29..72f7918aa 100644 --- a/pkg/services/policer/check.go +++ b/pkg/services/policer/check.go @@ -97,17 +97,17 @@ func (p *Policer) processNodes(ctx *processPlacementContext, addr *addressSDK.Ad ctx.needLocalCopy = true shortage-- + } else { + callCtx, cancel := context.WithTimeout(ctx, p.headTimeout) - continue - } + _, err := p.remoteHeader.Head(callCtx, prm.WithNodeInfo(nodes[i].NodeInfo)) - callCtx, cancel := context.WithTimeout(ctx, p.headTimeout) + cancel() - _, err := p.remoteHeader.Head(callCtx, prm.WithNodeInfo(nodes[i].NodeInfo)) + if client.IsErrObjectNotFound(err) { + continue + } - cancel() - - if !client.IsErrObjectNotFound(err) { if err != nil { log.Error("receive object header to check policy compliance", zap.String("error", err.Error()), @@ -115,8 +115,6 @@ func (p *Policer) processNodes(ctx *processPlacementContext, addr *addressSDK.Ad } else { shortage-- } - - continue } nodes = append(nodes[:i], nodes[i+1:]...)