Skip to content

Commit 2521e89

Browse files
committed
object/get: Do not access the node repeatedly within the same request
Same motivation and changes as in 67ababa. Signed-off-by: Leonard Lyubich <[email protected]>
1 parent 67ababa commit 2521e89

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

pkg/services/object/get/container.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ func (exec *execCtx) processEpoch(epoch uint64) bool {
4141
defer cancel()
4242

4343
exec.status = statusUndefined
44+
mProcessedNodes := make(map[string]struct{})
4445

4546
for {
4647
addrs := traverser.Next()
@@ -61,6 +62,13 @@ func (exec *execCtx) processEpoch(epoch uint64) bool {
6162
default:
6263
}
6364

65+
strKey := string(addrs[i].PublicKey())
66+
if _, ok = mProcessedNodes[strKey]; ok {
67+
continue
68+
}
69+
70+
mProcessedNodes[strKey] = struct{}{}
71+
6472
// TODO: #1142 consider parallel execution
6573
// TODO: #1142 consider optimization: if status == SPLIT we can continue until
6674
// we reach the best result - split info with linking object ID.

pkg/services/object/get/get_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,8 +426,12 @@ func testNodeMatrix(t testing.TB, dim []int) ([][]netmap.NodeInfo, [][]string) {
426426
strconv.Itoa(60000+j),
427427
)
428428

429+
bPubKey := make([]byte, 33)
430+
rand.Read(bPubKey)
431+
429432
var ni netmap.NodeInfo
430433
ni.SetNetworkEndpoints(a)
434+
ni.SetPublicKey(bPubKey)
431435

432436
var na network.AddressGroup
433437

0 commit comments

Comments
 (0)