inst

package
v0.19.3 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrKeyspaceNotFound = errors.New("keyspace not found")

ErrKeyspaceNotFound is a fixed error message used when a keyspace is not found in the database.

View Source
var ErrShardNotFound = errors.New("shard not found")

ErrShardNotFound is a fixed error message used when a shard is not found in the database.

View Source
var ErrTabletAliasNil = errors.New("tablet alias is nil")

ErrTabletAliasNil is a fixed error message.

Functions

func AuditOperation

func AuditOperation(auditType string, tabletAlias string, message string) error

AuditOperation creates and writes a new audit entry by given params

func EnableAuditSyslog

func EnableAuditSyslog() (err error)

EnableAuditSyslog enables, if possible, writes to syslog. These will execute _in addition_ to normal logging

func ExecDBWriteFunc

func ExecDBWriteFunc(f func() error) error

ExecDBWriteFunc chooses how to execute a write onto the database: whether synchronously or not

func ExecuteOnTopology

func ExecuteOnTopology(f func())

ExecuteOnTopology will execute given function while maintaining concurrency limit on topology servers. It is safe in the sense that we will not leak tokens.

func ExpireAudit

func ExpireAudit() error

ExpireAudit removes old rows from the audit table

func ExpireInstanceAnalysisChangelog

func ExpireInstanceAnalysisChangelog() error

ExpireInstanceAnalysisChangelog removes old-enough analysis entries from the changelog

func ExpireStaleInstanceBinlogCoordinates

func ExpireStaleInstanceBinlogCoordinates() error

func ExpireTableData

func ExpireTableData(tableName string, timestampColumn string) error

func ForgetInstance

func ForgetInstance(tabletAlias string) error

ForgetInstance removes an instance entry from the vtorc backed database. It may be auto-rediscovered through topology or requested for discovery by multiple means.

func ForgetLongUnseenInstances

func ForgetLongUnseenInstances() error

ForgetLongUnseenInstances will remove entries of all instances that have long since been last seen.

func FullStatus

func FullStatus(tabletAlias string) (*replicationdatapb.FullStatus, error)

FullStatus gets the full status of the MySQL running in vttablet.

func GetDurabilityPolicy

func GetDurabilityPolicy(keyspace string) (reparentutil.Durabler, error)

GetDurabilityPolicy gets the durability policy for the given keyspace.

func GetKeyspaceShardName added in v0.16.0

func GetKeyspaceShardName(tabletAlias string) (keyspace string, shard string, err error)

GetKeyspaceShardName gets the keyspace shard name for the given instance key

func InstanceIsForgotten

func InstanceIsForgotten(tabletAlias string) bool

func MajorVersion

func MajorVersion(version string) []string

MajorVersion returns a MySQL major version number (e.g. given "5.5.36" it returns "5.5")

func ReadInstanceClusterAttributes

func ReadInstanceClusterAttributes(instance *Instance) (err error)

ReadInstanceClusterAttributes will return the cluster name for a given instance by looking at its primary and getting it from there. It is a non-recursive function and so-called-recursion is performed upon periodic reading of instances.

func ReadKeyspace

func ReadKeyspace(keyspaceName string) (*topo.KeyspaceInfo, error)

ReadKeyspace reads the vitess keyspace record.

func ReadOutdatedInstanceKeys

func ReadOutdatedInstanceKeys() ([]string, error)

ReadOutdatedInstanceKeys reads and returns keys for all instances that are not up to date (i.e. pre-configured time has passed since they were last checked) or the ones whose tablet information was read but not the mysql information. This could happen if the durability policy of the keyspace wasn't available at the time it was discovered. This would lead to not having the record of the tablet in the database_instance table. We also check for the case where an attempt at instance checking has been made, that hasn't resulted in an actual check! This can happen when TCP/IP connections are hung, in which case the "check" never returns. In such case we multiply interval by a factor, so as not to open too many connections on the instance.

