From 11262bed4aa0afe7244f79905d9f4bc2ae2c7f1e Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 5 Oct 2020 12:42:45 +0300 Subject: [PATCH] [#71] Broadcast tombstone to container With one tombstone for split objects we can't simply place it in container. We should inform all nodes that store split objects of removed original object. Signed-off-by: Alex Vanin --- pkg/services/object/delete/service.go | 8 +++++++- pkg/services/object/put/prm.go | 8 ++++++++ pkg/services/object/put/streamer.go | 3 --- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/pkg/services/object/delete/service.go b/pkg/services/object/delete/service.go index 82c7ae2fc..c24fcb34c 100644 --- a/pkg/services/object/delete/service.go +++ b/pkg/services/object/delete/service.go @@ -9,6 +9,7 @@ import ( headsvc "github.com/nspcc-dev/neofs-node/pkg/services/object/head" putsvc "github.com/nspcc-dev/neofs-node/pkg/services/object/put" objutil "github.com/nspcc-dev/neofs-node/pkg/services/object/util" + "github.com/nspcc-dev/neofs-node/pkg/services/object_manager/placement" "github.com/pkg/errors" ) @@ -78,9 +79,14 @@ func (s *Service) Delete(ctx context.Context, prm *Prm) (*Response, error) { return nil, errors.Wrapf(err, "(%T) could not open put stream", s) } + // `WithoutSuccessTracking` option broadcast message to all container nodes. + // For now there is no better solution to distributed tombstones with + // content address storage (CAS) and one tombstone for several split + // objects. if err := r.Init(new(putsvc.PutInitPrm). WithObject(newTombstone(ownerID, prm.addr.GetContainerID())). - WithCommonPrm(prm.common), + WithCommonPrm(prm.common). + WithTraverseOption(placement.WithoutSuccessTracking()), // broadcast tombstone, maybe one ); err != nil { return nil, errors.Wrapf(err, "(%T) could not initialize tombstone stream", s) } diff --git a/pkg/services/object/put/prm.go b/pkg/services/object/put/prm.go index efdabe10a..55c52d12f 100644 --- a/pkg/services/object/put/prm.go +++ b/pkg/services/object/put/prm.go @@ -26,6 +26,14 @@ func (p *PutInitPrm) WithCommonPrm(v *util.CommonPrm) *PutInitPrm { return p } +func (p *PutInitPrm) WithTraverseOption(opt placement.Option) *PutInitPrm { + if p != nil { + p.traverseOpts = append(p.traverseOpts, opt) + } + + return p +} + func (p *PutInitPrm) WithObject(v *object.RawObject) *PutInitPrm { if p != nil { p.hdr = v diff --git a/pkg/services/object/put/streamer.go b/pkg/services/object/put/streamer.go index 6732c1194..2c271bb97 100644 --- a/pkg/services/object/put/streamer.go +++ b/pkg/services/object/put/streamer.go @@ -91,9 +91,6 @@ func (p *Streamer) preparePrm(prm *PutInitPrm) error { return errors.Wrapf(err, "(%T) could not get container by ID", p) } - // allocate placement traverser options - prm.traverseOpts = make([]placement.Option, 0, 4) - // add common options prm.traverseOpts = append(prm.traverseOpts, // set processing container