[#276] service/audit: Count Head requests and retries in PoR
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
9273a89f61
commit
44d9f95137
4 changed files with 17 additions and 5 deletions
BIN
go.sum
BIN
go.sum
Binary file not shown.
|
@ -29,6 +29,8 @@ type Context struct {
|
||||||
|
|
||||||
placementCache map[string][]netmap.Nodes
|
placementCache map[string][]netmap.Nodes
|
||||||
|
|
||||||
|
porRequests, porRetries uint32
|
||||||
|
|
||||||
pairs []gamePair
|
pairs []gamePair
|
||||||
|
|
||||||
pairedMtx sync.Mutex
|
pairedMtx sync.Mutex
|
||||||
|
|
|
@ -14,6 +14,7 @@ func (c *Context) executePoR() {
|
||||||
for i, sg := range c.task.StorageGroupList() {
|
for i, sg := range c.task.StorageGroupList() {
|
||||||
c.checkStorageGroupPoR(i, sg) // consider parallel it
|
c.checkStorageGroupPoR(i, sg) // consider parallel it
|
||||||
}
|
}
|
||||||
|
c.report.SetPoRCounters(c.porRequests, c.porRetries)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Context) checkStorageGroupPoR(ind int, sg *object.ID) {
|
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]
|
flat[i], flat[j] = flat[j], flat[i]
|
||||||
})
|
})
|
||||||
|
|
||||||
for _, node := range flat {
|
for i := range flat {
|
||||||
hdr, err := c.cnrCom.GetHeader(c.task, node, members[i], true)
|
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 {
|
if err != nil {
|
||||||
c.log.Debug("can't head object",
|
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]))
|
zap.Stringer("oid", members[i]))
|
||||||
|
|
||||||
// todo: count all fails and successes for audit report
|
|
||||||
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,3 +60,9 @@ func (r *Report) SetPDPResults(passed, failed [][]byte) {
|
||||||
r.res.SetPassNodes(passed)
|
r.res.SetPassNodes(passed)
|
||||||
r.res.SetFailNodes(failed)
|
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)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue