repair

package
v1.117.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2024 License: AGPL-3.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SegmentHealth

func SegmentHealth(numHealthy, minPieces, totalNodes int, failureRate float64, numForcingRepair int) float64

SegmentHealth returns a value corresponding to the health of a segment in the repair queue. Lower health segments should be repaired first.

This implementation uses segmentHealthNHD to calculate the base health value.

An additional wrinkle added here is that we need to assign high priority to pieces which need to be repaired as soon as possible, e.g., pieces out of placement ("POPs"). We want to tune it so that segments with POPs are generally higher priority than other segments, and segments with more POPs are generally higher priority than segments with fewer POPs. It is possible, however, for a segment with no POPs to be prioritized above a segment that does have POPs, if the first segment is in sufficient danger and the second segment is not.

Types

type PiecesCheckResult added in v1.89.2

type PiecesCheckResult struct {
	// Missing is a set of Piece Numbers which are to be considered as lost and irretrievable.
	// (They reside on offline/disqualified/unknown nodes.)
	Missing intset.Set
	// Retrievable contains all Piece Numbers that are retrievable; that is, all piece numbers
	// from the segment that are NOT in Missing.
	Retrievable intset.Set

	// Suspended is a set of Piece Numbers which reside on nodes which are suspended.
	Suspended intset.Set
	// Clumped is a set of Piece Numbers which are to be considered unhealthy because of IP
	// clumping. (If DoDeclumping is disabled, this set will be empty.)
	Clumped intset.Set
	// Exiting is a set of Piece Numbers which are considered unhealthy because the node on
	// which they reside has initiated graceful exit.
	Exiting intset.Set
	// OutOfPlacement is a set of Piece Numbers which are unhealthy because of placement rules.
	// (If DoPlacementCheck is disabled, this set will be empty.)
	OutOfPlacement intset.Set
	// InExcludedCountry is a set of Piece Numbers which are unhealthy because they are in
	// Excluded countries.
	InExcludedCountry intset.Set

	// ForcingRepair is the set of pieces which force a repair operation for this segment (that
	// includes, currently, only pieces in OutOfPlacement).
	ForcingRepair intset.Set
	// Unhealthy contains all Piece Numbers which are in Missing OR Suspended OR Clumped OR
	// Exiting OR OutOfPlacement OR InExcludedCountry.
	Unhealthy intset.Set
	// UnhealthyRetrievable is the set of pieces that are "unhealthy-but-retrievable". That is,
	// pieces that are in Unhealthy AND Retrievable.
	UnhealthyRetrievable intset.Set
	// Healthy contains all Piece Numbers from the segment which are not in Unhealthy.
	// (Equivalently: all Piece Numbers from the segment which are NOT in Missing OR
	// Suspended OR Clumped OR Exiting OR OutOfPlacement OR InExcludedCountry).
	Healthy intset.Set
}

PiecesCheckResult contains all necessary aggregate information about the state of pieces in a segment. The node that should be holding each piece is evaluated to see if it is online and whether it is in a clumped IP network, in an excluded country, or out of placement for the segment.

func ClassifySegmentPieces added in v1.89.2

func ClassifySegmentPieces(pieces metabase.Pieces, nodes []nodeselection.SelectedNode, excludedCountryCodes map[location.CountryCode]struct{},
	doPlacementCheck, doDeclumping bool, placement nodeselection.Placement) (result PiecesCheckResult)

ClassifySegmentPieces classifies the pieces of a segment into the categories represented by a PiecesCheckResult. Pieces may be put into multiple categories.

func (PiecesCheckResult) MarshalLogObject added in v1.109.1

func (result PiecesCheckResult) MarshalLogObject(enc zapcore.ObjectEncoder) error

MarshalLogObject implements zapcore.ObjectMarshaler.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL