[#197] object: Make Delete method return correct status
All checks were successful
ci/woodpecker/pr/pre-commit Pipeline was successful

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

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