[#276] service/audit: Count Head requests and retries in PoR

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2020-12-24 13:22:14 +03:00 committed by Alex Vanin
parent 9273a89f61
commit 44d9f95137
4 changed files with 17 additions and 5 deletions

BIN
go.sum

Binary file not shown.

View file

@ -29,6 +29,8 @@ type Context struct {
placementCache map[string][]netmap.Nodes
porRequests, porRetries uint32
pairs []gamePair
pairedMtx sync.Mutex

View file

@ -14,6 +14,7 @@ func (c *Context) executePoR() {
for i, sg := range c.task.StorageGroupList() {
c.checkStorageGroupPoR(i, sg) // consider parallel it
}
c.report.SetPoRCounters(c.porRequests, c.porRetries)
}
func (c *Context) checkStorageGroupPoR(ind int, sg *object.ID) {
@ -52,15 +53,18 @@ func (c *Context) checkStorageGroupPoR(ind int, sg *object.ID) {
flat[i], flat[j] = flat[j], flat[i]
})
for _, node := range flat {
hdr, err := c.cnrCom.GetHeader(c.task, node, members[i], true)
for i := range flat {
c.porRequests++
if i > 0 { // in best case audit get object header on first iteration
c.porRetries++
}
hdr, err := c.cnrCom.GetHeader(c.task, flat[i], members[i], true)
if err != nil {
c.log.Debug("can't head object",
zap.String("remote_node", node.Address()),
zap.String("remote_node", flat[i].Address()),
zap.Stringer("oid", members[i]))
// todo: count all fails and successes for audit report
continue
}

View file

@ -60,3 +60,9 @@ func (r *Report) SetPDPResults(passed, failed [][]byte) {
r.res.SetPassNodes(passed)
r.res.SetFailNodes(failed)
}
// SetPoRCounters sets amounts of head requests and retries at PoR audit stage.
func (r *Report) SetPoRCounters(requests, retries uint32) {
r.res.SetRequests(requests)
r.res.SetRetries(retries)
}