From 6977adec666609189f047933fd9c723fcf2caf0a Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 23 Dec 2020 16:45:53 +0300 Subject: [PATCH] [#273] service/audit: Ignore coverage of very small objects PDP audit check is not quite working with very small objects, so we try to build coverage with bigger objects. Signed-off-by: Alex Vanin --- pkg/services/audit/auditor/pop.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/pkg/services/audit/auditor/pop.go b/pkg/services/audit/auditor/pop.go index d6005b023..4d73385c4 100644 --- a/pkg/services/audit/auditor/pop.go +++ b/pkg/services/audit/auditor/pop.go @@ -1,11 +1,17 @@ package auditor import ( + "github.com/nspcc-dev/neofs-api-go/pkg/client" "github.com/nspcc-dev/neofs-api-go/pkg/netmap" "github.com/nspcc-dev/neofs-api-go/pkg/object" "go.uber.org/zap" ) +const ( + hashRangeNumber = 4 + minGamePayloadSize = hashRangeNumber * client.TZSize +) + func (c *Context) executePoP() { c.buildCoverage() @@ -44,7 +50,7 @@ func (c *Context) processObjectPlacement(id *object.ID, nodes netmap.Nodes, repl for i := 0; !optimal && ok < replicas && i < len(nodes); i++ { // try to get object header from node - _, err := c.cnrCom.GetHeader(c.task, nodes[i], id) + hdr, err := c.cnrCom.GetHeader(c.task, nodes[i], id) if err != nil { c.log.Debug("could not get object header from candidate", zap.Stringer("id", id), @@ -54,12 +60,19 @@ func (c *Context) processObjectPlacement(id *object.ID, nodes netmap.Nodes, repl continue } + c.updateHeadResponses(hdr) + // increment success counter ok++ // update optimal flag optimal = ok == replicas && uint32(i) < replicas + // exclude small objects from coverage + if c.objectSize(id) < minGamePayloadSize { + continue + } + // update potential candidates to be paired if _, ok := c.pairedNodes[nodes[i].Hash()]; !ok { if unpairedCandidate1 < 0 {