[#1731] engine: Return the amount of actually moved objects in Evacuate

Signed-off-by: Evgenii Stratonikov <evgeniy@morphbits.ru>
This commit is contained in:
Evgenii Stratonikov 2022-09-13 14:18:00 +03:00 committed by fyrchik
parent 8fc88487db
commit 3df98ce7ba
3 changed files with 28 additions and 16 deletions

View file

@ -124,14 +124,16 @@ func (e *StorageEngine) Evacuate(prm EvacuateShardPrm) (EvacuateShardRes, error)
if shards[j].ID().String() == sid {
continue
}
ok := e.putToShard(shards[j].Shard, j, shards[j].pool, lst[i], getRes.Object())
if ok {
e.log.Debug("object is moved to another shard",
zap.String("from", sid),
zap.Stringer("to", shards[j].ID()),
zap.Stringer("addr", lst[i]))
putDone, exists := e.putToShard(shards[j].Shard, j, shards[j].pool, lst[i], getRes.Object())
if putDone || exists {
if putDone {
e.log.Debug("object is moved to another shard",
zap.String("from", sid),
zap.Stringer("to", shards[j].ID()),
zap.Stringer("addr", lst[i]))
res.count++
res.count++
}
continue loop
}
}