Skip to content

Improve GET/HEAD replica localization - #4232

Merged
roman-khimov merged 6 commits into
masterfrom
get-rep-localization
Oct 26, 2026
Merged

roman-khimov merged 6 commits into
masterfrom
get-rep-localization

Conversation

@cthulhu-rider

Copy link
Copy Markdown
Contributor

i've had these changes for quite a while. I think it's time to improve this part

@cthulhu-rider
cthulhu-rider force-pushed the get-rep-localization branch 3 times, most recently from 6fd1c09 to ab15099 Compare October 22, 2026 16:47
@codecov

codecov Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.00000% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 32.37%. Comparing base (964e052) to head (e8346d8).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
pkg/services/object/get/container.go 78.26% 5 Missing ⚠️
internal/netmap/netmap.go 0.00% 1 Missing ⚠️
pkg/services/object/get/get.go 95.83% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4232      +/-   ##
==========================================
+ Coverage   32.34%   32.37%   +0.03%     
==========================================
  Files         673      673              
  Lines       41405    41430      +25     
==========================================
+ Hits        13393    13414      +21     
- Misses      28012    28016       +4     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Retry handling can corrupt partially written responses, and failed split assembly can skip usable local metadata.

2 open issues
What changed in this PR

This PR changes GET/HEAD replica lookup to follow container placement order, prioritizing local storage when the node is a primary holder and otherwise deferring local reads.

Changes:

  • Reorders replica traversal and adds a final local-storage fallback.
  • Separates local and container result handling.
  • Exports a node-set lookup helper, adjusts streaming-failure tests, and documents the behavior.
File Description
pkg/​services/​object/​get/​local.go Returns whether local execution should stop traversal.
pkg/​services/​object/​get/​get.go Separates request routing and result analysis.
pkg/​services/​object/​get/​get_test.go Models local-node identity in streaming-failure tests.
pkg/​services/​object/​get/​container.go Implements placement-aware local reads and fallback.
internal/​netmap/​netmap.go Exports the single-node-set public-key lookup helper.
CHANGELOG.md Documents the GET/HEAD lookup changes.

Review effort: Balanced

Comment thread pkg/services/object/get/container.go
Comment thread pkg/services/object/get/container.go Outdated

@roman-khimov roman-khimov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks legit, but check Copilot comments.

Was caused by a method call without changing the state.

Before:
```
2026-09-12T09:24:20.703+0300	debug	get/get.go:239	operation finished with error	{"component": "Object.Get service", "address": "3VkN6ekDbYnYrDAgmsj5c66GvDLaRVFZj4SBZhj6R8G2/3VkN6ekDbYnYrDAgmsj5c66GvDLaRVFZj4SBZhj6R8G2", "raw": false, "local": true, "with session": false, "with bearer": false, "request": "GET", "error": "status: code = 2049 message = object not found"}
2026-09-12T09:24:20.703+0300	debug	get/container.go:11	return result directly	{"component": "Object.Get service", "address": "3VkN6ekDbYnYrDAgmsj5c66GvDLaRVFZj4SBZhj6R8G2/3VkN6ekDbYnYrDAgmsj5c66GvDLaRVFZj4SBZhj6R8G2", "raw": false, "local": true, "with session": false, "with bearer": false, "request": "GET"}
2026-09-12T09:24:20.703+0300	debug	get/get.go:239	operation finished with error	{"component": "Object.Get service", "address": "3VkN6ekDbYnYrDAgmsj5c66GvDLaRVFZj4SBZhj6R8G2/3VkN6ekDbYnYrDAgmsj5c66GvDLaRVFZj4SBZhj6R8G2", "raw": false, "local": true, "with session": false, "with bearer": false, "request": "GET", "error": "status: code = 2049 message = object not found"}
```

Now there will be no repeat message.

Signed-off-by: Leonard Liubich <leonard@morphbits.io>
Refactoring purpose.

Signed-off-by: Leonard Liubich <leonard@morphbits.io>
The final goal is to not make local operation blindly but when handling
sorted container node list.

Also, a bit more code is usually more understandable than recursion.

Signed-off-by: Leonard Liubich <leonard@morphbits.io>
Previously, GET/HEAD server was always looked up for the object locally
first, regardless of the placement policy. This introduced overhead in
the case of optimal placement.

The main motivation was to maintain object availability when its replica
was moved to a reserve container node or if it became stuck outside the
container. Since this is also a live case in a storage distributed
system, this preserves local reading but as a fallback.

In the context of performance on reading with a uniform load
distribution across the entire cluster, an increase in RPS is not
expected since the costs are negligible relative to actual DB/FS reading
and RPC. However, with optimal placement (which is the target), the
processing speed of a single request is guaranteed to increase, and the
cost of a DB transaction (in particular, allocs) will disappear.

Closes #3411.

Signed-off-by: Leonard Liubich <leonard@morphbits.io>
Signed-off-by: Leonard Liubich <leonard@morphbits.io>
They are always called in pairs.

Signed-off-by: Leonard Liubich <leonard@morphbits.io>
@roman-khimov
roman-khimov merged commit 2c7b39e into master Oct 26, 2026
24 of 25 checks passed
@roman-khimov
roman-khimov deleted the get-rep-localization branch October 26, 2026 12:43
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