forked from TrueCloudLab/frostfs-node
[#1222] engine: Fix object evacuation
Do not fail evacuation if it unable to evacuate object to other node. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
bbe95dac8b
commit
2bac82cd6f
3 changed files with 31 additions and 19 deletions
|
@ -145,18 +145,18 @@ func TestEvacuateObjectsNetwork(t *testing.T) {
|
|||
|
||||
errReplication := errors.New("handler error")
|
||||
|
||||
acceptOneOf := func(objects []*objectSDK.Object, max uint64) func(context.Context, oid.Address, *objectSDK.Object) error {
|
||||
acceptOneOf := func(objects []*objectSDK.Object, max uint64) func(context.Context, oid.Address, *objectSDK.Object) (bool, error) {
|
||||
var n uint64
|
||||
return func(_ context.Context, addr oid.Address, obj *objectSDK.Object) error {
|
||||
return func(_ context.Context, addr oid.Address, obj *objectSDK.Object) (bool, error) {
|
||||
if n == max {
|
||||
return errReplication
|
||||
return false, errReplication
|
||||
}
|
||||
|
||||
n++
|
||||
for i := range objects {
|
||||
if addr == objectCore.AddressOf(objects[i]) {
|
||||
require.Equal(t, objects[i], obj)
|
||||
return nil
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
require.FailNow(t, "handler was called with an unexpected object: %s", addr)
|
||||
|
@ -268,13 +268,13 @@ func TestEvacuateCancellation(t *testing.T) {
|
|||
|
||||
var prm EvacuateShardPrm
|
||||
prm.ShardID = ids[1:2]
|
||||
prm.ObjectsHandler = func(ctx context.Context, a oid.Address, o *objectSDK.Object) error {
|
||||
prm.ObjectsHandler = func(ctx context.Context, a oid.Address, o *objectSDK.Object) (bool, error) {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return ctx.Err()
|
||||
return false, ctx.Err()
|
||||
default:
|
||||
}
|
||||
return nil
|
||||
return true, nil
|
||||
}
|
||||
prm.Scope = EvacuateScopeObjects
|
||||
|
||||
|
@ -301,14 +301,14 @@ func TestEvacuateSingleProcess(t *testing.T) {
|
|||
var prm EvacuateShardPrm
|
||||
prm.ShardID = ids[1:2]
|
||||
prm.Scope = EvacuateScopeObjects
|
||||
prm.ObjectsHandler = func(ctx context.Context, a oid.Address, o *objectSDK.Object) error {
|
||||
prm.ObjectsHandler = func(ctx context.Context, a oid.Address, o *objectSDK.Object) (bool, error) {
|
||||
select {
|
||||
case <-running:
|
||||
default:
|
||||
close(running)
|
||||
}
|
||||
<-blocker
|
||||
return nil
|
||||
return true, nil
|
||||
}
|
||||
|
||||
eg, egCtx := errgroup.WithContext(context.Background())
|
||||
|
@ -344,14 +344,14 @@ func TestEvacuateObjectsAsync(t *testing.T) {
|
|||
var prm EvacuateShardPrm
|
||||
prm.ShardID = ids[1:2]
|
||||
prm.Scope = EvacuateScopeObjects
|
||||
prm.ObjectsHandler = func(ctx context.Context, a oid.Address, o *objectSDK.Object) error {
|
||||
prm.ObjectsHandler = func(ctx context.Context, a oid.Address, o *objectSDK.Object) (bool, error) {
|
||||
select {
|
||||
case <-running:
|
||||
default:
|
||||
close(running)
|
||||
}
|
||||
<-blocker
|
||||
return nil
|
||||
return true, nil
|
||||
}
|
||||
|
||||
st, err := e.GetEvacuationState(context.Background())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue