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

Use new API for background replication #2674

Merged
merged 2 commits into from
Apr 3, 2024

Conversation

cthulhu-rider
Copy link
Contributor

@cthulhu-rider cthulhu-rider commented Dec 11, 2023


replication demux inside PUT is planned for the next PR

@cthulhu-rider cthulhu-rider force-pushed the feature/object-separate-replication branch 2 times, most recently from 98848f5 to 450912e Compare December 13, 2023 13:52
Copy link

codecov bot commented Dec 13, 2023

Codecov Report

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

Project coverage is 22.13%. Comparing base (c6a3201) to head (5ba2dea).

Files Patch % Lines
pkg/services/object/put/local.go 0.00% 65 Missing ⚠️
pkg/network/transport/object/grpc/replication.go 72.00% 27 Missing and 8 partials ⚠️
cmd/neofs-node/grpc.go 0.00% 19 Missing ⚠️
cmd/neofs-node/object.go 0.00% 18 Missing ⚠️
pkg/services/object/put/remote.go 0.00% 15 Missing ⚠️
pkg/services/replicator/process.go 0.00% 15 Missing ⚠️
pkg/network/cache/multi.go 0.00% 12 Missing ⚠️
cmd/neofs-node/policy.go 82.85% 3 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2674      +/-   ##
==========================================
+ Coverage   22.00%   22.13%   +0.12%     
==========================================
  Files         791      793       +2     
  Lines       47297    47586     +289     
==========================================
+ Hits        10410    10535     +125     
- Misses      35993    36147     +154     
- Partials      894      904      +10     

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

@cthulhu-rider cthulhu-rider force-pushed the feature/object-separate-replication branch 7 times, most recently from 0b915af to 3a95318 Compare December 15, 2023 13:25
Copy link
Member

@carpawell carpawell left a comment

Choose a reason for hiding this comment

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

Could you point me to the place where ACLs are checked?

pkg/local_object_storage/blobstor/fstree/fstree.go Outdated Show resolved Hide resolved
cmd/neofs-node/replication.go Outdated Show resolved Hide resolved
pkg/network/transport/object/grpc/replication.go Outdated Show resolved Hide resolved
pkg/network/transport/object/grpc/service.go Outdated Show resolved Hide resolved
pkg/local_object_storage/blobstor/common/storage.go Outdated Show resolved Hide resolved
@cthulhu-rider cthulhu-rider force-pushed the feature/object-separate-replication branch 5 times, most recently from d1aef55 to 152b8a6 Compare January 30, 2024 16:08
@cthulhu-rider cthulhu-rider force-pushed the feature/object-separate-replication branch from 152b8a6 to 0a8d61a Compare March 5, 2024 10:29
@cthulhu-rider cthulhu-rider changed the title New object replication Use new API for background replication Mar 5, 2024
@cthulhu-rider cthulhu-rider force-pushed the feature/object-separate-replication branch from 0a8d61a to 2317ec8 Compare March 5, 2024 10:33
@cthulhu-rider
Copy link
Contributor Author

cthulhu-rider commented Mar 5, 2024

nspcc-dev/neofs-sdk-go@3f513ed is really desired. But we have current problem with SDK upgrades. So we should either w8 4 #2716 to be able to test this in master or postpone signature optimization

