Skip to content

Commit

Permalink
fix: check chunkBinItem during reserve repair (#4672)
Browse files Browse the repository at this point in the history
  • Loading branch information
istae authored May 15, 2024
1 parent 485ec6c commit 2a33da4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion pkg/pullsync/pullsync.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ package pullsync

import (
"context"
"encoding/hex"
"errors"
"fmt"
"io"
Expand Down Expand Up @@ -466,7 +467,7 @@ func (s *Syncer) processWant(ctx context.Context, o *pb.Offer, w *pb.Want) ([]sw
addr := swarm.NewAddress(ch.Address)
c, err := s.store.ReserveGet(ctx, addr, ch.BatchID)
if err != nil {
s.logger.Debug("processing want: unable to find chunk", "chunk_address", addr, "batch_id", ch.BatchID)
s.logger.Debug("processing want: unable to find chunk", "chunk_address", addr, "batch_id", hex.EncodeToString(ch.BatchID))
chunks = append(chunks, swarm.NewChunk(swarm.ZeroAddress, nil))
s.metrics.MissingChunks.Inc()
continue
Expand Down
4 changes: 2 additions & 2 deletions pkg/storer/migration/reserveRepair.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ func ReserveRepairer(
binIds := make(map[uint8]map[uint64]int)
return st.IndexStore().Iterate(
storage.Query{
Factory: func() storage.Item { return &reserve.ChunkBinItem{} },
Factory: func() storage.Item { return &reserve.BatchRadiusItem{} },
},
func(res storage.Result) (bool, error) {
item := res.Entry.(*reserve.ChunkBinItem)
item := res.Entry.(*reserve.BatchRadiusItem)
if _, ok := binIds[item.Bin]; !ok {
binIds[item.Bin] = make(map[uint64]int)
}
Expand Down

0 comments on commit 2a33da4

Please sign in to comment.