Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix/Child objects ACL #2716

Merged
merged 8 commits into from
Mar 20, 2024
Merged

fix/Child objects ACL #2716

merged 8 commits into from
Mar 20, 2024

Conversation

carpawell
Copy link
Member

No description provided.

@carpawell carpawell self-assigned this Jan 12, 2024
@carpawell carpawell force-pushed the fix/child-object-acl branch 2 times, most recently from 9a60f81 to 960fe98 Compare February 27, 2024 20:16
Copy link

codecov bot commented Feb 27, 2024

Codecov Report

Attention: Patch coverage is 14.28571% with 468 lines in your changes are missing coverage. Please review.

Project coverage is 22.00%. Comparing base (9c6573c) to head (d309b9d).

Files Patch % Lines
pkg/services/object/util/chain.go 0.00% 97 Missing ⚠️
pkg/services/object/split/verify.go 0.00% 86 Missing ⚠️
pkg/services/object/get/assembly_v2.go 21.87% 75 Missing ⚠️
cmd/neofs-node/object.go 0.00% 47 Missing ⚠️
cmd/neofs-cli/modules/object/util.go 0.00% 42 Missing ⚠️
pkg/services/object/delete/util.go 0.00% 26 Missing ⚠️
cmd/neofs-cli/modules/storagegroup/put.go 0.00% 23 Missing ⚠️
pkg/core/object/fmt.go 52.63% 17 Missing and 1 partial ⚠️
pkg/local_object_storage/metabase/put.go 30.00% 8 Missing and 6 partials ⚠️
pkg/services/object/acl/eacl/v2/headers.go 44.44% 7 Missing and 3 partials ⚠️
... and 11 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2716      +/-   ##
==========================================
- Coverage   22.04%   22.00%   -0.04%     
==========================================
  Files         787      789       +2     
  Lines       46738    47212     +474     
==========================================
+ Hits        10304    10390      +86     
- Misses      35552    35930     +378     
- Partials      882      892      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@carpawell carpawell force-pushed the fix/child-object-acl branch 4 times, most recently from daa352f to e20f436 Compare February 29, 2024 20:12
@carpawell
Copy link
Member Author

Well, I need Go 1.20 now. Otherwise, I am ready.

@carpawell carpawell force-pushed the fix/child-object-acl branch from e20f436 to 770824a Compare March 1, 2024 13:58
@carpawell
Copy link
Member Author

Not sure what is wrong with the tests: it creates REP 2 IN X CBF 1 SELECT 4 FROM * AS X container PUTs a complex object and HEADs its parts with TTL 1 to every container node (2 of 4 answers correct, the other 2 say 404). Need to be investigated, not sure why all 4 nodes are expected to answer. Generally can be reviewed, draft status is caused by that strange test.

Copy link
Member

@roman-khimov roman-khimov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cthulhu-rider, join the party. We need to merge this ASAP to unblock SDK updates.

}

func (h headerSource) Head(address oid.Address) (*objectSDK.Object, error) {
if h.cache != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would it be nil?

Copy link
Member Author

@carpawell carpawell Mar 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cacheSize may be zero so no caching is done then. hardcoded for now but may be useful in the future

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems very artificial to me (likely cache can have zero size and still be instantiated), but OK.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have a config param that explicitly says "no caching, please" (but for morph values mostly)

cacheSize may be zero

i meant you can change one const and it is not caching anymore, you may make it configurable and just init it with a value you read and zero value is already supported. i agree, it may look strange without a real use-case and config param but since it is already done, why not?

@@ -57,6 +57,10 @@ Numbers stand for a single byte value.
- Name: container ID + `9`
- Key: object ID
- Value: marshaled object
- Buckets containing object or LINK type
- Name: container ID + `18`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought they're sorted here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they have a logical title (Unique index buckets) so i decided them to be together

pkg/local_object_storage/metabase/put.go Outdated Show resolved Hide resolved
pkg/services/object/split/verify.go Outdated Show resolved Hide resolved
}

var err error
receivedObjects[iCopy], err = v.verifySinglePart(ctx, cnr, shouldHaveFirstObject, childrenFromLink[iCopy])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1M * 16K for headers?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how child objects may be 16K? optimizations may be presented here but not sure they changes smth for now (64mb are required for the most optimal part of the object storing if NO get-check-drop is implemented and all the objects are fetched before any validation is being done)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fetch and verify group by group, headers are headers and can be up to 16KB.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still a problem, but can be left for another issue.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in fact just missed that comment. done in this PR

@cthulhu-rider
Copy link
Contributor

@roman-khimov affirmative

@carpawell wt readiness? PR is still draft

@carpawell carpawell force-pushed the fix/child-object-acl branch from c7e7137 to d674736 Compare March 6, 2024 16:57
@carpawell
Copy link
Member Author

carpawell commented Mar 6, 2024

@carpawell wt readiness? PR is still draft

Basically can be reviewed since the push that allowed building. Some fixes are done (and will be done but are based on my work with int test cases) and after the review (when the base code is fixed), I would add some missing unit tests.