func ReadShardPrimaryInformation added in v0.18.0

func ReadShardPrimaryInformation(keyspaceName, shardName string) (primaryAlias string, primaryTimestamp string, err error)

ReadShardPrimaryInformation reads the vitess shard record and gets the shard primary alias and timestamp.

func ReadTablet

func ReadTablet(tabletAlias string) (*topodatapb.Tablet, error)

ReadTablet reads the vitess tablet record.

func RecordStaleInstanceBinlogCoordinates

func RecordStaleInstanceBinlogCoordinates(tabletAlias string, binlogCoordinates *BinlogCoordinates) error

RecordStaleInstanceBinlogCoordinates snapshots the binlog coordinates of instances

func RegexpMatchPatterns

func RegexpMatchPatterns(s string, regexpPatterns []string) bool

RegexpMatchPatterns returns true if s matches any of the provided regexpPatterns

func RegisterStats added in v0.18.0

func RegisterStats()

RegisterStats registers stats from the inst package

func ResetReplicationParameters

func ResetReplicationParameters(tabletAlias string) error

ResetReplicationParameters resets the replication parameters on the given tablet.

func SaveKeyspace

func SaveKeyspace(keyspace *topo.KeyspaceInfo) error

SaveKeyspace saves the keyspace record against the keyspace name.

func SaveShard added in v0.18.0

func SaveShard(shard *topo.ShardInfo) error

SaveShard saves the shard record against the shard name.

func SaveTablet

func SaveTablet(tablet *topodatapb.Tablet) error

SaveTablet saves the tablet record against the instanceKey.

func SnapshotTopologies

func SnapshotTopologies() error

SnapshotTopologies records topology graph for all existing topologies

func UpdateInstanceLastAttemptedCheck

func UpdateInstanceLastAttemptedCheck(tabletAlias string) error

UpdateInstanceLastAttemptedCheck updates the last_attempted_check timestamp in the vtorc backed database for a given instance. This is used as a failsafe mechanism in case access to the instance gets hung (it happens), in which case the entire ReadTopology gets stuck (and no, connection timeout nor driver timeouts don't help. Don't look at me, the world is a harsh place to live in). And so we make sure to note down *before* we even attempt to access the instance; and this raises a red flag when we wish to access the instance again: if last_attempted_check is *newer* than last_checked, that's bad news and means we have a "hanging" issue.

func UpdateInstanceLastChecked

func UpdateInstanceLastChecked(tabletAlias string, partialSuccess bool) error

UpdateInstanceLastChecked updates the last_check timestamp in the vtorc backed database for a given instance

func ValidSecondsFromSeenToLastAttemptedCheck

func ValidSecondsFromSeenToLastAttemptedCheck() uint

ValidSecondsFromSeenToLastAttemptedCheck returns the maximum allowed elapsed time between last_attempted_check to last_checked before we consider the instance as invalid.

func WriteInstance

func WriteInstance(instance *Instance, instanceWasActuallyFound bool, lastError error) error

WriteInstance stores an instance in the vtorc backend

Types

type AnalysisCode

