Skip to content

Optimize buffering of forwarded SEARCH requests - #4116

Merged
roman-khimov merged 1 commit into
masterfrom
search-buffers
Aug 27, 2026
Merged

Optimize buffering of forwarded SEARCH requests#4116
roman-khimov merged 1 commit into
masterfrom
search-buffers

Conversation

@cthulhu-rider

Copy link
Copy Markdown
Contributor

No description provided.

@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 2.77778% with 105 lines in your changes missing coverage. Please review.
✅ Project coverage is 30.08%. Comparing base (d897b93) to head (60d9d35).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
pkg/services/object/server.go 0.00% 51 Missing ⚠️
pkg/services/object/proto.go 0.00% 26 Missing ⚠️
pkg/services/object/get.go 0.00% 14 Missing ⚠️
pkg/services/object/search.go 0.00% 14 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4116      +/-   ##
==========================================
- Coverage   30.10%   30.08%   -0.02%     
==========================================
  Files         679      679              
  Lines       40886    40893       +7     
==========================================
- Hits        12310    12304       -6     
- Misses      28576    28589      +13     

☔ 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.

@cthulhu-rider
cthulhu-rider marked this pull request as ready for review August 5, 2026 15:43

@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.

We need to share this code with SDK, it's unmaintainable otherwise.

Comment thread pkg/services/object/search.go Outdated
@cthulhu-rider

Copy link
Copy Markdown
Contributor Author

We need to share this code with SDK, it's unmaintainable otherwise.

this is planned to be done in #4005

@roman-khimov

Copy link
Copy Markdown
Member

Let's solve #4005 first then.

@cthulhu-rider

Copy link
Copy Markdown
Contributor Author

Let's solve #4005 first then.

i don't think it's worth blocking optimizations with refactorings

@roman-khimov

Copy link
Copy Markdown
Member

It's too easy to lose control over the codebase this way, we need to structure our changes appropriately as early as possible.

@cthulhu-rider

cthulhu-rider commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

It's too easy to lose control over the codebase this way, we need to structure our changes appropriately as early as possible.

agree. But at the same time the more usecases are created, the easier it will be to form libs

i'll try my best to synthesize SDK packages asap

Comment thread pkg/services/object/get.go Outdated
}
if n != len(buf) {
return nil, fmt.Errorf("got wrong request length: expected %d, got %d", n, len(buf))
return nil, newWrongRequestLengthError(len(buf), n)

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.

why in this commit?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

one more usecase appears

@carpawell carpawell Aug 10, 2026

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.

what this error means for a user btw? isnt it a panic?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

internal server error. Can be a panic. Should never happen anyway

Comment thread pkg/services/object/search.go Outdated
Comment thread pkg/services/object/proto.go Outdated
1 + maxGetResponseChunkVarintLen // 1 for iprotobuf.TagBytes2
getResponseChunkBufferLen = maxChunkOffsetInGetResponse + maxGetResponseChunkLen + maxResponseVerificationHeaderLen

modernRequestVerificationSignatureCount = 2

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.

make it api dependent? we will have nspcc-dev/neofs-api#406 soon, it will then be "the most modern"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

it is API dependent. To support new API feature, future change is inevitable

Comment thread pkg/services/object/proto.go Outdated
MarshalStable([]byte)
}

func writeStablyMarshalledField(buf []byte, tag byte, ln int, fld stablyMarshalledFIeld) int {

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.

can ln and fld merged into a single interface? likely every our struct will handle it ok

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

length of embedded messages is always needed twice: to calc whole message len and to write field prefix. So, i dont like the idea to calc it twice

Comment thread pkg/services/object/get.go Outdated
}
if n != len(buf) {
return nil, fmt.Errorf("got wrong request length: expected %d, got %d", n, len(buf))
return nil, newWrongRequestLengthError(len(buf), n)

@carpawell carpawell Aug 10, 2026

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.

what this error means for a user btw? isnt it a panic?

Comment thread pkg/services/object/server.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.

Needs to be shared with SDK code.

@cthulhu-rider

Copy link
Copy Markdown
Contributor Author

@cthulhu-rider
cthulhu-rider force-pushed the search-buffers branch 2 times, most recently from f701151 to 7a069cc Compare August 26, 2026 19:32
Comment thread pkg/services/object/search.go Outdated
Comment thread pkg/services/object/search.go Outdated
Comment thread pkg/services/object/server.go Outdated
Comment thread pkg/services/object/server.go Outdated
Comment thread pkg/services/object/server.go Outdated
Comment thread pkg/services/object/server.go Outdated
@roman-khimov

Copy link
Copy Markdown
Member

Linter.

@cthulhu-rider
cthulhu-rider force-pushed the search-buffers branch 3 times, most recently from e6b27c0 to 03c0100 Compare August 27, 2026 09:22
Server-side part of nspcc-dev/neofs-sdk-go@c4dda73.

Additionally de-duplicates the request encoding for sending to multiple
nodes.

Refs #4005.

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

connAPIVersion := conn.APIVersion()
connAPIVersionMsg := conn.APIVersion()
connAPIVersion := version.New(connAPIVersionMsg.GetMajor(), connAPIVersionMsg.GetMinor())

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.

Previous API was made to optimize out version->protorefs conversion, now we have protorefs->version. Maybe we need to change the API then.

@roman-khimov
roman-khimov merged commit fa949e8 into master Aug 27, 2026
20 of 22 checks passed
@roman-khimov
roman-khimov deleted the search-buffers branch August 27, 2026 10:05
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