[#197] object: Make Delete method return correct status

Signed-off-by: Airat Arifullin a.arifullin@yadro.com
This commit is contained in:
Airat Arifullin 2023-06-07 13:04:55 +03:00 committed by Evgenii Stratonikov
parent d01c064674
commit f437ab8f15

View file

@ -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) {