@carpawell carpawell force-pushed the fix/child-object-acl branch 2 times, most recently from 98e3aa3 to 4278283 Compare March 6, 2024 20:32
Copy link
Contributor

@cthulhu-rider cthulhu-rider left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

finished small commits, will return to the main one

pkg/local_object_storage/metabase/select.go Show resolved Hide resolved
cmd/neofs-cli/modules/object/head.go Outdated Show resolved Hide resolved
cmd/neofs-cli/modules/object/util.go Outdated Show resolved Hide resolved
cmd/neofs-cli/modules/object/util.go Outdated Show resolved Hide resolved
cmd/neofs-cli/modules/object/util.go Outdated Show resolved Hide resolved
cmd/neofs-cli/modules/object/util.go Outdated Show resolved Hide resolved
@carpawell carpawell force-pushed the fix/child-object-acl branch 4 times, most recently from 3edac98 to 40ffda7 Compare March 12, 2024 00:13
@carpawell carpawell marked this pull request as ready for review March 12, 2024 00:29
}

func (h headerSource) Head(address oid.Address) (*objectSDK.Object, error) {
if h.cache != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems very artificial to me (likely cache can have zero size and still be instantiated), but OK.

if splitID != nil {
// V1 split
if firstSet {
return errors.New("v1 split: first ID object is set")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First object ID?

}

for i := len(leaves) - 1; i >= 0; i-- {
if h(leaves[i]) {
return errors.New("nor link, nor last object ID is found")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

neither nor

}

var err error
receivedObjects[iCopy], err = v.verifySinglePart(ctx, cnr, shouldHaveFirstObject, childrenFromLink[iCopy])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still a problem, but can be left for another issue.

Copy link
Contributor

@cthulhu-rider cthulhu-rider left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

huge amount of work has been done, such that I am not able to closely examine some of its parts. These are my final comments, lets merge after them

pkg/services/object/util/chain.go Outdated Show resolved Hide resolved
pkg/services/object/util/chain.go Outdated Show resolved Hide resolved
pkg/services/object/util/chain.go Outdated Show resolved Hide resolved
for i := len(idBuff) - 1; i >= 0; i-- {
addr.SetObject(idBuff[i])

childObj, err := headFromInformer(r, addr)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didnt we do this in the previous loop?

Copy link
Member Author

@carpawell carpawell Mar 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree, looks ugly. but what if we have 1M 16K children as @roman-khimov loves? saving 1M 32-bytes IDs would be better than storing so many headers. not sure what is worse: duplicating RPCs or having 16GB memory for simple SG object put

also, this case is not expected since link object are always preferable

also, we are not expecting IDs to be in the right order in SGs as i remember

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, we are not expecting to have ID in the right order in SG as i remember

woops, no: https://github.com/nspcc-dev/neofs-api/blob/5c3535423c564fe63991812cb84d8334db1c553a/storagegroup/types.proto#L32

pkg/services/object/util/chain.go Outdated Show resolved Hide resolved
pkg/local_object_storage/metabase/util.go Outdated Show resolved Hide resolved
pkg/services/object/get/assembly_v2.go Outdated Show resolved Hide resolved
pkg/services/object/get/assembly_v2.go Show resolved Hide resolved
pkg/services/object/get/assembly_v2.go Show resolved Hide resolved
pkg/services/object/get/assemble.go Show resolved Hide resolved
@carpawell carpawell force-pushed the fix/child-object-acl branch 2 times, most recently from 9d0c2dd to 37e3949 Compare March 14, 2024 23:52
For the updated object split API mainly.

Signed-off-by: Pavel Karpy <[email protected]>
This buckets may be missing on if no objects of a certain type have been put
yet.

Signed-off-by: Pavel Karpy <[email protected]>
@carpawell carpawell force-pushed the fix/child-object-acl branch 2 times, most recently from 0d489a2 to fb9b4e7 Compare March 20, 2024 17:38
On reading:
Support both split chain versions a new and an old one.
On writing:
Split objects only with the V2 version:
 1. Link objects do not have child objects in their headers, payload is used
 instead
 2. Link objects contain child objects' sizes along with the IDs
 3. SplitID is not attached to the objects anymore
 4. The First part's ID of a big object is attached to every split part (a link
 has it too, but obviously the first part itself does not have its ID in
 its split header)
 5. Receiving link object triggers verification of its children: they should
 have the same first object and have the same payload size as the link
 declares
 6. The First object part now has an original object's paylaod (without
 payload-dependent fields set).

 Closes #2667.

Signed-off-by: Pavel Karpy <[email protected]>
Search for child in link object's payload, not its header.

Signed-off-by: Pavel Karpy <[email protected]>
They are used for session tokens. Sessions may be reconsidered in the future,
but for now big objects need to be sessioned part by part.

Signed-off-by: Pavel Karpy <[email protected]>
It was easier to implement it from scratch than to try to understand callbacks
and recursion.

Signed-off-by: Pavel Karpy <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants