From b413094704baf09bb0a8d91ce4eaa70566f77377 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Thu, 24 Nov 2022 18:27:00 +0300 Subject: [PATCH] [#2095] node: Fix collecting child objects Stop child objects collection if the last returned object (the most "left" object in the collected chain) starts exactly from the `GETRANGE`'s `from` value. Signed-off-by: Pavel Karpy --- CHANGELOG.md | 2 ++ pkg/services/object/get/assemble.go | 4 +++- pkg/services/object/get/get_test.go | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index debfd7c3..7cfbe96a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,6 +51,8 @@ Changelog for NeoFS Node - `neofs-cli container create ` check the sufficiency of the number of nodes in the selector for replicas (#2038) - Data duplication during request forwarding (#2047) - Tree service panic on `TreeMove` operation (#2140) +- Panic in `GETRANGE` with zero length (#2095) +- Spawning useless `GETRANGE` with zero length for a big object (#2101) ### Removed - `-g` option from `neofs-cli control ...` and `neofs-cli container create` commands (#2089) diff --git a/pkg/services/object/get/assemble.go b/pkg/services/object/get/assemble.go index 59c74544..89d40008 100644 --- a/pkg/services/object/get/assemble.go +++ b/pkg/services/object/get/assemble.go @@ -203,7 +203,9 @@ func (exec *execCtx) buildChainInReverse(prev oid.ID) ([]oid.ID, []objectSDK.Ran // fill the chain end-to-start for withPrev { - if exec.curOff < from { + // check that only for "range" requests, + // for `GET` it stops via the false `withPrev` + if seekRng != nil && exec.curOff <= from { break } diff --git a/pkg/services/object/get/get_test.go b/pkg/services/object/get/get_test.go index 41e244fb..6167ad18 100644 --- a/pkg/services/object/get/get_test.go +++ b/pkg/services/object/get/get_test.go @@ -963,7 +963,7 @@ func TestGetRemoteSmall(t *testing.T) { addr.SetObject(oidtest.ID()) srcObj := generateObject(addr, nil, nil) - srcObj.SetPayloadSize(10) + srcObj.SetPayloadSize(11) ns, as := testNodeMatrix(t, []int{2})