Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for merging single SearchV2 result #3155

Merged
merged 2 commits into from
Feb 18, 2025
Merged

Conversation

cthulhu-rider
Copy link
Contributor

No description provided.

Cover an empty result and various cursors cases.

Signed-off-by: Leonard Lyubich <[email protected]>
Previously, SearchV2 server calculated continuation flag incorrectly on
merging single search result incorrectly:
 1. it treated empty set as to-be-continued and tried to calculate new
 cursor from the merged result (*);
 2. it treated non-empty set under the limit as to-be-continued which is
 wrong.

The result is empty, so there is no last element. That's why the
following panic could occur:
```
panic: runtime error: index out of range [-1]

goroutine 1060 [running]:
github.com/nspcc-dev/neofs-node/pkg/services/object.(*server).processSearchRequest(0x14000224fd0, {0x102f644b0, 0x140009d6e70}, 0x1400033e980)
	github.com/nspcc-dev/neofs-node/pkg/services/object/server.go:2075 +0xf34
github.com/nspcc-dev/neofs-node/pkg/services/object.(*server).SearchV2(0x14000224fd0, {0x102f644b0, 0x140009d6e70}, 0x1400033e980)
	github.com/nspcc-dev/neofs-node/pkg/services/object/server.go:1918 +0x1fc
```

This fixes flag condition for single merged set. The panic occurs no more.

Fixes #3154. Refs #3058.

Signed-off-by: Leonard Lyubich <[email protected]>
@cthulhu-rider cthulhu-rider marked this pull request as ready for review February 18, 2025 17:45
Copy link

codecov bot commented Feb 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 23.03%. Comparing base (d0284a0) to head (0751b44).
Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3155      +/-   ##
==========================================
- Coverage   23.04%   23.03%   -0.01%     
==========================================
  Files         756      756              
  Lines       60202    60202              
==========================================
- Hits        13871    13870       -1     
  Misses      45335    45335              
- Partials      996      997       +1     

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

@roman-khimov roman-khimov merged commit 653d9f8 into master Feb 18, 2025
21 of 22 checks passed
@roman-khimov roman-khimov deleted the object-searchv2/panic branch February 18, 2025 18:03
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.

2 participants