type AnalysisCode string
const (
	NoProblem                              AnalysisCode = "NoProblem"
	ClusterHasNoPrimary                    AnalysisCode = "ClusterHasNoPrimary"
	PrimaryTabletDeleted                   AnalysisCode = "PrimaryTabletDeleted"
	InvalidPrimary                         AnalysisCode = "InvalidPrimary"
	InvalidReplica                         AnalysisCode = "InvalidReplica"
	DeadPrimaryWithoutReplicas             AnalysisCode = "DeadPrimaryWithoutReplicas"
	DeadPrimary                            AnalysisCode = "DeadPrimary"
	DeadPrimaryAndReplicas                 AnalysisCode = "DeadPrimaryAndReplicas"
	DeadPrimaryAndSomeReplicas             AnalysisCode = "DeadPrimaryAndSomeReplicas"
	PrimaryHasPrimary                      AnalysisCode = "PrimaryHasPrimary"
	PrimaryIsReadOnly                      AnalysisCode = "PrimaryIsReadOnly"
	PrimarySemiSyncMustBeSet               AnalysisCode = "PrimarySemiSyncMustBeSet"
	PrimarySemiSyncMustNotBeSet            AnalysisCode = "PrimarySemiSyncMustNotBeSet"
	ReplicaIsWritable                      AnalysisCode = "ReplicaIsWritable"
	NotConnectedToPrimary                  AnalysisCode = "NotConnectedToPrimary"
	ConnectedToWrongPrimary                AnalysisCode = "ConnectedToWrongPrimary"
	ReplicationStopped                     AnalysisCode = "ReplicationStopped"
	ReplicaSemiSyncMustBeSet               AnalysisCode = "ReplicaSemiSyncMustBeSet"
	ReplicaSemiSyncMustNotBeSet            AnalysisCode = "ReplicaSemiSyncMustNotBeSet"
	UnreachablePrimaryWithLaggingReplicas  AnalysisCode = "UnreachablePrimaryWithLaggingReplicas"
	UnreachablePrimary                     AnalysisCode = "UnreachablePrimary"
	PrimarySingleReplicaNotReplicating     AnalysisCode = "PrimarySingleReplicaNotReplicating"
	PrimarySingleReplicaDead               AnalysisCode = "PrimarySingleReplicaDead"
	AllPrimaryReplicasNotReplicating       AnalysisCode = "AllPrimaryReplicasNotReplicating"
	AllPrimaryReplicasNotReplicatingOrDead AnalysisCode = "AllPrimaryReplicasNotReplicatingOrDead"
	LockedSemiSyncPrimaryHypothesis        AnalysisCode = "LockedSemiSyncPrimaryHypothesis"
	LockedSemiSyncPrimary                  AnalysisCode = "LockedSemiSyncPrimary"
	PrimaryWithoutReplicas                 AnalysisCode = "PrimaryWithoutReplicas"
	BinlogServerFailingToConnectToPrimary  AnalysisCode = "BinlogServerFailingToConnectToPrimary"
	GraceFulPrimaryTakeover                AnalysisCode = "GracefulPrimaryTakeover"
	ErrantGTIDDetected                     AnalysisCode = "ErrantGTIDDetected"
)

type AnalysisInstanceType

type AnalysisInstanceType string
const (
	AnalysisInstanceTypePrimary             AnalysisInstanceType = "primary"
	AnalysisInstanceTypeCoPrimary           AnalysisInstanceType = "co-primary"
	AnalysisInstanceTypeIntermediatePrimary AnalysisInstanceType = "intermediate-primary"
)

type BinlogCoordinates

type BinlogCoordinates struct {
	LogFile string
	LogPos  uint32
	Type    BinlogType
}

BinlogCoordinates described binary log coordinates in the form of log file & log position.

func ParseBinlogCoordinates

func ParseBinlogCoordinates(logFileLogPos string) (*BinlogCoordinates, error)

ParseInstanceKey will parse an InstanceKey from a string representation such as 127.0.0.1:3306

func (*BinlogCoordinates) Detach

func (binlogCoordinates *BinlogCoordinates) Detach() (detachedCoordinates BinlogCoordinates)

Detach returns a detached form of coordinates

func (*BinlogCoordinates) DisplayString

func (binlogCoordinates *BinlogCoordinates) DisplayString() string

DisplayString returns a user-friendly string representation of these coordinates

func (*BinlogCoordinates) Equals

func (binlogCoordinates *BinlogCoordinates) Equals(other *BinlogCoordinates) bool

Equals tests equality of this coordinate and another one.

func (*BinlogCoordinates) ExtractDetachedCoordinates

