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
Member
  • Make raw PutSingle check status within response
  • Make metabase if EC-chunk's parent is already removed in fact;
  • EC-writer should check ObjectAlreadyRemoved errors

Close #1512

* Make raw `PutSingle` check status within response * Make metabase if EC-chunk's parent is already removed in fact; * EC-writer should check `ObjectAlreadyRemoved` errors Close #1512
aarifullin added the
bug
label 2024-12-23 12:03:08 +00:00
aarifullin added 2 commits 2024-12-23 12:03:08 +00:00
Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
[#1512] object: Fix put already removed object in EC-container
All checks were successful
Tests and linters / Run gofumpt (pull_request) Successful in 3m27s
DCO action / DCO (pull_request) Successful in 4m0s
Vulncheck / Vulncheck (pull_request) Successful in 4m37s
Tests and linters / Staticcheck (pull_request) Successful in 6m1s
Pre-commit hooks / Pre-commit (pull_request) Successful in 6m23s
Tests and linters / Lint (pull_request) Successful in 6m28s
Tests and linters / gopls check (pull_request) Successful in 6m36s
Build / Build Components (pull_request) Successful in 6m57s
Tests and linters / Tests (pull_request) Successful in 7m1s
Tests and linters / Tests with -race (pull_request) Successful in 7m1s
6347459a39
* Make metabase if EC-chunk's parent is already removed in fact;
* EC-writer should check `ObjectAlreadyRemoved` errors

Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
aarifullin requested review from storage-core-committers 2024-12-23 12:03:09 +00:00
aarifullin requested review from storage-core-developers 2024-12-23 12:03:09 +00:00
fyrchik requested changes 2024-12-23 12:13:10 +00:00
Dismissed
@ -123,0 +128,4 @@
pObj.SetContainerID(cnr)
pObj.SetID(ech.Parent())
if _, _, err := db.exists(tx, objectCore.AddressOf(pObj), oid.Address{}, currEpoch); err != nil && clientSDK.IsErrObjectAlreadyRemoved(err) {
Owner

I would argue that this check should replace the check at line 138, because tombstones are created only for parent for EC objects.
And we always know object kind, because we do not create tombstone marks if we have no info in the metabase.

I would argue that this check should replace the check at line 138, because tombstones are created only for parent for EC objects. And we always know object kind, because we do not create tombstone marks if we have no info in the metabase.
Author
Member

tombstones are created only for parent for EC objects.

That's why the change has been introduced.
ecWriter is chunking an EC-encoded object and sends these parts to Engine through Metabase. Meanwhile the only object that's marked as "removed" - the EC-parent.
So, db.exists(tx, objectCore.AddressOf(obj), oid.Address{}, currEpoch) is not able to catch this because we're checking chunk - graveyard doesn't contain info about chunks

Do you mean this check should be part of exists?

> tombstones are created only for parent for EC objects. That's why the change has been introduced. `ecWriter` is chunking an EC-encoded object and sends these parts to Engine through Metabase. Meanwhile the only object that's marked as "removed" - the EC-parent. So, `db.exists(tx, objectCore.AddressOf(obj), oid.Address{}, currEpoch)` is not able to catch this because we're checking chunk - graveyard doesn't contain info about chunks Do you mean this check should be part of `exists`?
Owner

I mean I you have checked exists(parent), you do not need to check exists(chunk) -- because you already know that it is a chunk and, as you wrote, graveyard doesn't contain info about chunks.

I mean I you have checked `exists(parent)`, you do not need to check `exists(chunk)` -- because you already know that it is a chunk and, as you wrote, `graveyard doesn't contain info about chunks`.
Author
Member

The changes in metabase are no longer relevant because @dstepanov-yadro has already found the problem with EC-objects and fixed it within exists (whilst I tried to fix that out of exists). Nevertheless, I made writePart check for ObjectAlreadyRemoved error to stop writing process and return explicit error to client

The changes in metabase are no longer relevant because @dstepanov-yadro has already found the problem with EC-objects and fixed it within `exists` (whilst I tried to fix that out of `exists`). Nevertheless, I made `writePart` check for `ObjectAlreadyRemoved` error to stop writing process and return explicit error to client
fyrchik marked this conversation as resolved
@ -123,0 +129,4 @@
pObj.SetID(ech.Parent())
if _, _, err := db.exists(tx, objectCore.AddressOf(pObj), oid.Address{}, currEpoch); err != nil && clientSDK.IsErrObjectAlreadyRemoved(err) {
return PutRes{}, err
Owner

And if err != nil, but is NOT ErrObjectAlreadyRemoved we continue?

And if `err != nil`, but is NOT `ErrObjectAlreadyRemoved` we continue?
Author
Member

It looks really tricky, but any non-ObjectAlreadyRemoved-error is delegated to chunk processing further (as it is below) to not break the Put logic.
The alternative way - to introduce a separate bucket for EC-chunks in metabase. Literally, EC-"orphans" bucket and check a chunk in db.exists

It looks really tricky, but any non-`ObjectAlreadyRemoved`-error is delegated to chunk processing further (as it is below) to _not_ break the `Put` logic. The alternative way - to introduce a separate bucket for `EC`-chunks in metabase. Literally, EC-"orphans" bucket and check a chunk in `db.exists`
Owner

It can be a storage error, we cannot just ignore it.

It can be a storage error, we cannot just ignore it.
Author
Member
https://git.frostfs.info/TrueCloudLab/frostfs-node/pulls/1579#issuecomment-63153
fyrchik marked this conversation as resolved
@ -353,6 +354,9 @@ func (s *Service) redirectPutSingleRequest(ctx context.Context,
err = fmt.Errorf("response verification failed: %w", err)
}
st := apistatus.FromStatusV2(resp.GetMetaHeader().GetStatus())
Owner

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.
Author
Member
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
Owner

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.
Author
Member
[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)
fyrchik marked this conversation as resolved
aarifullin force-pushed fix/put_single from 6347459a39 to efaa45216c 2024-12-24 18:21:03 +00:00 Compare
aarifullin force-pushed fix/put_single from efaa45216c to fe1d365e8f 2024-12-24 18:28:48 +00:00 Compare
dstepanov-yadro reviewed 2024-12-25 06:17:53 +00:00
@ -354,2 +355,4 @@
}
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)
``` 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) ```
Author
Member

Correct! Fixed

Correct! Fixed
aarifullin force-pushed fix/put_single from fe1d365e8f to a0c261104e 2024-12-25 08:23:46 +00:00 Compare
dstepanov-yadro approved these changes 2024-12-25 15:27:29 +00:00
aarifullin requested review from fyrchik 2024-12-26 08:02:16 +00:00
fyrchik approved these changes 2024-12-26 11:27:11 +00:00
Dismissed
fyrchik approved these changes 2024-12-26 11:27:51 +00:00
fyrchik merged commit e44782473a into master 2024-12-26 11:27:56 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-node#1579
No description provided.