forked from TrueCloudLab/frostfs-node
[#276] innerring: Use Head with TTL in PoR
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
f9e81383ae
commit
10b548275a
4 changed files with 14 additions and 6 deletions
|
@ -114,13 +114,21 @@ func (c *ClientCache) GetSG(task *audit.Task, id *object.ID) (*storagegroup.Stor
|
|||
}
|
||||
|
||||
// GetHeader requests node from the container under audit to return object header by id.
|
||||
func (c *ClientCache) GetHeader(task *audit.Task, node *netmap.Node, id *object.ID) (*object.Object, error) {
|
||||
func (c *ClientCache) GetHeader(task *audit.Task, node *netmap.Node, id *object.ID, relay bool) (*object.Object, error) {
|
||||
raw := true
|
||||
ttl := uint32(1)
|
||||
|
||||
if relay {
|
||||
ttl = 10 // todo: instead of hardcode value we can set TTL based on container length
|
||||
raw = false
|
||||
}
|
||||
|
||||
objAddress := new(object.Address)
|
||||
objAddress.SetContainerID(task.ContainerID())
|
||||
objAddress.SetObjectID(id)
|
||||
|
||||
headParams := new(client.ObjectHeaderParams)
|
||||
headParams.WithRawFlag(true)
|
||||
headParams.WithRawFlag(raw)
|
||||
headParams.WithMainFields()
|
||||
headParams.WithAddress(objAddress)
|
||||
|
||||
|
@ -135,7 +143,7 @@ func (c *ClientCache) GetHeader(task *audit.Task, node *netmap.Node, id *object.
|
|||
}
|
||||
|
||||
cctx, cancel := context.WithTimeout(task.AuditContext(), c.headTimeout)
|
||||
head, err := cli.GetObjectHeader(cctx, headParams, client.WithTTL(1))
|
||||
head, err := cli.GetObjectHeader(cctx, headParams, client.WithTTL(ttl))
|
||||
|
||||
cancel()
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ type ContainerCommunicator interface {
|
|||
GetSG(*audit.Task, *object.ID) (*storagegroup.StorageGroup, error)
|
||||
|
||||
// Must return object header from the container node.
|
||||
GetHeader(*audit.Task, *netmap.Node, *object.ID) (*object.Object, error)
|
||||
GetHeader(*audit.Task, *netmap.Node, *object.ID, bool) (*object.Object, error)
|
||||
|
||||
// Must return homomorphic Tillich-Zemor hash of payload range of the
|
||||
// object stored in container node.
|
||||
|
|
|
@ -50,7 +50,7 @@ func (c *Context) processObjectPlacement(id *object.ID, nodes netmap.Nodes, repl
|
|||
|
||||
for i := 0; ok < replicas && i < len(nodes); i++ {
|
||||
// try to get object header from node
|
||||
hdr, err := c.cnrCom.GetHeader(c.task, nodes[i], id)
|
||||
hdr, err := c.cnrCom.GetHeader(c.task, nodes[i], id, false)
|
||||
if err != nil {
|
||||
c.log.Debug("could not get object header from candidate",
|
||||
zap.Stringer("id", id),
|
||||
|
|
|
@ -45,7 +45,7 @@ func (c *Context) checkStorageGroupPoR(ind int, sg *object.ID) {
|
|||
}
|
||||
|
||||
for _, node := range placement.FlattenNodes(objectPlacement) {
|
||||
hdr, err := c.cnrCom.GetHeader(c.task, node, members[i])
|
||||
hdr, err := c.cnrCom.GetHeader(c.task, node, members[i], true)
|
||||
if err != nil {
|
||||
c.log.Debug("can't head object",
|
||||
zap.String("remote_node", node.Address()),
|
||||
|
|
Loading…
Reference in a new issue