Previously, `ln` was only set once, so search has really worked for
small number of objects.
Fix panic:
```
panic: runtime error: slice bounds out of range [:43690] with capacity 21238
goroutine 6859775 [running]:
git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object.(*searchStreamMsgSizeCtrl).Send(0xc001eec8d0, 0xc005734000)
git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/transport_splitter.go:173 +0x1f0
git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/search/v2.(*streamWriter).WriteIDs(0xc000520320, {0xc00eb1a000, 0x4fd9c, 0x7fd6475a9a68?})
git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/search/v2/streamer.go:28 +0x155
git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/search.(*uniqueIDWriter).WriteIDs(0xc001386420, {0xc00eb1a000?, 0xc0013ea9c0?, 0x113eef3?})
git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/search/util.go:62 +0x202
git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/search.(*execCtx).writeIDList(0xc00011aa38?, {0xc00eb1a000?, 0xc001eec9f0?, 0xc0008f4380?})
git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/search/exec.go:68 +0x91
git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/search.(*execCtx).executeLocal(0xc0008f4380, {0x176c538, 0xc001eec9f0})
git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/search/local.go:18 +0x16b
```
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
* Separated iteration through container ids from `ContainersOf()`
so that it could be reused.
* When listing containers we used to iterate through the
the whole list of containers twice: first when reading from
a contract, then when sending them. Now we can send batches
of containers when reading from the contract.
Signed-off-by: Ekaterina Lebedeva <ekaterina.lebedeva@yadro.com>
Update this test following recent changes to ensure
that `(*DB).ListWithCursor` skips expired objects.
Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>
Previously, `object head` was used if no range was provided.
This is wrong on multiple levels:
1. We print an error if the checksum is missing in header,
even though taking hash is possible.
2. We silently ignore --salt parameter.
3. `--range` is required for Object.RANGEHASH RPC, custom logic for one
specific usecase has no value.
So we make it required and make CLI command follow more closely
the FrostFS API.
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
* Added new method for listing containers to container service.
It opens stream and sends containers in batches.
* Added TransportSplitter wrapper around ExecutionService to
split container ID list read from contract in parts that are
smaller than grpc max message size. Batch size can be changed
in node configuration file (as in example config file).
* Changed `container list` implementaion in cli: now ListStream
is called by default. Old List is called only if ListStream
is not implemented.
* Changed `internalclient.ListContainersPrm`.`Account` to
`OwnerID` since `client.PrmContainerList`.`Account` was
renamed to `OwnerID` in sdk.
Signed-off-by: Ekaterina Lebedeva <ekaterina.lebedeva@yadro.com>
* Replaced `sort.Slice` with `slices.SortFunc` in
`ListContainersRes.SortedIDList()` as it is a bit faster,
according to 15102e6dfd.
Signed-off-by: Ekaterina Lebedeva <ekaterina.lebedeva@yadro.com>
Use `zap.Error` instead of `zap.String` for logging errors: change all expressions like
`zap.String("error", err.Error())` or `zap.String("err", err.Error())` to `zap.Error(err)`.
Leave similar expressions with other messages unchanged, for example,
`zap.String("last_error", lastErr.Error())` or `zap.String("reason", ctx.Err().Error())`.
This change was made by applying the following patch:
```diff
@@
var err expression
@@
-zap.String("error", err.Error())
+zap.Error(err)
@@
var err expression
@@
-zap.String("err", err.Error())
+zap.Error(err)
```
Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>
- Fix misplaced `(*DB).Close` (broken after 47dcfa20f3)
- Use `errors.Is` for error checking (broken after fcdbf5e509)
Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>
Also, make them public, because otherwise `unused` linter complains.
```
pkg/morph/event/utils.go:25:2 unused field `typ` is unused
```
This complain is wrong, though: we _use_ `typ` field because the whole
struct is used as a map key.
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
They are decoupled, but it is an error to have a handler without a
corresponding parser. Register them together on the code level and get
rid of unreachable code.
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This codepath hides possible bugs in code.
All initialization function should run before init stage.
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>