Skip to content

Commit

Permalink
object/search: Prevent transmission of empty intermediate messages
Browse files Browse the repository at this point in the history
Previously, `ObjectService.Search` RPC server could write empty
intermediate messages to the response stream. This did not break
anything, but it resulted in a waste of cluster resources without any
benefit. The case occurred due to the fact that the server sends at
least one response message based on the search result on each of the
container nodes, and empty results were not excluded.

From now, if nothing is found on a single node, the server does not
write a message to the stream.

Signed-off-by: Leonard Lyubich <[email protected]>
  • Loading branch information
cthulhu-rider committed Jan 17, 2024
1 parent 9f4bf88 commit 04d99d4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Changelog for NeoFS Node
- Neo RPC client failure when the first endpoint is unavailable even if there are more endpoints to try (#2703)
- Incorrect address mapping of the Alphabet contracts in NNS produced by deployment procedure (#2713)
- IR compares and logs public keys difference, not hash of keys difference at SN verification check (#2711)
- Object search server no longer wastes system resources sending empty intermediate messages to the stream (#2722)

### Changed
- Created files are not group writable (#2589)
Expand Down
6 changes: 5 additions & 1 deletion pkg/services/object/search/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,11 @@ func (exec *execCtx) generateTraverser(cnr cid.ID) (*placement.Traverser, bool)
}

func (exec *execCtx) writeIDList(ids []oid.ID) {
err := exec.prm.writer.WriteIDs(ids)
var err error

if len(ids) > 0 {
err = exec.prm.writer.WriteIDs(ids)
}

switch {
default:
Expand Down

0 comments on commit 04d99d4

Please sign in to comment.