cockroach: Index | Files

package reports

import ""


Package Files

constraint_stats_report.go critical_localities_report.go replication_stats_report.go reporter.go zone_key.go


const NoSubzone base.SubzoneID = 0

NoSubzone is used inside a zoneKey to indicate that the key represents a zone, not a subzone.


var ReporterInterval = settings.RegisterPublicNonNegativeDurationSetting(
    "the frequency for generating the replication_constraint_stats, replication_stats_report and "+
        "replication_critical_localities reports (set to 0 to disable)",

ReporterInterval is the interval between two generations of the reports. When set to zero - disables the report generation.

type ConstraintReport Uses

type ConstraintReport map[ConstraintStatusKey]ConstraintStatus

ConstraintReport contains information about the constraint conformance for the cluster's data.

func (ConstraintReport) AddViolation Uses

func (r ConstraintReport) AddViolation(z ZoneKey, t ConstraintType, c ConstraintRepr)

AddViolation add a constraint that is being violated for a given range. Each call will increase the number of ranges that failed.

type ConstraintRepr Uses

type ConstraintRepr string

ConstraintRepr is a string representation of a constraint.

func (ConstraintRepr) Less Uses

func (c ConstraintRepr) Less(other ConstraintRepr) bool

Less compares two ConstraintReprs.

type ConstraintStatus Uses

type ConstraintStatus struct {
    FailRangeCount int

ConstraintStatus is the leaf in the constraintReport.

type ConstraintStatusKey Uses

type ConstraintStatusKey struct {
    ViolationType ConstraintType
    Constraint    ConstraintRepr

ConstraintStatusKey represents the key in the ConstraintReport.

func (ConstraintStatusKey) Less Uses

func (k ConstraintStatusKey) Less(other ConstraintStatusKey) bool

Less compares two ConstraintStatusKeys.

func (ConstraintStatusKey) String Uses

func (k ConstraintStatusKey) String() string

type ConstraintType Uses

type ConstraintType string

ConstraintType indicates what type of constraint is an entry in the constraint conformance report talking about.

const (
    // Constraint means that the entry refers to a constraint (i.e. a member of
    // the constraints field in a zone config).
    Constraint ConstraintType = "constraint"

func (ConstraintType) Less Uses

func (t ConstraintType) Less(other ConstraintType) bool

Less compares two ConstraintTypes.

type LocalityReport Uses

type LocalityReport map[localityKey]localityStatus

LocalityReport stores the range status information for each locality and applicable zone.

func (LocalityReport) CountRangeAtRisk Uses

func (r LocalityReport) CountRangeAtRisk(zKey ZoneKey, loc LocalityRepr)

CountRangeAtRisk increments the number of ranges at-risk for the report entry corresponding to the given zone and locality. In other words, the report will count the respective locality as critical for one more range in the given zone.

type LocalityRepr Uses

type LocalityRepr string

LocalityRepr is a representation of a locality.

type RangeIterator Uses

type RangeIterator interface {
    // Next returns the next range descriptors (in key order).
    // Returns an empty RangeDescriptor when all the ranges have been exhausted. In that case,
    // the iterator is not to be used any more (except for calling Close(), which will be a no-op).
    // The returned error can be a retriable one (i.e.
    // *roachpb.TransactionRetryWithProtoRefreshError, possibly wrapped). In that case, the iterator
    // is reset automatically; the next Next() call ( should there be one) will
    // return the first descriptor.
    // In case of any other error, the iterator is automatically closed.
    // It can't be used any more (except for calling Close(), which will be a noop).
    Next(context.Context) (roachpb.RangeDescriptor, error)

    // Close destroys the iterator, releasing resources. It does not need to be
    // called after Next() indicates exhaustion by returning an empty descriptor,
    // or after Next() returns non-retriable errors.

RangeIterator abstracts the interface for reading range descriptors.

type RangeReport Uses

type RangeReport map[ZoneKey]zoneRangeStatus

RangeReport represents the system.zone_range_status report.

func (RangeReport) CountRange Uses

func (r RangeReport) CountRange(
    zKey ZoneKey, unavailable bool, underReplicated bool, overReplicated bool,

CountRange adds one range's info to the report. If there's no entry in the report for the range's zone, a new one is created.

func (RangeReport) EnsureEntry Uses

func (r RangeReport) EnsureEntry(zKey ZoneKey)

EnsureEntry creates an entry for the given key if there is none.

type Reporter Uses

type Reporter struct {
    // contains filtered or unexported fields

Reporter periodically produces a couple of reports on the cluster's data distribution: the system tables: replication_constraint_stats, replication_stats_report and replication_critical_localities.

func NewReporter Uses

func NewReporter(
    db *kv.DB,
    localStores *kvserver.Stores,
    storePool *kvserver.StorePool,
    st *cluster.Settings,
    liveness *kvserver.NodeLiveness,
    executor sqlutil.InternalExecutor,
) *Reporter

NewReporter creates a Reporter.

func (*Reporter) Start Uses

func (stats *Reporter) Start(ctx context.Context, stopper *stop.Stopper)

Start the periodic calls to Update().

type StoreResolver Uses

type StoreResolver func(*roachpb.RangeDescriptor) []roachpb.StoreDescriptor

StoreResolver is a function resolving a range to a store descriptor for each of the replicas. Empty store descriptors are to be returned when there's no information available for the store.

type ZoneKey Uses

type ZoneKey struct {
    // ZoneID is the id of the zone this key is referencing.
    ZoneID config.SystemTenantObjectID
    // SubzoneID identifies what subzone, if any, this key is referencing. The
    // zero value (also named NoSubzone) indicates that the key is referring to a
    // zone, not a subzone.
    SubzoneID base.SubzoneID

ZoneKey is the index of the first level in the constraint conformance report.

func MakeZoneKey Uses

func MakeZoneKey(zoneID config.SystemTenantObjectID, subzoneID base.SubzoneID) ZoneKey

MakeZoneKey creates a zoneKey.

Use NoSubzone for subzoneID to indicate that the key references a zone, not a subzone.

func (ZoneKey) Less Uses

func (k ZoneKey) Less(other ZoneKey) bool

Less compares two ZoneKeys.

func (ZoneKey) String Uses

func (k ZoneKey) String() string

Package reports imports 24 packages (graph) and is imported by 3 packages. Updated 2020-08-12. Refresh now. Tools for package owners.