vitess

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseCells

func ParseCells(settings config.VitessConfigurationSettings) (cells []string)

ParseCells returns a slice of non-empty Vitess cell names

Types

type Tablet

type Tablet struct {
	Alias         *topodata.TabletAlias `json:"alias,omitempty"`
	MysqlHostname string                `json:"mysql_hostname,omitempty"`
	MysqlPort     int32                 `json:"mysql_port,omitempty"`
	Stats         *TabletStats          `json:"stats,omitempty"`
	Type          topodata.TabletType   `json:"type,omitempty"`
}

Tablet represents information about a running instance of vttablet.

func ParseTablets

func ParseTablets(settings config.VitessConfigurationSettings) (tablets []Tablet, err error)

ParseTablets reads from vitess /api/keyspace/<keyspace>/tablets/[shard] and returns a listing (mysql_hostname, mysql_port, type) of REPLICA tablets

func (Tablet) HasValidCell

func (t Tablet) HasValidCell(validCells []string) bool

HasValidCell returns a bool reflecting if a tablet is in a valid Vitess cell

func (Tablet) IsServeable added in v1.2.0

func (t Tablet) IsServeable() bool

IsServeable returns a bool reflecting if a tablet is eligible to serve traffic based on tablet stats. For backwards-compatibilty tablets are assumed to be healthy if realtime stats is disabled. This method aims to mimic the logic used by vtgate to select tablets for read queries without considering 'serving', minimum tablet count (not important to freno) and replication lag (freno polls its own replication lag)

func (Tablet) IsValidReplica

func (t Tablet) IsValidReplica() bool

IsValidReplica returns a bool reflecting if a tablet type is REPLICA

type TabletRealtimeStats added in v1.2.0

type TabletRealtimeStats struct {
	HealthError string `json:"health_error,omitempty"`
}

TabletRealtimeStats represents realtime stats from a running instance of vttablet.

type TabletStats added in v1.2.0

type TabletStats struct {
	LastError string               `json:"last_error,omitempty"`
	Realtime  *TabletRealtimeStats `json:"realtime,omitempty"`
	Serving   bool                 `json:"serving,omitempty"`
	Up        bool                 `json:"up,omitempty"`
}

TabletStats represents stats from a running instance of vttablet.

Jump to

Keyboard shortcuts

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