[#509] putsvc: Omit AccessIdentifiers from iteratePlacement()

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2023-07-11 17:33:13 +03:00
parent 0754e6e654
commit 80481c015c

View file

@ -146,7 +146,14 @@ func (t *distributedTarget) Close(ctx context.Context) (*transformer.AccessIdent
t.traversal.extraBroadcastEnabled = true
}
return t.iteratePlacement(ctx)
if err := t.iteratePlacement(ctx); err != nil {
return nil, err
}
id, _ := t.obj.ID()
return &transformer.AccessIdentifiers{
SelfID: id,
}, nil
}
func (t *distributedTarget) sendObject(ctx context.Context, node nodeDesc) error {
@ -164,14 +171,14 @@ func (t *distributedTarget) sendObject(ctx context.Context, node nodeDesc) error
return nil
}
func (t *distributedTarget) iteratePlacement(ctx context.Context) (*transformer.AccessIdentifiers, error) {
func (t *distributedTarget) iteratePlacement(ctx context.Context) error {
id, _ := t.obj.ID()
traverser, err := placement.NewTraverser(
append(t.traversal.opts, placement.ForObject(id))...,
)
if err != nil {
return nil, fmt.Errorf("(%T) could not create object placement traverser: %w", t, err)
return fmt.Errorf("(%T) could not create object placement traverser: %w", t, err)
}
resErr := &atomic.Value{}
@ -190,23 +197,19 @@ func (t *distributedTarget) iteratePlacement(ctx context.Context) (*transformer.
if !traverser.Success() {
var err errIncompletePut
err.singleErr, _ = resErr.Load().(error)
return nil, err
return err
}
// perform additional container broadcast if needed
if t.traversal.submitPrimaryPlacementFinish() {
_, err = t.iteratePlacement(ctx)
err = t.iteratePlacement(ctx)
if err != nil {
t.log.Error(logs.PutAdditionalContainerBroadcastFailure, zap.Error(err))
// we don't fail primary operation because of broadcast failure
}
}
id, _ = t.obj.ID()
return &transformer.AccessIdentifiers{
SelfID: id,
}, nil
return nil
}
func (t *distributedTarget) iterateAddresses(ctx context.Context, traverser *placement.Traverser, addrs []placement.Node, resErr *atomic.Value) bool {