satellite/repair: change how we log clumped pieces
rather than only logging the last_nets we see in clumpedPieces, this will run through all the last_nets and log any that have more than one node. This should have the same outcome, except the counts will be 1 higher (because FindClumpedPieces won't include the first node found in a clumped network, and this will). This should be quite a bit faster. Change-Id: I6a7b2fd387e98963d5295c9ecfde80f2e1ee3b7a
This commit is contained in:
parent
c856d45cc0
commit
3dc01bd25d
@ -438,11 +438,7 @@ func (fork *observerFork) process(ctx context.Context, segment *rangedloop.Segme
|
||||
// This segment is to be repaired because of clumping (it wouldn't need repair yet
|
||||
// otherwise). Produce a brief report of where the clumping occurred so that we have
|
||||
// a better understanding of the cause.
|
||||
clumpedNets := clumpingReport{
|
||||
clumpedPieces: clumpedPieces,
|
||||
allPieces: segment.Pieces,
|
||||
lastNets: lastNets,
|
||||
}
|
||||
clumpedNets := clumpingReport{lastNets: lastNets}
|
||||
fork.log.Info("segment needs repair because of clumping", zap.Stringer("Segment StreamID", segment.StreamID), zap.Uint64("Segment Position", segment.Position.Encode()), zap.Int("total pieces", len(pieces)), zap.Int("min required", required), zap.Stringer("clumping", &clumpedNets))
|
||||
}
|
||||
} else {
|
||||
@ -473,28 +469,24 @@ func (fork *observerFork) process(ctx context.Context, segment *rangedloop.Segme
|
||||
}
|
||||
|
||||
type clumpingReport struct {
|
||||
clumpedPieces metabase.Pieces
|
||||
allPieces metabase.Pieces
|
||||
lastNets []string
|
||||
lastNets []string
|
||||
}
|
||||
|
||||
// String produces the clumping report. In case the satellite isn't logging at the required level,
|
||||
// we avoid doing the work of building the report until String() is called.
|
||||
func (cr *clumpingReport) String() string {
|
||||
clumpedNets := make(map[string]int)
|
||||
for _, clumpedPiece := range cr.clumpedPieces {
|
||||
lastNet := ""
|
||||
for i, piece := range cr.allPieces {
|
||||
if piece.Number == clumpedPiece.Number && piece.StorageNode.Compare(clumpedPiece.StorageNode) == 0 {
|
||||
lastNet = cr.lastNets[i]
|
||||
break
|
||||
}
|
||||
netCounts := make(map[string]int)
|
||||
for _, lastNet := range cr.lastNets {
|
||||
if lastNet == "" {
|
||||
lastNet = "unknown"
|
||||
}
|
||||
clumpedNets[lastNet]++
|
||||
netCounts[lastNet]++
|
||||
}
|
||||
counts := make([]string, 0, len(clumpedNets))
|
||||
for clumpedNet, count := range clumpedNets {
|
||||
counts = append(counts, fmt.Sprintf("[%s]: %d", clumpedNet, count))
|
||||
counts := make([]string, 0, len(netCounts))
|
||||
for lastNet, count := range netCounts {
|
||||
if count > 1 {
|
||||
counts = append(counts, fmt.Sprintf("[%s]: %d", lastNet, count))
|
||||
}
|
||||
}
|
||||
return strings.Join(counts, ", ")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user