[#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 <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2020-12-23 16:45:53 +03:00 committed by Alex Vanin
parent afb83c610c
commit 6977adec66

View file

@ -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 {