From f437ab8f15800b2b1baaca87afd3d0aa29e49a39 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Wed, 7 Jun 2023 13:04:55 +0300 Subject: [PATCH] [#197] object: Make Delete method return correct status Signed-off-by: Airat Arifullin a.arifullin@yadro.com --- pkg/services/object/delete/exec.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pkg/services/object/delete/exec.go b/pkg/services/object/delete/exec.go index 91bc6b3d7..343efbc04 100644 --- a/pkg/services/object/delete/exec.go +++ b/pkg/services/object/delete/exec.go @@ -8,6 +8,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/util" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger" + apiclient "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" @@ -75,8 +76,9 @@ func (exec *execCtx) newAddress(id oid.ID) oid.Address { } func (exec *execCtx) formSplitInfo(ctx context.Context) bool { - var err error + success := false + var err error exec.splitInfo, err = exec.svc.header.splitInfo(ctx, exec) switch { @@ -87,12 +89,17 @@ func (exec *execCtx) formSplitInfo(ctx context.Context) bool { exec.log.Debug(logs.DeleteCouldNotComposeSplitInfo, zap.String("error", err.Error()), ) - case err == nil: + case err == nil, apiclient.IsErrObjectAlreadyRemoved(err): + // IsErrObjectAlreadyRemoved check is required because splitInfo + // implicitly performs Head request that may return ObjectAlreadyRemoved + // status that is not specified for Delete + exec.status = statusOK exec.err = nil + success = true } - return err == nil + return success } func (exec *execCtx) collectMembers(ctx context.Context) (ok bool) {