func (binlogCoordinates *BinlogCoordinates) ExtractDetachedCoordinates() (isDetached bool, detachedCoordinates BinlogCoordinates)

FileSmallerThan returns true if this coordinate's file is strictly smaller than the other's.

func (*BinlogCoordinates) FileNumber

func (binlogCoordinates *BinlogCoordinates) FileNumber() (int, int)

FileNumber returns the numeric value of the file, and the length in characters representing the number in the filename. Example: FileNumber() of mysqld.log.000789 is (789, 6)

func (*BinlogCoordinates) FileNumberDistance

func (binlogCoordinates *BinlogCoordinates) FileNumberDistance(other *BinlogCoordinates) int

FileNumberDistance returns the numeric distance between this coordinate's file number and the other's. Effectively it means "how many rotates/FLUSHes would make these coordinates's file reach the other's"

func (*BinlogCoordinates) FileSmallerThan

func (binlogCoordinates *BinlogCoordinates) FileSmallerThan(other *BinlogCoordinates) bool

FileSmallerThan returns true if this coordinate's file is strictly smaller than the other's.

func (*BinlogCoordinates) IsEmpty

func (binlogCoordinates *BinlogCoordinates) IsEmpty() bool

IsEmpty returns true if the log file is empty, unnamed

func (*BinlogCoordinates) NextFileCoordinates

func (binlogCoordinates *BinlogCoordinates) NextFileCoordinates() (BinlogCoordinates, error)

PreviousFileCoordinates guesses the filename of the previous binlog/relaylog

func (*BinlogCoordinates) PreviousFileCoordinates

func (binlogCoordinates *BinlogCoordinates) PreviousFileCoordinates() (BinlogCoordinates, error)

PreviousFileCoordinates guesses the filename of the previous binlog/relaylog

func (*BinlogCoordinates) PreviousFileCoordinatesBy

func (binlogCoordinates *BinlogCoordinates) PreviousFileCoordinatesBy(offset int) (BinlogCoordinates, error)

PreviousFileCoordinatesBy guesses the filename of the previous binlog/relaylog, by given offset (number of files back)

func (*BinlogCoordinates) SmallerThan

func (binlogCoordinates *BinlogCoordinates) SmallerThan(other *BinlogCoordinates) bool

SmallerThan returns true if this coordinate is strictly smaller than the other.

func (*BinlogCoordinates) SmallerThanOrEquals

func (binlogCoordinates *BinlogCoordinates) SmallerThanOrEquals(other *BinlogCoordinates) bool

SmallerThanOrEquals returns true if this coordinate is the same or equal to the other one. We do NOT compare the type so we can not use this.Equals()

func (BinlogCoordinates) String

func (binlogCoordinates BinlogCoordinates) String() string

String returns a user-friendly string representation of these coordinates

type BinlogType

type BinlogType int32
const (
	BinaryLog BinlogType = iota
	RelayLog
)

type ClusterInfo

type ClusterInfo struct {
	Keyspace                                string
	Shard                                   string
	CountInstances                          uint
	HeuristicLag                            int64
	HasAutomatedPrimaryRecovery             bool
	HasAutomatedIntermediatePrimaryRecovery bool
}

ClusterInfo makes for a cluster status/info summary

func (*ClusterInfo) ReadRecoveryInfo

func (clusterInfo *ClusterInfo) ReadRecoveryInfo()

ReadRecoveryInfo

type Instance

