Skip to content

Optimize buffering of forwarded SEARCH requests - #4116

Open
cthulhu-rider wants to merge 1 commit into
masterfrom
search-buffers
Open

Optimize buffering of forwarded SEARCH requests#4116
cthulhu-rider wants to merge 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 5.22388% with 127 lines in your changes missing coverage. Please review.
✅ Project coverage is 27.13%. Comparing base (36e3cf4) to head (4c3813e).

Files with missing lines Patch % Lines
pkg/services/object/server.go 0.00% 63 Missing ⚠️
pkg/services/object/search.go 0.00% 53 Missing ⚠️
pkg/services/object/proto.go 28.57% 5 Missing ⚠️
pkg/services/object/common.go 55.55% 4 Missing ⚠️
pkg/services/object/get.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4116      +/-   ##
==========================================
- Coverage   27.19%   27.13%   -0.06%     
==========================================
  Files         677      677              
  Lines       46206    46312     +106     
==========================================
+ Hits        12564    12567       +3     
- Misses      32442    32546     +104     
+ Partials     1200     1199       -1     

☔ 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

func (s *Server) writeLocalSearchObjectsRequest(buf []byte, bodyLen int, body *protoobject.SearchV2Request_Body, metaHdrLen int) (int, error) {
// TODO: can be calculated once and reused
originSig, err := neofsecdsa.Signer(s.signer).Sign(nil)

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.

Not needed for API 2.25.

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.

right. Lets handle #4118 first then

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.

done

@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

}
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
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

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

}
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
Server-side part of nspcc-dev/neofs-sdk-go@c4dda73.

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

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

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

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