Fix PutSingle with OID that was already removed #1579

Merged
fyrchik merged 2 commits from aarifullin/frostfs-node:fix/put_single into master 2024-12-26 11:27:56 +00:00
2 changed files with 4 additions and 0 deletions
Showing only changes of commit a0c261104e - Show all commits

View file

@ -14,6 +14,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/policy"
svcutil "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/util"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object_manager/placement"
clientSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client"
containerSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container"
objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/erasurecode"
@ -274,6 +275,8 @@ func (e *ECWriter) writePart(ctx context.Context, obj *objectSDK.Object, partIdx
err := e.putECPartToNode(ctx, obj, node)
if err == nil {
return nil
} else if clientSDK.IsErrObjectAlreadyRemoved(err) {
return err
}
e.Config.Logger.Warn(ctx, logs.ECFailedToSaveECPart, zap.Stringer("part_address", object.AddressOf(obj)),
zap.Stringer("parent_address", obj.ECHeader().Parent()), zap.Int("part_index", partIdx),

View file

@ -352,6 +352,7 @@ func (s *Service) redirectPutSingleRequest(ctx context.Context,
err = signature.VerifyServiceMessage(resp)
if err != nil {
err = fmt.Errorf("response verification failed: %w", err)
return
}
fyrchik marked this conversation as resolved Outdated

Could you point me at an example of where we already use similar logic?
These lines seem out of place to me.

Could you point me at an example of where we already use similar logic? These lines seem out of place to me.
https://git.frostfs.info/TrueCloudLab/frostfs-sdk-go/src/branch/master/client/object_put_single.go#L162-L174 https://git.frostfs.info/TrueCloudLab/frostfs-sdk-go/src/branch/master/client/common.go#L100

Both links are from the SDK, I mean in the node.
This line is rather generic, I do not understand why PutSingle is special.

Both links are from the SDK, I mean in the node. This line is rather generic, I do not understand why `PutSingle` is special.
[headRequest](https://git.frostfs.info/TrueCloudLab/frostfs-node/src/branch/master/pkg/services/object/get/v2/head_forwarder.go#L57) -> [verifyResponse](https://git.frostfs.info/TrueCloudLab/frostfs-node/src/branch/master/pkg/services/object/get/v2/util.go#L419-L429)
st := apistatus.FromStatusV2(resp.GetMetaHeader().GetStatus())
Review
		err = signature.VerifyServiceMessage(resp)
		if err != nil {
			err = fmt.Errorf("response verification failed: %w", err)
			return     <----------------------- add this
		}

		st := apistatus.FromStatusV2(resp.GetMetaHeader().GetStatus())
		err = apistatus.ErrFromStatus(st)
``` err = signature.VerifyServiceMessage(resp) if err != nil { err = fmt.Errorf("response verification failed: %w", err) return <----------------------- add this } st := apistatus.FromStatusV2(resp.GetMetaHeader().GetStatus()) err = apistatus.ErrFromStatus(st) ```
Review

Correct! Fixed

Correct! Fixed