type Instance struct {
	Hostname                     string
	Port                         int
	InstanceAlias                string
	ServerID                     uint
	ServerUUID                   string
	Version                      string
	VersionComment               string
	FlavorName                   string
	ReadOnly                     bool
	BinlogFormat                 string
	BinlogRowImage               string
	LogBinEnabled                bool
	LogReplicationUpdatesEnabled bool
	SelfBinlogCoordinates        BinlogCoordinates
	SourceHost                   string
	SourcePort                   int
	SourceUUID                   string
	AncestryUUID                 string

	ReplicationSQLThreadRuning bool
	ReplicationIOThreadRuning  bool
	ReplicationSQLThreadState  ReplicationThreadState
	ReplicationIOThreadState   ReplicationThreadState

	HasReplicationFilters bool
	GTIDMode              string
	SupportsOracleGTID    bool
	UsingOracleGTID       bool
	UsingMariaDBGTID      bool
	UsingPseudoGTID       bool // Legacy. Always 'false'
	ReadBinlogCoordinates BinlogCoordinates
	ExecBinlogCoordinates BinlogCoordinates
	IsDetached            bool
	RelaylogCoordinates   BinlogCoordinates
	LastSQLError          string
	LastIOError           string
	SecondsBehindPrimary  sql.NullInt64
	SQLDelay              uint32
	ExecutedGtidSet       string
	GtidPurged            string
	GtidErrant            string

	ReplicationLagSeconds              sql.NullInt64
	DataCenter                         string
	Region                             string
	PhysicalEnvironment                string
	ReplicationDepth                   uint
	IsCoPrimary                        bool
	HasReplicationCredentials          bool
	SemiSyncEnforced                   bool
	SemiSyncPrimaryEnabled             bool
	SemiSyncReplicaEnabled             bool
	SemiSyncPrimaryTimeout             uint64
	SemiSyncPrimaryWaitForReplicaCount uint
	SemiSyncPrimaryStatus              bool
	SemiSyncPrimaryClients             uint
	SemiSyncReplicaStatus              bool

	LastSeenTimestamp    string
	IsLastCheckValid     bool
	IsUpToDate           bool
	IsRecentlyChecked    bool
	SecondsSinceLastSeen sql.NullInt64

	AllowTLS bool

	Problems []string

	LastDiscoveryLatency time.Duration
	// contains filtered or unexported fields
}

Instance represents a database instance, including its current configuration & status. It presents important replication configuration and detailed replication status.

func NewInstance

func NewInstance() *Instance

func ReadInstance

func ReadInstance(tabletAlias string) (*Instance, bool, error)

ReadInstance reads an instance from the vtorc backend database

func ReadInstancesWithErrantGTIds added in v0.18.0

func ReadInstancesWithErrantGTIds(keyspace string, shard string) ([]*Instance, error)

ReadInstancesWithErrantGTIds reads all instances with errant GTIDs

func ReadProblemInstances

func ReadProblemInstances(keyspace string, shard string) ([](*Instance), error)

ReadProblemInstances reads all instances with problems

func ReadReplicaInstances

func ReadReplicaInstances(primaryHost string, primaryPort int) ([](*Instance), error)

ReadReplicaInstances reads replicas of a given primary

func ReadReplicaInstancesIncludingBinlogServerSubReplicas

func ReadReplicaInstancesIncludingBinlogServerSubReplicas(primaryHost string, primaryPort int) ([](*Instance), error)

ReadReplicaInstancesIncludingBinlogServerSubReplicas returns a list of direct slves including any replicas of a binlog server replica

func ReadTopologyInstance

func ReadTopologyInstance(tabletAlias string) (*Instance, error)

ReadTopologyInstance collects information on the state of a MySQL server and writes the result synchronously to the vtorc backend.

func ReadTopologyInstanceBufferable

func ReadTopologyInstanceBufferable(tabletAlias string, latency *stopwatch.NamedStopwatch) (inst *Instance, err error)

ReadTopologyInstanceBufferable connects to a topology MySQL instance and collects information on the server and its replication state. It writes the information retrieved into vtorc's backend. - writes are optionally buffered. - timing information can be collected for the stages performed.

func (*Instance) Equals

func (instance *Instance) Equals(other *Instance) bool

Equals tests that this instance is the same instance as other. The function does not test configuration or status.

func (*Instance) FlavorNameAndMajorVersion

func (instance *Instance) FlavorNameAndMajorVersion() string

