Assemble complex object headers if linking object is deleted on EC containers #1295

Merged
fyrchik merged 1 commit from dstepanov-yadro/frostfs-node:fix/virtual_object_head into master 2024-09-04 19:51:10 +00:00

Scenario:

  1. Put complex EC object
  2. Delete linking object
  3. Head without --raw this object

As is: object not found will be thrown, log will contain can't unmarshal child with parent: object ID is not set error

To be: object headers will be returned

Frostfs-testcases for Object API passed:
image

Scenario: 1. Put complex EC object 2. Delete linking object 3. `Head` without `--raw` this object As is: `object not found` will be thrown, log will contain `can't unmarshal child with parent: object ID is not set` error To be: object headers will be returned Frostfs-testcases for Object API passed: ![image](/attachments/81b6a4a0-a9b0-4d76-9f9e-171f4768e69d)
dstepanov-yadro reviewed 2024-08-06 06:40:10 +00:00
@ -126,17 +127,16 @@ func (e *StorageEngine) head(ctx context.Context, prm HeadPrm) (HeadRes, error)
return true
})
if head != nil {
Author
Member

Reason to change priority: if some shard returns split info error, but other shard has linking object, then return head result directly.

Reason to change priority: if some shard returns split info error, but other shard has linking object, then return head result directly.
dstepanov-yadro reviewed 2024-08-06 06:40:13 +00:00
dstepanov-yadro reviewed 2024-08-06 06:43:37 +00:00
@ -730,7 +730,7 @@ func TestGetRemoteSmall(t *testing.T) {
t.Run("VIRTUAL", func(t *testing.T) {
testHeadVirtual := func(svc *Service, addr oid.Address, i *objectSDK.SplitInfo) {
headPrm := newHeadPrm(false, nil)
Author
Member

For raw == false cases it is expected to return object headers, but not split info error.

For `raw == false` cases it is expected to return object headers, but not split info error.
dstepanov-yadro reviewed 2024-08-06 06:44:07 +00:00
@ -90,3 +90,2 @@
func (r *request) canAssemble() bool {
return !r.isRaw() && !r.headOnly()
func (r *request) canAssembleComplexObject() bool {
Author
Member

To make method name more clear.

To make method name more clear.
dstepanov-yadro force-pushed fix/virtual_object_head from b099058d46 to 3cbea98e28 2024-08-06 06:46:21 +00:00 Compare
dstepanov-yadro requested review from storage-core-committers 2024-08-06 06:51:37 +00:00
dstepanov-yadro requested review from storage-core-developers 2024-08-06 06:51:37 +00:00
fyrchik reviewed 2024-08-06 07:01:57 +00:00
@ -65,15 +77,33 @@ func (a *assembler) Assemble(ctx context.Context, writer ObjectWriter) (*objectS
return a.parentObject, nil
}
func (a *assembler) getHead(ctx context.Context, sourceObjectID oid.ID, writer ObjectWriter) (*objectSDK.Object, error) {
Owner

It seems to be completely independent of other assembler methods, do we have a reason to provide headOnly as a parameter to the assembler instead of writing a separate function?

It seems to be completely independent of other `assembler` methods, do we have a reason to provide `headOnly` as a parameter to the `assembler` instead of writing a separate function?
Author
Member

Good point. Now this method looks more related to assembling: it tries to find parent headers from linking and last part objects.

Good point. Now this method looks more related to assembling: it tries to find parent headers from linking and last part objects.
@ -75,2 +103,4 @@
a.log.Debug(logs.LastPartIDFound, zap.Stringer("last_part_object_id", sourceObjectID))
return sourceObjectID, true
}
a.log.Warn(logs.EmptySplitInfo)
Owner

We return false, then create an error and will log again. Why is this Warn?

We return `false`, then create an error and will log again. Why is this `Warn`?
Author
Member

This Warn explains why Assemble returns error.

This `Warn` explains why `Assemble` returns error.
Owner

I don't like the assembler being able to log anything, as it will be eventually moved to the SDK.

I don't like the assembler being able to log anything, as it will be eventually moved to the SDK.
Author
Member
  1. But now assembler is here. Logger could be replaced with an interface.
  2. I think it is useful for troubleshooting.
1. But now assembler is here. Logger could be replaced with an interface. 2. I think it is useful for troubleshooting.
Owner

It only adds complexity (by producing side-effects), even though we can return everything in the result.
The result in turn is what we log and can use for troubleshooting.

It only adds complexity (by producing side-effects), even though we can return everything in the result. The result in turn is what we log and can use for troubleshooting.
Author
Member

I disagree, but fixed.

I disagree, but fixed.
@ -731,3 +731,3 @@
t.Run("VIRTUAL", func(t *testing.T) {
testHeadVirtual := func(svc *Service, addr oid.Address, i *objectSDK.SplitInfo) {
headPrm := newHeadPrm(false, nil)
headPrm := newHeadPrm(true, nil)
Owner

I would expect the tests to stay the same, what is the reason?

I would expect the tests to stay the same, what is the reason?
Author
Member

For raw == false cases it is expected to return object headers, but not split info error, as test does. So this test looks loke something unrelated to real code and works just because of mocks.

For `raw == false` cases it is expected to return object headers, but not split info error, as test does. So this test looks loke something unrelated to real code and works just because of mocks.
fyrchik marked this conversation as resolved
dstepanov-yadro force-pushed fix/virtual_object_head from 3cbea98e28 to 82d8190691 2024-08-06 07:26:26 +00:00 Compare
acid-ant reviewed 2024-08-06 08:02:38 +00:00
@ -68,0 +112,4 @@
if parent == nil {
return nil, objectSDK.NewSplitInfoError(a.splitInfo)
}
if err := writer.WriteHeader(ctx, obj.Parent()); err != nil {
Member

obj.Parent() -> parent

obj.Parent() -> parent
Author
Member

Fixed

Fixed
acid-ant marked this conversation as resolved
dstepanov-yadro force-pushed fix/virtual_object_head from 82d8190691 to cac6d59bfa 2024-08-06 08:23:38 +00:00 Compare
aarifullin approved these changes 2024-08-06 08:33:51 +00:00
acid-ant approved these changes 2024-08-06 13:43:53 +00:00
dstepanov-yadro force-pushed fix/virtual_object_head from cac6d59bfa to 8e51d7849a 2024-08-06 13:48:37 +00:00 Compare
fyrchik approved these changes 2024-08-06 14:49:19 +00:00
fyrchik merged commit 8e51d7849a into master 2024-08-06 14:49:32 +00:00
fyrchik referenced this pull request from a commit 2024-08-06 14:49:34 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
4 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#1295
No description provided.