Skip to content

Commit

Permalink
cmd/tools/segment-verify: pass over bad segments
Browse files Browse the repository at this point in the history
Change-Id: I1b4dd9da755c6a2028760723e15219f5821f702f
  • Loading branch information
thepaul committed Dec 23, 2022
1 parent bfd189c commit 0b79007
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion cmd/tools/segment-verify/batch.go
Expand Up @@ -7,6 +7,8 @@ import (
"context"
"sort"

"go.uber.org/zap"

"storj.io/storj/satellite/metabase"
)

Expand Down Expand Up @@ -38,7 +40,17 @@ func (service *Service) CreateBatches(ctx context.Context, segments []*Segment)
// We assume that segment.AliasPieces is randomly ordered in terms of nodes.
for _, segment := range segments {
if len(segment.AliasPieces) < int(segment.Status.Retry) {
panic("segment contains too few pieces")
if service.config.Check == 0 {
// some pieces were removed in selectOnlinePieces. adjust the expected count.
segment.Status.Retry = int32(len(segment.AliasPieces))
} else {
service.log.Error("segment contains too few pieces. skipping segment",
zap.Int("num-pieces", len(segment.AliasPieces)),
zap.Int32("expected", segment.Status.Retry),
zap.Stringer("stream-id", segment.StreamID),
zap.Uint64("position", segment.Position.Encode()))
continue
}
}
for _, piece := range segment.AliasPieces[:segment.Status.Retry] {
enqueue(piece.Alias, segment)
Expand Down

0 comments on commit 0b79007

Please sign in to comment.