FlavorNameAndMajorVersion returns a string of the combined flavor and major version which is useful in some checks.

func (*Instance) IsBinlogServer

func (instance *Instance) IsBinlogServer() bool

IsBinlogServer checks whether this is any type of a binlog server

func (*Instance) IsMariaDB

func (instance *Instance) IsMariaDB() bool

IsMariaDB checks whether this is any version of MariaDB

func (*Instance) IsOracleMySQL

func (instance *Instance) IsOracleMySQL() bool

IsOracleMySQL checks whether this is an Oracle MySQL distribution

func (*Instance) IsPercona

func (instance *Instance) IsPercona() bool

IsPercona checks whether this is any version of Percona Server

func (*Instance) IsPrimary

func (instance *Instance) IsPrimary() bool

IsPrimary makes simple heuristics to decide whether this instance is a primary (not replicating from any other server), either via traditional async/semisync replication or group replication

func (*Instance) IsReplica

func (instance *Instance) IsReplica() bool

IsReplica makes simple heuristics to decide whether this instance is a replica of another instance

func (*Instance) MajorVersion

func (instance *Instance) MajorVersion() []string

MajorVersion returns this instance's major version number (e.g. for 5.5.36 it returns "5.5")

func (*Instance) MajorVersionString

func (instance *Instance) MajorVersionString() string

MajorVersionString returns this instance's major version number (e.g. for 5.5.36 it returns "5.5")

func (*Instance) MarshalJSON

func (instance *Instance) MarshalJSON() ([]byte, error)

func (*Instance) ReplicaRunning

func (instance *Instance) ReplicaRunning() bool

ReplicaRunning returns true when this instance's status is of a replicating replica.

func (*Instance) ReplicationThreadsExist

func (instance *Instance) ReplicationThreadsExist() bool

