Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Pavel Karpy <[email protected]>
  • Loading branch information
carpawell committed Jun 5, 2024
1 parent e5da072 commit 7cfd17f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pkg/local_object_storage/engine/evacuate.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,11 @@ mainLoop:
}

hrw.Sort(shards, addrHash)
e.log.Debug("sorted shards", zap.Strings("shards", shardsToStrings(shards)), zap.Stringer("addr", addr), zap.Uint64("hash", addrHash.Hash()))

for j := range shards {
if _, ok := shardMap[shards[j].ID().String()]; ok {
e.log.Debug("skipping shard", zap.String("shards", shards[j].ID().String()), zap.Int("shard len", len(shardMap)))
continue
}
putDone, exists := e.putToShard(shards[j].hashedShard, j, shards[j].pool, addr, PutPrm{obj: getRes.Object()})
Expand All @@ -164,6 +167,8 @@ mainLoop:
}
continue loop
}

e.log.Debug("shard tried but try another", zap.String("shard", shards[j].ID().String()))
}

if prm.handler == nil {
Expand All @@ -187,3 +192,12 @@ mainLoop:
zap.Strings("shard_ids", sidList))
return res, nil
}

func shardsToStrings(ss []pooledShard) []string {
res := make([]string, 0, len(ss))
for _, s := range ss {
res = append(res, s.ID().String())
}

return res
}
7 changes: 7 additions & 0 deletions pkg/local_object_storage/engine/put.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ func (e *StorageEngine) putToShard(sh hashedShard, ind int, pool util.WorkerPool

exists, err := sh.Exists(existPrm)
if err != nil {
e.log.Warn("check object existence in shard relocation", zap.Error(err))

Check warning on line 117 in pkg/local_object_storage/engine/put.go

View check run for this annotation

Codecov / codecov/patch

pkg/local_object_storage/engine/put.go#L117

Added line #L117 was not covered by tests

if shard.IsErrObjectExpired(err) {
// object is already found but
// expired => do nothing with it
Expand All @@ -138,6 +140,8 @@ func (e *StorageEngine) putToShard(sh hashedShard, ind int, pool util.WorkerPool
}
}

e.log.Warn("object already exist", zap.Stringer("addr", addr))

return
}

Expand All @@ -149,6 +153,8 @@ func (e *StorageEngine) putToShard(sh hashedShard, ind int, pool util.WorkerPool

_, err = sh.Put(putPrm)
if err != nil {
e.log.Warn("could not put object to shard", zap.Error(err), zap.Stringer("shard_id", sh.ID()))

if errors.Is(err, shard.ErrReadOnlyMode) || errors.Is(err, blobstor.ErrNoPlaceFound) ||
errors.Is(err, common.ErrReadOnly) || errors.Is(err, common.ErrNoSpace) {
e.log.Warn("could not put object to shard",
Expand All @@ -163,6 +169,7 @@ func (e *StorageEngine) putToShard(sh hashedShard, ind int, pool util.WorkerPool

putSuccess = true
}); err != nil {
e.log.Warn("pool's submitting put", zap.Error(err))

Check warning on line 172 in pkg/local_object_storage/engine/put.go

View check run for this annotation

Codecov / codecov/patch

pkg/local_object_storage/engine/put.go#L172

Added line #L172 was not covered by tests
close(exitCh)
}

Expand Down

0 comments on commit 7cfd17f

Please sign in to comment.