Skip to content

Commit ecfcd5e

Browse files
committed
object/search: Prevent transmission of empty intermediate messages
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]>
1 parent 9f4bf88 commit ecfcd5e

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Changelog for NeoFS Node
1313
- Neo RPC client failure when the first endpoint is unavailable even if there are more endpoints to try (#2703)
1414
- Incorrect address mapping of the Alphabet contracts in NNS produced by deployment procedure (#2713)
1515
- IR compares and logs public keys difference, not hash of keys difference at SN verification check (#2711)
16+
- Object search server no longer wastes system resources sending empty intermediate messages to the stream (#xxx)
1617

1718
### Changed
1819
- Created files are not group writable (#2589)

pkg/services/object/search/exec.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,11 @@ func (exec *execCtx) generateTraverser(cnr cid.ID) (*placement.Traverser, bool)
117117
}
118118

119119
func (exec *execCtx) writeIDList(ids []oid.ID) {
120-
err := exec.prm.writer.WriteIDs(ids)
120+
var err error
121+
122+
if len(ids) > 0 {
123+
err = exec.prm.writer.WriteIDs(ids)
124+
}
121125

122126
switch {
123127
default:

0 commit comments

Comments
 (0)