NoReplicationThreadRunning returns true when neither SQL nor IO threads are running (including the case where isn't even a replica)

func (*Instance) ReplicationThreadsStopped

func (instance *Instance) ReplicationThreadsStopped() bool

NoReplicationThreadRunning returns true when neither SQL nor IO threads are running (including the case where isn't even a replica)

func (*Instance) SQLThreadUpToDate

func (instance *Instance) SQLThreadUpToDate() bool

SQLThreadUpToDate returns true when the instance had consumed all relay logs.

func (*Instance) UsingGTID

func (instance *Instance) UsingGTID() bool

UsingGTID returns true when this replica is currently replicating via GTID (either Oracle or MariaDB)

type OracleGtidSet

type OracleGtidSet struct {
	GtidEntries []*OracleGtidSetEntry
}

OracleGtidSet represents a set of GTID ranges as depicted by Retrieved_Gtid_Set, Executed_Gtid_Set or @@gtid_purged.

func NewOracleGtidSet

func NewOracleGtidSet(gtidSet string) (res *OracleGtidSet, err error)

NewOracleGtidSet creates a new GTID set. Example input: `230ea8ea-81e3-11e4-972a-e25ec4bd140a:1-10539, 316d193c-70e5-11e5-adb2-ecf4bb2262ff:1-8935:8984-6124596, 321f5c0d-70e5-11e5-adb2-ecf4bb2262ff:1-56`

func (*OracleGtidSet) Explode

func (oracleGTIDSet *OracleGtidSet) Explode() (result []*OracleGtidSetEntry)

Explode returns a user-friendly string representation of this entry

func (*OracleGtidSet) IsEmpty

func (oracleGTIDSet *OracleGtidSet) IsEmpty() bool

func (*OracleGtidSet) RemoveUUID

func (oracleGTIDSet *OracleGtidSet) RemoveUUID(uuid string) (removed bool)

RemoveUUID removes entries that belong to given UUID. By way of how this works there can only be one entry matching our UUID, but we generalize. We keep order of entries.

func (*OracleGtidSet) RetainUUID

func (oracleGTIDSet *OracleGtidSet) RetainUUID(uuid string) (anythingRemoved bool)

RetainUUID retains only entries that belong to given UUID.

func (*OracleGtidSet) RetainUUIDs

func (oracleGTIDSet *OracleGtidSet) RetainUUIDs(uuids []string) (anythingRemoved bool)

RetainUUIDs retains only entries that belong to given UUIDs.

func (*OracleGtidSet) SharedUUIDs

func (oracleGTIDSet *OracleGtidSet) SharedUUIDs(other *OracleGtidSet) (shared []string)

SharedUUIDs returns UUIDs (range-less) that are shared between the two sets

func (*OracleGtidSet) String

func (oracleGTIDSet *OracleGtidSet) String() string

type OracleGtidSetEntry

type OracleGtidSetEntry struct {
	UUID   string
	Ranges string
}

OracleGtidSetEntry represents an entry in a set of GTID ranges, for example, the entry: "316d193c-70e5-11e5-adb2-ecf4bb2262ff:1-8935:8984-6124596" (may include gaps)

func NewOracleGtidSetEntry

func NewOracleGtidSetEntry(gtidRangeString string) (*OracleGtidSetEntry, error)

NewOracleGtidSetEntry parses a single entry text

func (*OracleGtidSetEntry) Explode

func (oracleGTIDSetEntry *OracleGtidSetEntry) Explode() (result [](*OracleGtidSetEntry))

String returns a user-friendly string representation of this entry

func (*OracleGtidSetEntry) String

func (oracleGTIDSetEntry *OracleGtidSetEntry) String() string

String returns a user-friendly string representation of this entry

type PeerAnalysisMap

type PeerAnalysisMap map[string]int

PeerAnalysisMap indicates the number of peers agreeing on an analysis. Key of this map is a InstanceAnalysis.String()

type ReplicationAnalysis

type ReplicationAnalysis struct {
	AnalyzedInstanceHostname     string
	AnalyzedInstancePort         int
	AnalyzedInstanceAlias        string
	AnalyzedInstancePrimaryAlias string
	TabletType                   topodatapb.TabletType
	PrimaryTimeStamp             time.Time
	ClusterDetails               ClusterInfo
	AnalyzedInstanceDataCenter   string
	AnalyzedInstanceRegion       string
	AnalyzedKeyspace             string
	AnalyzedShard                string
	// ShardPrimaryTermTimestamp is the primary term start time stored in the shard record.
	ShardPrimaryTermTimestamp                 string
	AnalyzedInstancePhysicalEnvironment       string
	AnalyzedInstanceBinlogCoordinates         BinlogCoordinates
	IsPrimary                                 bool
	IsClusterPrimary                          bool
	IsCoPrimary                               bool
	LastCheckValid                            bool
	LastCheckPartialSuccess                   bool
	CountReplicas                             uint
	CountValidReplicas                        uint
	CountValidReplicatingReplicas             uint
	CountReplicasFailingToConnectToPrimary    uint
	ReplicationDepth                          uint
	IsFailingToConnectToPrimary               bool
	ReplicationStopped                        bool
	ErrantGTID                                string
	Analysis                                  AnalysisCode
	Description                               string
	StructureAnalysis                         []StructureAnalysisCode
	IsBinlogServer                            bool
	OracleGTIDImmediateTopology               bool
	MariaDBGTIDImmediateTopology              bool
	BinlogServerImmediateTopology             bool
	SemiSyncPrimaryEnabled                    bool
	SemiSyncPrimaryStatus                     bool
	SemiSyncPrimaryWaitForReplicaCount        uint
	SemiSyncPrimaryClients                    uint
	SemiSyncReplicaEnabled                    bool
	CountSemiSyncReplicasEnabled              uint
	CountLoggingReplicas                      uint
	CountStatementBasedLoggingReplicas        uint
	CountMixedBasedLoggingReplicas            uint
	CountRowBasedLoggingReplicas              uint
	CountDistinctMajorVersionsLoggingReplicas uint
	CountDelayedReplicas                      uint
	CountLaggingReplicas                      uint
	IsActionableRecovery                      bool
	ProcessingNodeHostname                    string
	ProcessingNodeToken                       string
	StartActivePeriod                         string
	GTIDMode                                  string
	MinReplicaGTIDMode                        string
	MaxReplicaGTIDMode                        string
	MaxReplicaGTIDErrant                      string
	IsReadOnly                                bool
}

ReplicationAnalysis notes analysis on replication chain status, per instance

func GetReplicationAnalysis

func GetReplicationAnalysis(keyspace string, shard string, hints *ReplicationAnalysisHints) ([]*ReplicationAnalysis, error)

GetReplicationAnalysis will check for replication problems (dead primary; unreachable primary; etc)

func (*ReplicationAnalysis) GetAnalysisInstanceType

func (replicationAnalysis *ReplicationAnalysis) GetAnalysisInstanceType() AnalysisInstanceType

Get a string description of the analyzed instance type (primary? co-primary? intermediate-primary?)

func (*ReplicationAnalysis) MarshalJSON

func (replicationAnalysis *ReplicationAnalysis) MarshalJSON() ([]byte, error)

type ReplicationAnalysisHints

type ReplicationAnalysisHints struct {
	AuditAnalysis bool
}

type ReplicationThreadState

type ReplicationThreadState int
const (
	ReplicationThreadStateNoThread ReplicationThreadState = -1
	ReplicationThreadStateStopped  ReplicationThreadState = 0
	ReplicationThreadStateRunning  ReplicationThreadState = 1
	ReplicationThreadStateOther    ReplicationThreadState = 2
)

func ReplicationThreadStateFromReplicationState

func ReplicationThreadStateFromReplicationState(state replication.ReplicationState) ReplicationThreadState

ReplicationThreadStateFromReplicationState gets the replication thread state from replication state TODO: Merge these two into one

func (*ReplicationThreadState) Exists

func (replicationThreadState *ReplicationThreadState) Exists() bool

func (*ReplicationThreadState) IsRunning

func (replicationThreadState *ReplicationThreadState) IsRunning() bool

func (*ReplicationThreadState) IsStopped

func (replicationThreadState *ReplicationThreadState) IsStopped() bool

type StructureAnalysisCode

type StructureAnalysisCode string
const (
	StatementAndMixedLoggingReplicasStructureWarning     StructureAnalysisCode = "StatementAndMixedLoggingReplicasStructureWarning"
	StatementAndRowLoggingReplicasStructureWarning       StructureAnalysisCode = "StatementAndRowLoggingReplicasStructureWarning"
	MixedAndRowLoggingReplicasStructureWarning           StructureAnalysisCode = "MixedAndRowLoggingReplicasStructureWarning"
	MultipleMajorVersionsLoggingReplicasStructureWarning StructureAnalysisCode = "MultipleMajorVersionsLoggingReplicasStructureWarning"
	NoLoggingReplicasStructureWarning                    StructureAnalysisCode = "NoLoggingReplicasStructureWarning"
	DifferentGTIDModesStructureWarning                   StructureAnalysisCode = "DifferentGTIDModesStructureWarning"
	ErrantGTIDStructureWarning                           StructureAnalysisCode = "ErrantGTIDStructureWarning"
	NoFailoverSupportStructureWarning                    StructureAnalysisCode = "NoFailoverSupportStructureWarning"
	NoWriteablePrimaryStructureWarning                   StructureAnalysisCode = "NoWriteablePrimaryStructureWarning"
	NotEnoughValidSemiSyncReplicasStructureWarning       StructureAnalysisCode = "NotEnoughValidSemiSyncReplicasStructureWarning"
)

Jump to

Keyboard shortcuts

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