As it was before: when the database was opened, an error returned,
but along with the original error, the `context cancelled`` error returned,
because `iterateIncompletedRebuildDBPaths` method has `ctx.Done()` check
and egCtx passed to `iterateIncompletedRebuildDBPaths` method.
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
If applyOperationStream() exits prematurely, other goroutines will block
on send and errgroup will never finish waiting. In this commit we also
check whether context is cancelled.
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
Constant string `testOwnerID` for these tests has an invalid
format. It has 11 bytes instead of required 25 for `user.ID`.
It worked because:
1. `user.ID` was a byte slice and didn't check length
and format of byte slices decoded from strings.
2. in these tests `testOwnerID` was used only to decode
container owner id and to compare it with owner id encoded
back to string.
Since `user.ID implementation has changed`, the problem arised.
Now `testOwnerID` is valid.
Signed-off-by: Ekaterina Lebedeva <ekaterina.lebedeva@yadro.com>
Current flow is hard to reason about, #1601 is a notorious example of
accidental complexity.
1. Remove multiple nested ifs, use depth=1.
2. Process each status exactly once, hopefully preventing bugs like
#1601.
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
Consider `REP 1 REP 1` placement (selects/filters are omitted).
The placement is `[1, 2], [1, 0]`. We are the 0-th node.
Node 1 is under maintenance, so we do not replicate object
on the node 2. In the second replication group node 1 is under maintenance,
but current caching logic considers it as "replica holder" and removes
local copy. Voilà, we have DL if the object is missing from the node 1.
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
The node can have MAINTENANCE status in the network map, but can also be
ONLINE while responding with MAINTENANCE. These are 2 different code
paths, let's test them separately.
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
* X-Headers can be found in `origin` field of `MetaHeader` if the request
has been forwarded from non-container node.
Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
Avoid dependency on `morph/client` package because of `InvokeRes`.
Make signature resemble `WaitAny()` method of `waiter.Waiter` from neo-go.
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
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>
* 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>
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>