forked from TrueCloudLab/frostfs-node
[#276] service/audit: Use random nodes for object.Head in PoR
Since PoR audit check uses object.Head with large TTL values to make real proof of retrievability, we may use random remote nodes. Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
10b548275a
commit
9273a89f61
1 changed files with 11 additions and 1 deletions
|
@ -5,6 +5,7 @@ import (
|
||||||
|
|
||||||
"github.com/nspcc-dev/neofs-api-go/pkg/object"
|
"github.com/nspcc-dev/neofs-api-go/pkg/object"
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/services/object_manager/placement"
|
"github.com/nspcc-dev/neofs-node/pkg/services/object_manager/placement"
|
||||||
|
"github.com/nspcc-dev/neofs-node/pkg/util/rand"
|
||||||
"github.com/nspcc-dev/tzhash/tz"
|
"github.com/nspcc-dev/tzhash/tz"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
@ -44,13 +45,22 @@ func (c *Context) checkStorageGroupPoR(ind int, sg *object.ID) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, node := range placement.FlattenNodes(objectPlacement) {
|
flat := placement.FlattenNodes(objectPlacement)
|
||||||
|
|
||||||
|
crand := rand.New() // math/rand with cryptographic source
|
||||||
|
crand.Shuffle(len(flat), func(i, j int) {
|
||||||
|
flat[i], flat[j] = flat[j], flat[i]
|
||||||
|
})
|
||||||
|
|
||||||
|
for _, node := range flat {
|
||||||
hdr, err := c.cnrCom.GetHeader(c.task, node, members[i], true)
|
hdr, err := c.cnrCom.GetHeader(c.task, node, 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", node.Address()),
|
||||||
zap.Stringer("oid", members[i]))
|
zap.Stringer("oid", members[i]))
|
||||||
|
|
||||||
|
// todo: count all fails and successes for audit report
|
||||||
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue