replicator: move EC local/remote logic from policer#3854
replicator: move EC local/remote logic from policer#3854
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #3854 +/- ##
==========================================
- Coverage 25.79% 25.78% -0.02%
==========================================
Files 670 670
Lines 43139 43122 -17
==========================================
- Hits 11128 11118 -10
+ Misses 30994 30984 -10
- Partials 1017 1020 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| type Network interface { | ||
| // IsLocalNodePublicKey checks whether given binary-encoded public key is | ||
| // assigned in the network map to a local storage node running [Replicator]. | ||
| IsLocalNodePublicKey([]byte) bool |
There was a problem hiding this comment.
Frankly, I still have no idea why we're not passing this slice into services directly to perform any comparisons locally. It can't change for a node. But that's a bit different topic, every service has it.
There was a problem hiding this comment.
At first, I just wanted to pass the key itself, but then I saw that it was taken from netmap, so I assumed that it could change.
neofs-node/cmd/neofs-node/netmap.go
Lines 139 to 146 in 72d4b6d
There was a problem hiding this comment.
we do not support key hot swap, so it is always a slice for a node that does not restart
There was a problem hiding this comment.
Should be changed for all services, here we can follow whatever is done everywhere already.
| } | ||
|
|
||
| for i := range iec.NodeSequenceForPart(partIdx, int(rule.DataPartNum)+int(rule.ParityPartNum), len(sortedNodes)) { | ||
| if p.network.IsLocalNodePublicKey(sortedNodes[i].PublicKey()) { |
There was a problem hiding this comment.
Not sure this check is practical at all. A node can't detect it's own missing part. Even if netmap changes the set of nodes is the same from check to recreate. We also have some part already (which is why we're here). So we should replicate this part (if needed) and check for other parts (on other nodes) and then replicate new parts to that remote nods (if needed).
One thing I can imagine netmap change + a lost part in which case we'd have a part, but a wrong one and we'd like to both push our part to another node and recreate this missing part for ourselves. How practical that is (given that other nodes will recreate/replicate it too) is an open question.
There was a problem hiding this comment.
Should we remove this check then?
35b1188 to
59bc938
Compare
pkg/services/replicator/process.go
Outdated
|
|
||
| if p.localNodeKey.IsLocalNodePublicKey(task.nodes[i].PublicKey()) { | ||
| if task.obj == nil { | ||
| log.Error("cannot put object to local storage: object not provided in task") |
There was a problem hiding this comment.
i would say this is a dev err, so either panic or do not Error, admin can do nothing about it
| zap.Stringer("object", task.addr), | ||
| ) | ||
|
|
||
| if p.localNodeKey.IsLocalNodePublicKey(task.nodes[i].PublicKey()) { |
There was a problem hiding this comment.
btw, how is it possible? we are the node that started replication process, and we are the node that should store it? i think i do not understand smth, i thought in evacuation process replication is only called when we already failed to put it locally
| type Network interface { | ||
| // IsLocalNodePublicKey checks whether given binary-encoded public key is | ||
| // assigned in the network map to a local storage node running [Replicator]. | ||
| IsLocalNodePublicKey([]byte) bool |
There was a problem hiding this comment.
Should be changed for all services, here we can follow whatever is done everywhere already.
0f35f9d to
bee32e1
Compare
Always use replication API instead of `PutObject` for all replication paths, including when the object is provided directly in the task. Local/remote node decision logic is moved from policer's `recreateECPart` into `HandleTask`, so `recreateECPart` now simply forms the EC part object and delegates everything to the generic `HandleTask`. `PutObjectToNode` is dropped from replicator. Closes #3809. Signed-off-by: Andrey Butusov <andrey@nspcc.io>
Closes #3809.