@cthulhu-rider cthulhu-rider marked this pull request as ready for review March 5, 2024 10:50
@cthulhu-rider cthulhu-rider added the blocked Can't be done because of something label Mar 5, 2024
@roman-khimov roman-khimov removed the blocked Can't be done because of something label Mar 21, 2024
@cthulhu-rider cthulhu-rider force-pushed the feature/object-separate-replication branch from 2317ec8 to fbac66d Compare March 22, 2024 11:20
cmd/neofs-node/grpc.go Outdated Show resolved Hide resolved
cmd/neofs-node/grpc.go Outdated Show resolved Hide resolved
cmd/neofs-node/policy.go Show resolved Hide resolved
cmd/neofs-node/policy.go Outdated Show resolved Hide resolved
pkg/network/transport/object/grpc/replication.go Outdated Show resolved Hide resolved
pkg/network/transport/object/grpc/service.go Show resolved Hide resolved
maxRecvSize, math.MaxInt))
}
maxRecvMsgSizeOpt = grpc.MaxRecvMsgSize(int(maxRecvSize))
c.log.Debug("limit max recv gRPC message size to fit max stored objects",
Copy link
Member

Choose a reason for hiding this comment

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

can be info, imo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

can ofc, do or not?

Copy link
Member

Choose a reason for hiding this comment

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

I'd leave it to Debug for now.

cmd/neofs-node/policy.go Outdated Show resolved Hide resolved
cmd/neofs-node/policy.go Outdated Show resolved Hide resolved
switch req.Signature.Scheme {
// other cases already checked above
case refs.SignatureScheme_ECDSA_SHA512:
pubKey = new(neofsecdsa.PublicKey)
Copy link
Member

Choose a reason for hiding this comment

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

we can have some generic func here, since this parsing routine is the same for all the keys (even err message is the same). not needed to have 3 cases then, all can be done in a single branch

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this parsing routine is the same for all the keys (even err message is the same)

these are different cases, looks similar (now) - yeah, but not the same. I dont think separate function will make code easier to understand

Copy link
Member

Choose a reason for hiding this comment

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

but how can they differ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

response (message, status details) can depend on particular scheme. The fact that i've made them similar doesnt mean all branches are the same. Current code shows what differs (overall) for different schemes - public key implementation and response messages

Copy link
Member

Choose a reason for hiding this comment

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

doesnt mean all branches are the same

but all branches are the same now

}

var clientInCnr, serverInCnr bool
err = s.node.ForEachContainerNodePublicKeyInLastTwoEpochs(cnr, func(pubKey []byte) bool {
Copy link
Member

Choose a reason for hiding this comment

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

that is the only call, do we need this interface to be that complex? can it just answers if some key(s) belons to a container in the last two epochs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this'd have inconvenient interface like M(cid.ID, [][]byte) ([]bool, error). Current method is more reusable and clear to me

Copy link
Member

Choose a reason for hiding this comment

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

well, you added two methods to implement a single functionality (and the first one is used to make the second one usable). it is undesired complexity to me

more reusable

well, not sure it'll be reused ever (just iterate container keys? why?)

but generally not that critical

Copy link
Contributor Author

Choose a reason for hiding this comment

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

just iterate container keys? why?

key-container relationship is a widely demanded operation in NeoFS

Copy link
Member

Choose a reason for hiding this comment

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

key-container relationship

this is a "bool" relation, my thread is about it

pkg/services/replicator/process.go Outdated Show resolved Hide resolved
@cthulhu-rider cthulhu-rider force-pushed the feature/object-separate-replication branch from fbac66d to ecb3a89 Compare March 28, 2024 08:19
@carpawell
Copy link
Member

Some conflicts also.

@cthulhu-rider
Copy link
Contributor Author

rebased, cut placement caches and checked still works. Left several refactor issues for the future. All rdy for merge

NeoFS protocol has been recently extended with new object replication
RPC `ObjectService.Replicate` separated from the general-purpose
`ObjectService.Put` one. According to API of the new RPC, all physically
stored objects are transmitted in one message. Also, replication request
and response formats are much simpler than for other operations.

Serve new RPC by the storage node app. Requests are served similar to
`ObjectService.Put` ones with TTL=1 (local only).

Refs #2317.

Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
It's more lightweight and supports binary copying without additional
decode-encode round.

Based on the fact that if the object is fixed, the request remains
unchanged. According to this, transport message is encoded once and sent
to all nodes.

Closes #2317. Refs #2316.

Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
@cthulhu-rider cthulhu-rider force-pushed the feature/object-separate-replication branch from 6e935b8 to 5ba2dea Compare April 3, 2024 06:46
}}, nil
} else if !serverInCnr {
return &objectGRPC.ReplicateResponse{Status: &status.Status{
Code: codeAccessDenied, Message: "server does not match the object's storage policy",
Copy link
Member

Choose a reason for hiding this comment

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

why not line per field?

@roman-khimov roman-khimov merged commit 51fefac into master Apr 3, 2024
15 of 16 checks passed
@roman-khimov roman-khimov deleted the feature/object-separate-replication branch April 3, 2024 10:31
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.

None yet

3 participants