From a01262d8bd9acf2906282efade98c05ebf872029 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 11 Dec 2020 14:29:31 +0300 Subject: [PATCH] [#243] service/object: Fix object chain assembly for tombstone body Signed-off-by: Alex Vanin --- go.mod | 2 +- go.sum | 2 ++ pkg/services/object/delete/exec.go | 4 +--- pkg/services/object/delete/local.go | 2 ++ pkg/services/object/delete/util.go | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index ad6069bdf..da74aad34 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/multiformats/go-multihash v0.0.13 // indirect github.com/nspcc-dev/hrw v1.0.9 github.com/nspcc-dev/neo-go v0.91.1-pre.0.20201030072836-71216865717b - github.com/nspcc-dev/neofs-api-go v1.20.3-0.20201211081945-1bc91466aa7b + github.com/nspcc-dev/neofs-api-go v1.20.3-0.20201211114827-2aa51d3add29 github.com/nspcc-dev/neofs-crypto v0.3.0 github.com/nspcc-dev/tzhash v1.4.0 github.com/panjf2000/ants/v2 v2.3.0 diff --git a/go.sum b/go.sum index 44eb3324e..e1b32a43f 100644 --- a/go.sum +++ b/go.sum @@ -285,6 +285,8 @@ github.com/nspcc-dev/neo-go v0.91.1-pre.0.20201030072836-71216865717b h1:gk5bZgp github.com/nspcc-dev/neo-go v0.91.1-pre.0.20201030072836-71216865717b/go.mod h1:9s7LNp2lMgf0caH2t0sam4+WT2SIauXozwP0AdBqnEo= github.com/nspcc-dev/neofs-api-go v1.20.3-0.20201211081945-1bc91466aa7b h1:0IdLNZHFrPKS7o2gvwo+dWO80k49nTrQq2YmzXN9I/4= github.com/nspcc-dev/neofs-api-go v1.20.3-0.20201211081945-1bc91466aa7b/go.mod h1:G7dqincfdjBrAbL5nxVp82emF05fSVEqe59ICsoRDI8= +github.com/nspcc-dev/neofs-api-go v1.20.3-0.20201211114827-2aa51d3add29 h1:5Th3BoSCbnKiHFzpoRh2+p3g3Hv1zTHC5dvHwfbIbBk= +github.com/nspcc-dev/neofs-api-go v1.20.3-0.20201211114827-2aa51d3add29/go.mod h1:G7dqincfdjBrAbL5nxVp82emF05fSVEqe59ICsoRDI8= github.com/nspcc-dev/neofs-crypto v0.2.0/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9KAEAUQR7dMxZmNA= github.com/nspcc-dev/neofs-crypto v0.2.3/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw= github.com/nspcc-dev/neofs-crypto v0.3.0 h1:zlr3pgoxuzrmGCxc5W8dGVfA9Rro8diFvVnBg0L4ifM= diff --git a/pkg/services/object/delete/exec.go b/pkg/services/object/delete/exec.go index 1afc8bbe4..dbe665138 100644 --- a/pkg/services/object/delete/exec.go +++ b/pkg/services/object/delete/exec.go @@ -137,6 +137,7 @@ func (exec *execCtx) collectChain() bool { exec.log.Debug("assembling chain...") for prev := exec.splitInfo.LastPart(); prev != nil; { + chain = append(chain, prev) prev, err = exec.svc.header.previous(exec, prev) switch { @@ -154,12 +155,9 @@ func (exec *execCtx) collectChain() bool { exec.status = statusOK exec.err = nil } - - chain = append(chain, prev) } exec.addMembers(chain) - exec.tombstone.SetSplitID(exec.splitInfo.SplitID()) return true } diff --git a/pkg/services/object/delete/local.go b/pkg/services/object/delete/local.go index 396debd79..26b0d9dde 100644 --- a/pkg/services/object/delete/local.go +++ b/pkg/services/object/delete/local.go @@ -37,6 +37,8 @@ func (exec *execCtx) formTombstone() (ok bool) { exec.log.Debug("split info successfully formed, collecting members...") + exec.tombstone.SetSplitID(exec.splitInfo.SplitID()) + ok = exec.collectMembers() if !ok { return diff --git a/pkg/services/object/delete/util.go b/pkg/services/object/delete/util.go index 7a5da82d1..1a25e9a86 100644 --- a/pkg/services/object/delete/util.go +++ b/pkg/services/object/delete/util.go @@ -99,7 +99,7 @@ func (w *searchSvcWrapper) splitMembers(exec *execCtx) ([]*objectSDK.ID, error) return wr.ids, nil } -func (s simpleIDWriter) WriteIDs(ids []*objectSDK.ID) error { +func (s *simpleIDWriter) WriteIDs(ids []*objectSDK.ID) error { s.ids = append(s.ids, ids...) return nil