[#243] service/object: Fix object chain assembly for tombstone body

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2020-12-11 14:29:31 +03:00
parent 9265e31e65
commit a01262d8bd
5 changed files with 7 additions and 5 deletions

2
go.mod
View file

@ -17,7 +17,7 @@ require (
github.com/multiformats/go-multihash v0.0.13 // indirect github.com/multiformats/go-multihash v0.0.13 // indirect
github.com/nspcc-dev/hrw v1.0.9 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/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/neofs-crypto v0.3.0
github.com/nspcc-dev/tzhash v1.4.0 github.com/nspcc-dev/tzhash v1.4.0
github.com/panjf2000/ants/v2 v2.3.0 github.com/panjf2000/ants/v2 v2.3.0

2
go.sum
View file

@ -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/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 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.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.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.2.3/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw=
github.com/nspcc-dev/neofs-crypto v0.3.0 h1:zlr3pgoxuzrmGCxc5W8dGVfA9Rro8diFvVnBg0L4ifM= github.com/nspcc-dev/neofs-crypto v0.3.0 h1:zlr3pgoxuzrmGCxc5W8dGVfA9Rro8diFvVnBg0L4ifM=

View file

@ -137,6 +137,7 @@ func (exec *execCtx) collectChain() bool {
exec.log.Debug("assembling chain...") exec.log.Debug("assembling chain...")
for prev := exec.splitInfo.LastPart(); prev != nil; { for prev := exec.splitInfo.LastPart(); prev != nil; {
chain = append(chain, prev)
prev, err = exec.svc.header.previous(exec, prev) prev, err = exec.svc.header.previous(exec, prev)
switch { switch {
@ -154,12 +155,9 @@ func (exec *execCtx) collectChain() bool {
exec.status = statusOK exec.status = statusOK
exec.err = nil exec.err = nil
} }
chain = append(chain, prev)
} }
exec.addMembers(chain) exec.addMembers(chain)
exec.tombstone.SetSplitID(exec.splitInfo.SplitID())
return true return true
} }

View file

@ -37,6 +37,8 @@ func (exec *execCtx) formTombstone() (ok bool) {
exec.log.Debug("split info successfully formed, collecting members...") exec.log.Debug("split info successfully formed, collecting members...")
exec.tombstone.SetSplitID(exec.splitInfo.SplitID())
ok = exec.collectMembers() ok = exec.collectMembers()
if !ok { if !ok {
return return

View file

@ -99,7 +99,7 @@ func (w *searchSvcWrapper) splitMembers(exec *execCtx) ([]*objectSDK.ID, error)
return wr.ids, nil 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...) s.ids = append(s.ids, ids...)
return nil return nil