forked from TrueCloudLab/frostfs-node
[#643] objsvc/put: Unify extraBroadcastEnabled usage
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
facd3b2c4b
commit
c9e3c9956e
3 changed files with 7 additions and 8 deletions
|
@ -9,6 +9,7 @@ import (
|
|||
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
|
||||
svcutil "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/util"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object_manager/placement"
|
||||
objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
|
@ -112,3 +113,7 @@ func (n *nodeIterator) forEachAddress(ctx context.Context, traverser *placement.
|
|||
|
||||
return false
|
||||
}
|
||||
|
||||
func needAdditionalBroadcast(obj *objectSDK.Object, localOnly bool) bool {
|
||||
return len(obj.Children()) > 0 || (!localOnly && (obj.Type() == objectSDK.TypeTombstone || obj.Type() == objectSDK.TypeLock))
|
||||
}
|
||||
|
|
|
@ -130,12 +130,6 @@ func (t *distributedTarget) WriteObject(ctx context.Context, obj *objectSDK.Obje
|
|||
if t.objMeta, err = t.fmtValidator.ValidateContent(t.obj); err != nil {
|
||||
return fmt.Errorf("(%T) could not validate payload content: %w", t, err)
|
||||
}
|
||||
|
||||
if len(t.obj.Children()) > 0 {
|
||||
// enabling extra broadcast for linking objects
|
||||
t.extraBroadcastEnabled = true
|
||||
}
|
||||
|
||||
return t.iteratePlacement(ctx)
|
||||
}
|
||||
|
||||
|
@ -157,6 +151,6 @@ func (t *distributedTarget) iteratePlacement(ctx context.Context) error {
|
|||
id, _ := t.obj.ID()
|
||||
|
||||
iter := t.cfg.newNodeIterator(append(t.placementOpts, placement.ForObject(id)))
|
||||
iter.extraBroadcastEnabled = t.extraBroadcastEnabled
|
||||
iter.extraBroadcastEnabled = needAdditionalBroadcast(t.obj, false /* Distributed target is for cluster-wide PUT */)
|
||||
return iter.forEachNode(ctx, t.sendObject)
|
||||
}
|
||||
|
|
|
@ -151,7 +151,7 @@ func (s *Service) saveToNodes(ctx context.Context, obj *objectSDK.Object, req *o
|
|||
}
|
||||
|
||||
iter := s.cfg.newNodeIterator(placementOptions)
|
||||
iter.extraBroadcastEnabled = len(obj.Children()) > 0 || (!localOnly && (obj.Type() == objectSDK.TypeTombstone || obj.Type() == objectSDK.TypeLock))
|
||||
iter.extraBroadcastEnabled = needAdditionalBroadcast(obj, localOnly)
|
||||
|
||||
signer := &putSingleRequestSigner{
|
||||
req: req,
|
||||
|
|
Loading…
Reference in a new issue