inst

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2022 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ForcePrimaryFailoverCommandHint    string = "force-primary-failover"
	ForcePrimaryTakeoverCommandHint    string = "force-primary-takeover"
	GracefulPrimaryTakeoverCommandHint string = "graceful-primary-takeover"
)
View Source
const (
	// Group member roles
	GroupReplicationMemberRolePrimary   = "PRIMARY"
	GroupReplicationMemberRoleSecondary = "SECONDARY"
	// Group member states
	GroupReplicationMemberStateOnline      = "ONLINE"
	GroupReplicationMemberStateRecovering  = "RECOVERING"
	GroupReplicationMemberStateUnreachable = "UNREACHABLE"
	GroupReplicationMemberStateOffline     = "OFFLINE"
	GroupReplicationMemberStateError       = "ERROR"
)

Constant strings for Group Replication information See https://dev.mysql.com/doc/refman/8.0/en/replication-group-members-table.html for additional information.

View Source
const ReasonableDiscoveryLatency = 500 * time.Millisecond

Variables

View Source
var (
	DowntimeLostInRecoveryMessage = "lost-in-recovery"
)
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 ErrTabletAliasNil = errors.New("tablet alias is nil")

ErrTabletAliasNil is a fixed error message.

View Source
var (
	TagEqualsRegexp = regexp.MustCompile("^([^=]+)=(.*)$")
)
View Source
var TopoServ *topo.Server

TopoServ is the connection to the topo server.

Functions

func AuditOperation

func AuditOperation(auditType string, instanceKey *InstanceKey, message string) error

AuditOperation creates and writes a new audit entry by given params

func BeginDowntime

func BeginDowntime(downtime *Downtime) (err error)

BeginDowntime will make mark an instance as downtimed (or override existing downtime period)

func ChangeTabletType

func ChangeTabletType(instanceKey InstanceKey, tabletType topodatapb.TabletType, semiSync bool) (*topodatapb.Tablet, error)

ChangeTabletType designates the tablet that owns an instance as the primary.

func DeleteInvalidHostnameResolves

func DeleteInvalidHostnameResolves() error

DeleteInvalidHostnameResolves removes invalid resolves. At this time these are: - infinite loop resolves (A->B and B->A), remove earlier mapping

func EnableAuditSyslog

func EnableAuditSyslog() (err error)

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

func EndDowntime

func EndDowntime(instanceKey *InstanceKey) (wasDowntimed bool, err error)

EndDowntime will remove downtime flag from an instance

func ExecDBWriteFunc

func ExecDBWriteFunc(f func() error) error

ExecDBWriteFunc chooses how to execute a write onto the database: whether synchronuously 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 ExpireCandidateInstances

func ExpireCandidateInstances() error

ExpireCandidateInstances removes stale primary candidate suggestions.

func ExpireClusterDomainName

func ExpireClusterDomainName() error

ExpireClusterDomainName expires cluster_domain_name entries that haven't been updated recently.

func ExpireDowntime

func ExpireDowntime() error

ExpireDowntime will remove the maintenance flag on old downtimes

func ExpireHostnameUnresolve

func ExpireHostnameUnresolve() error

ExpireHostnameUnresolve expires hostname_unresolve entries that haven't been updated recently.

func ExpireInstanceAnalysisChangelog

func ExpireInstanceAnalysisChangelog() error

ExpireInstanceAnalysisChangelog removes old-enough analysis entries from the changelog

func ExpireMaintenance

func ExpireMaintenance() error

ExpireMaintenance will remove the maintenance flag on old maintenances and on bounded maintenances

func ExpireStaleInstanceBinlogCoordinates

func ExpireStaleInstanceBinlogCoordinates() error

func ExpireTableData

func ExpireTableData(tableName string, timestampColumn string) error

func FlushNontrivialResolveCacheToDatabase

func FlushNontrivialResolveCacheToDatabase() error

func ForgetExpiredHostnameResolves

func ForgetExpiredHostnameResolves() error

ForgetExpiredHostnameResolves

func ForgetInstance

func ForgetInstance(instanceKey *InstanceKey) 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 instacnes that have long since been last seen.

func ForgetUnseenInstancesDifferentlyResolved

func ForgetUnseenInstancesDifferentlyResolved() error

ForgetUnseenInstancesDifferentlyResolved will purge instances which are invalid, and whose hostname appears on the hostname_resolved table; this means some time in the past their hostname was unresovled, and now resovled to a different value; the old hostname is never accessed anymore and the old entry should be removed.

func FullStatus

func FullStatus(instanceKey InstanceKey) (*replicationdatapb.FullStatus, error)

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

func GetCNAME

func GetCNAME(hostname string) (string, error)

GetCNAME resolves an IP or hostname into a normalized valid CNAME

func GetClusterName

func GetClusterName(instanceKey *InstanceKey) (clusterName string, err error)

func GetClusterNameFromKeyspaceAndShard

func GetClusterNameFromKeyspaceAndShard(keyspace, shard string) string

GetClusterNameFromKeyspaceAndShard returns the cluster name from keyspace and shard

func GetDurabilityPolicy

func GetDurabilityPolicy[V InstanceKey | *topodatapb.Tablet](instance V) (reparentutil.Durabler, error)

GetDurabilityPolicy gets the durability policy for the keyspace of the given instance

func GetMaintenanceOwner

func GetMaintenanceOwner() string

func HostnameResolveCache

func HostnameResolveCache() (map[string]cache.Item, error)

func HostnameResolveMethodIsNone

func HostnameResolveMethodIsNone() bool

func InjectSeed

func InjectSeed(instanceKey *InstanceKey) error

InjectSeed: intented to be used to inject an instance upon startup, assuming it's not already known to vtorc.

func InjectUnseenPrimaries

func InjectUnseenPrimaries() error

InjectUnseenPrimaries will review primaries of instances that are known to be replicating, yet which are not listed in database_instance. Since their replicas are listed as replicating, we can assume that such primaries actually do exist: we shall therefore inject them with minimal details into the database_instance table.

func InstanceIsForgotten

func InstanceIsForgotten(instanceKey *InstanceKey) bool

func IsReplicaSemiSync

func IsReplicaSemiSync[V InstanceKey | *topodatapb.Tablet](durabilityPolicy reparentutil.Durabler, primaryInstance V, replicaInstance V) bool

IsReplicaSemiSync returns the replica semi-sync setting for the instance.

func IsSmallerBinlogFormat

func IsSmallerBinlogFormat(binlogFormat string, otherBinlogFormat string) bool

IsSmallerBinlogFormat tests two binlog formats and sees if one is "smaller" than the other. "smaller" binlog format means you can replicate from the smaller to the larger.

func IsSmallerMajorVersion

func IsSmallerMajorVersion(version string, otherVersion string) bool

IsSmallerMajorVersion tests two versions against another and returns true if the former is a smaller "major" varsion than the latter. e.g. 5.5.36 is NOT a smaller major version as comapred to 5.5.40, but IS as compared to 5.6.9

func LoadHostnameResolveCache

func LoadHostnameResolveCache() error

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 PromotionRule

func PromotionRule[V InstanceKey | *topodatapb.Tablet](durabilityPolicy reparentutil.Durabler, instance V) promotionrule.CandidatePromotionRule

PromotionRule returns the promotion rule for the instance.

func PutInstanceTag

func PutInstanceTag(instanceKey *InstanceKey, tag *Tag) (err error)

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 ReadInstanceTag

func ReadInstanceTag(instanceKey *InstanceKey, tag *Tag) (tagExists bool, err error)

func ReadKeyspace

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

ReadKeyspace reads the vitess keyspace record.

func ReadReplicationGroupPrimary

func ReadReplicationGroupPrimary(instance *Instance) (err error)

func ReadResolvedHostname

func ReadResolvedHostname(hostname string) (string, error)

ReadResolvedHostname returns the resolved hostname given a hostname, or empty if not exists

func ReadTablet

func ReadTablet(instanceKey InstanceKey) (*topodatapb.Tablet, error)

ReadTablet reads the vitess tablet record.

func RecordStaleInstanceBinlogCoordinates

func RecordStaleInstanceBinlogCoordinates(instanceKey *InstanceKey, 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 RegisterCandidateInstance

func RegisterCandidateInstance(candidate *CandidateDatabaseInstance) error

RegisterCandidateInstance markes a given instance as suggested for succeeding a primary in the event of failover.

func ResetReplicationParameters

func ResetReplicationParameters(instanceKey InstanceKey) error

ResetReplicationParameters resets the replication parameters on the given tablet.

func ResolveHostname

func ResolveHostname(hostname string) (string, error)

Attempt to resolve a hostname. This may return a database cached hostname or otherwise it may resolve the hostname via CNAME

func ResolveHostnameIPs

func ResolveHostnameIPs(hostname string) error

func ResolveUnknownPrimaryHostnameResolves

func ResolveUnknownPrimaryHostnameResolves() error

ResolveUnknownPrimaryHostnameResolves fixes missing hostname resolves based on hostname_resolve_history The use case is replicas replicating from some unknown-hostname which cannot be otherwise found. This could happen due to an expire unresolve together with clearing up of hostname cache.

func SaveKeyspace

func SaveKeyspace(keyspace *topo.KeyspaceInfo) error

SaveKeyspace saves the keyspace record against the keyspace name.

func SaveTablet

func SaveTablet(tablet *topodatapb.Tablet) error

SaveTablet saves the tablet record against the instanceKey.

func SemiSyncAckers

func SemiSyncAckers[V InstanceKey | *topodatapb.Tablet](durabilityPolicy reparentutil.Durabler, instance V) int

SemiSyncAckers returns the primary semi-sync setting for the instance. 0 means none. Non-zero specifies the number of required ackers.

func SetMaintenanceOwner

func SetMaintenanceOwner(owner string)

func SnapshotTopologies

func SnapshotTopologies() error

SnapshotTopologies records topology graph for all existing topologies

func SwitchPrimary

func SwitchPrimary(newPrimaryKey, oldPrimaryKey InstanceKey) error

SwitchPrimary makes the new tablet the primary and proactively performs the necessary propagation to the old primary. The propagation is best effort. If it fails, the tablet's shard sync will eventually converge. The proactive propagation allows a competing VTOrc from discovering the successful action of a previous one, which reduces churn.

func UpdateInstanceLastAttemptedCheck

func UpdateInstanceLastAttemptedCheck(instanceKey *InstanceKey) 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(instanceKey *InstanceKey, partialSuccess bool) error

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

func UpdateResolvedHostname

func UpdateResolvedHostname(hostname string, resolvedHostname string) bool

UpdateResolvedHostname will store the given resolved hostname in cache Returns false when the key already existed with same resolved value (similar to AFFECTED_ROWS() in mysql)

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 WriteClusterDomainName

func WriteClusterDomainName(clusterName string, domainName string) error

WriteClusterDomainName will write (and override) the domain name of a cluster

func WriteInstance

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

WriteInstance stores an instance in the vtorc backend

func WriteResolvedHostname

func WriteResolvedHostname(hostname string, resolvedHostname string) error

WriteResolvedHostname stores a hostname and the resolved hostname to backend database

Types

type AnalysisCode

type AnalysisCode string
const (
	NoProblem                              AnalysisCode = "NoProblem"
	ClusterHasNoPrimary                    AnalysisCode = "ClusterHasNoPrimary"
	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"
)

type AnalysisInstanceType

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

type AnalysisMap

type AnalysisMap map[string](*ReplicationAnalysis)

type Audit

type Audit struct {
	AuditID          int64
	AuditTimestamp   string
	AuditType        string
	AuditInstanceKey InstanceKey
	Message          string
}

Audit presents a single audit entry (namely in the database)

func ReadRecentAudit

func ReadRecentAudit(instanceKey *InstanceKey, page int) ([]Audit, error)

ReadRecentAudit returns a list of audit entries order chronologically descending, using page number.

type BinlogCoordinates

type BinlogCoordinates struct {
	LogFile string
	LogPos  int64
	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 detahced 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 corrdinate 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 corrdinate's file number and the other's. Effectively it means "how many roatets/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 BinlogEvent

type BinlogEvent struct {
	Coordinates  BinlogCoordinates
	NextEventPos int64
	EventType    string
	Info         string
}

func (*BinlogEvent) Equals

func (binlogEvent *BinlogEvent) Equals(other *BinlogEvent) bool

func (*BinlogEvent) EqualsIgnoreCoordinates

func (binlogEvent *BinlogEvent) EqualsIgnoreCoordinates(other *BinlogEvent) bool

func (*BinlogEvent) NextBinlogCoordinates

func (binlogEvent *BinlogEvent) NextBinlogCoordinates() BinlogCoordinates

func (*BinlogEvent) NormalizeInfo

func (binlogEvent *BinlogEvent) NormalizeInfo()

type BinlogEventCursor

type BinlogEventCursor struct {
	// contains filtered or unexported fields
}

type BinlogType

type BinlogType int
const (
	BinaryLog BinlogType = iota
	RelayLog
)

type CandidateDatabaseInstance

type CandidateDatabaseInstance struct {
	Hostname            string
	Port                int
	PromotionRule       promotionrule.CandidatePromotionRule
	LastSuggestedString string
	PromotionRuleExpiry string // generated when retrieved from database for consistency reasons
}

CandidateDatabaseInstance contains information about explicit promotion rules for an instance

func NewCandidateDatabaseInstance

func NewCandidateDatabaseInstance(instanceKey *InstanceKey, promotionRule promotionrule.CandidatePromotionRule) *CandidateDatabaseInstance

func (*CandidateDatabaseInstance) Key

Key returns an instance key representing this candidate

func (*CandidateDatabaseInstance) String

func (cdi *CandidateDatabaseInstance) String() string

String returns a string representation of the CandidateDatabaseInstance struct

func (*CandidateDatabaseInstance) WithCurrentTime

func (cdi *CandidateDatabaseInstance) WithCurrentTime() *CandidateDatabaseInstance

type ClusterInfo

type ClusterInfo struct {
	ClusterName                             string
	ClusterDomain                           string // CNAME/VIP/A-record/whatever of the primary of this cluster
	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 Downtime

type Downtime struct {
	Key            *InstanceKey
	Owner          string
	Reason         string
	Duration       time.Duration
	BeginsAt       time.Time
	EndsAt         time.Time
	BeginsAtString string
	EndsAtString   string
}

func NewDowntime

func NewDowntime(instanceKey *InstanceKey, owner string, reason string, duration time.Duration) *Downtime

func (*Downtime) Ended

func (downtime *Downtime) Ended() bool

func (*Downtime) EndsIn

func (downtime *Downtime) EndsIn() time.Duration

type HostnameRegistration

type HostnameRegistration struct {
	CreatedAt time.Time
	Key       InstanceKey
	Hostname  string
}

func NewHostnameDeregistration

func NewHostnameDeregistration(instanceKey *InstanceKey) *HostnameRegistration

func NewHostnameRegistration

func NewHostnameRegistration(instanceKey *InstanceKey, hostname string) *HostnameRegistration

type HostnameResolve

type HostnameResolve struct {
	// contains filtered or unexported fields
}

func ReadAllHostnameResolves

func ReadAllHostnameResolves() ([]HostnameResolve, error)

func (HostnameResolve) String

func (hostnameResolve HostnameResolve) String() string

type HostnameUnresolve

type HostnameUnresolve struct {
	// contains filtered or unexported fields
}

func (HostnameUnresolve) String

func (hostnameUnresolve HostnameUnresolve) String() string

type Instance

type Instance struct {
	Key                          InstanceKey
	InstanceAlias                string
	ServerID                     uint
	ServerUUID                   string
	Version                      string
	VersionComment               string
	FlavorName                   string
	ReadOnly                     bool
	BinlogFormat                 string
	BinlogRowImage               string
	LogBinEnabled                bool
	LogReplicationUpdatesEnabled bool
	SelfBinlogCoordinates        BinlogCoordinates
	SourceKey                    InstanceKey
	SourceUUID                   string
	AncestryUUID                 string
	IsDetachedPrimary            bool

	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              uint
	ExecutedGtidSet       string
	GtidPurged            string
	GtidErrant            string

	ReplicationLagSeconds              sql.NullInt64
	ClusterName                        string
	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

	// Careful. IsCandidate and PromotionRule are used together
	// and probably need to be merged. IsCandidate's value may
	// be picked up from daabase_candidate_instance's value when
	// reading an instance from the db.
	IsCandidate          bool
	PromotionRule        promotionrule.CandidatePromotionRule
	IsDowntimed          bool
	DowntimeReason       string
	DowntimeOwner        string
	DowntimeEndTimestamp string
	ElapsedDowntime      time.Duration
	UnresolvedHostname   string
	AllowTLS             bool

	Problems []string

	LastDiscoveryLatency time.Duration

	// Group replication global variables
	ReplicationGroupName            string
	ReplicationGroupIsSinglePrimary bool

	// Replication group members information. See
	// https://dev.mysql.com/doc/refman/8.0/en/replication-group-members-table.html for details.
	ReplicationGroupMemberState string
	ReplicationGroupMemberRole  string

	// List of all known members of the same group
	ReplicationGroupMembers InstanceKeyMap

	// Primary of the replication group
	ReplicationGroupPrimaryInstanceKey InstanceKey
	// 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(instanceKey *InstanceKey) (*Instance, bool, error)

ReadInstance reads an instance from the vtorc backend database

func ReadLostInRecoveryInstances

func ReadLostInRecoveryInstances(clusterName string) ([](*Instance), error)

ReadLostInRecoveryInstances returns all instances (potentially filtered by cluster) which are currently indicated as downtimed due to being lost during a topology recovery.

func ReadProblemInstances

func ReadProblemInstances(clusterName string) ([](*Instance), error)

ReadProblemInstances reads all instances with problems

func ReadReplicaInstances

func ReadReplicaInstances(primaryKey *InstanceKey) ([](*Instance), error)

ReadReplicaInstances reads replicas of a given primary

func ReadReplicaInstancesIncludingBinlogServerSubReplicas

func ReadReplicaInstancesIncludingBinlogServerSubReplicas(primaryKey *InstanceKey) ([](*Instance), error)

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

func ReadTopologyInstance

func ReadTopologyInstance(instanceKey *InstanceKey) (*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(instanceKey *InstanceKey, 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) AddGroupMemberKey

func (instance *Instance) AddGroupMemberKey(groupMemberKey *InstanceKey)

AddGroupMemberKey adds a group member to the list of this instance's group members.

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) IsMySQL51

func (instance *Instance) IsMySQL51() bool

func (*Instance) IsMySQL55

func (instance *Instance) IsMySQL55() bool

func (*Instance) IsMySQL56

func (instance *Instance) IsMySQL56() bool

func (*Instance) IsMySQL57

func (instance *Instance) IsMySQL57() bool

func (*Instance) IsMySQL80

func (instance *Instance) IsMySQL80() bool

func (*Instance) IsNDB

func (instance *Instance) IsNDB() bool

isNDB check whether this is NDB Cluster (aka MySQL Cluster)

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) IsReplicationGroupMember

func (instance *Instance) IsReplicationGroupMember() bool

IsReplicationGroup checks whether the host thinks it is part of a known replication group. Notice that this might return True even if the group has decided to expel the member represented by this instance, as the instance might not know that under certain circumstances

func (*Instance) IsReplicationGroupPrimary

func (instance *Instance) IsReplicationGroupPrimary() bool

func (*Instance) IsReplicationGroupSecondary

func (instance *Instance) IsReplicationGroupSecondary() bool

func (*Instance) IsSeed

func (instance *Instance) IsSeed() bool

func (*Instance) IsSmallerBinlogFormat

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

IsSmallerBinlogFormat returns true when this instance's binlgo format is "smaller" than the other's, i.e. binary logs cannot flow from the other instance to this one

func (*Instance) IsSmallerMajorVersion

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

IsSmallerMajorVersion tests this instance against another and returns true if this instance is of a smaller "major" varsion. e.g. 5.5.36 is NOT a smaller major version as comapred to 5.5.36, but IS as compared to 5.6.9

func (*Instance) IsSmallerMajorVersionByString

func (instance *Instance) IsSmallerMajorVersionByString(otherVersion string) bool

IsSmallerMajorVersionByString checks if this instance has a smaller major version number than given one

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

MajorVersion 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) SetSeed

func (instance *Instance) SetSeed()

func (*Instance) UsingGTID

func (instance *Instance) UsingGTID() bool

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

type InstanceAnalysis

type InstanceAnalysis struct {
	// contains filtered or unexported fields
}

func NewInstanceAnalysis

func NewInstanceAnalysis(instanceKey *InstanceKey, analysis AnalysisCode) *InstanceAnalysis

func (*InstanceAnalysis) String

func (instanceAnalysis *InstanceAnalysis) String() string

type InstanceKey

type InstanceKey struct {
	Hostname string
	Port     int
}

InstanceKey is an instance indicator, identifued by hostname and port

func NewRawInstanceKeyStrings

func NewRawInstanceKeyStrings(hostname string, port string) (*InstanceKey, error)

NewResolveInstanceKeyStrings creates and resolves a new instance key based on string params

func NewResolveInstanceKey

func NewResolveInstanceKey(hostname string, port int) (instanceKey *InstanceKey, err error)

func NewResolveInstanceKeyStrings

func NewResolveInstanceKeyStrings(hostname string, port string) (*InstanceKey, error)

NewResolveInstanceKeyStrings creates and resolves a new instance key based on string params

func ParseRawInstanceKey

func ParseRawInstanceKey(hostPort string) (instanceKey *InstanceKey, err error)

func ParseResolveInstanceKey

func ParseResolveInstanceKey(hostPort string) (instanceKey *InstanceKey, err error)

func ReadOutdatedInstanceKeys

func ReadOutdatedInstanceKeys() ([]InstanceKey, 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 (*InstanceKey) DetachedKey

func (instanceKey *InstanceKey) DetachedKey() *InstanceKey

DetachedKey returns an instance key whose hostname is detahced: invalid, but recoverable

func (*InstanceKey) DisplayString

func (instanceKey *InstanceKey) DisplayString() string

DisplayString returns a user-friendly string representation of this key

func (*InstanceKey) Equals

func (instanceKey *InstanceKey) Equals(other *InstanceKey) bool

Equals tests equality between this key and another key

func (*InstanceKey) IsDetached

func (instanceKey *InstanceKey) IsDetached() bool

IsDetached returns 'true' when this hostname is logically "detached"

func (*InstanceKey) IsIPv4

func (instanceKey *InstanceKey) IsIPv4() bool

IsValid uses simple heuristics to see whether this key represents an actual instance

func (*InstanceKey) IsValid

func (instanceKey *InstanceKey) IsValid() bool

IsValid uses simple heuristics to see whether this key represents an actual instance

func (*InstanceKey) ReattachedKey

func (instanceKey *InstanceKey) ReattachedKey() *InstanceKey

ReattachedKey returns an instance key whose hostname is detahced: invalid, but recoverable

func (*InstanceKey) ResolveHostname

func (instanceKey *InstanceKey) ResolveHostname() (*InstanceKey, error)

func (*InstanceKey) SmallerThan

func (instanceKey *InstanceKey) SmallerThan(other *InstanceKey) bool

SmallerThan returns true if this key is dictionary-smaller than another. This is used for consistent sorting/ordering; there's nothing magical about it.

func (InstanceKey) String

func (instanceKey InstanceKey) String() string

String returns a user-friendly string representation of this key

func (*InstanceKey) StringCode

func (instanceKey *InstanceKey) StringCode() string

StringCode returns an official string representation of this key

type InstanceKeyMap

type InstanceKeyMap map[InstanceKey]bool

InstanceKeyMap is a convenience struct for listing InstanceKey-s

func GetInstanceKeysByTag

func GetInstanceKeysByTag(tag *Tag) (tagged *InstanceKeyMap, err error)

func GetInstanceKeysByTags

func GetInstanceKeysByTags(tagsString string) (tagged *InstanceKeyMap, err error)

func NewInstanceKeyMap

func NewInstanceKeyMap() *InstanceKeyMap

func Untag

func Untag(instanceKey *InstanceKey, tag *Tag) (tagged *InstanceKeyMap, err error)

func (*InstanceKeyMap) AddInstances

func (instanceKeyMap *InstanceKeyMap) AddInstances(instances [](*Instance))

AddInstances adds keys of all given instances to this map

func (*InstanceKeyMap) AddKey

func (instanceKeyMap *InstanceKeyMap) AddKey(key InstanceKey)

AddKey adds a single key to this map

func (*InstanceKeyMap) AddKeys

func (instanceKeyMap *InstanceKeyMap) AddKeys(keys []InstanceKey)

AddKeys adds all given keys to this map

func (*InstanceKeyMap) GetInstanceKeys

func (instanceKeyMap *InstanceKeyMap) GetInstanceKeys() []InstanceKey

GetInstanceKeys returns keys in this map in the form of an array

func (*InstanceKeyMap) HasKey

func (instanceKeyMap *InstanceKeyMap) HasKey(key InstanceKey) bool

HasKey checks if given key is within the map

func (*InstanceKeyMap) Intersect

func (instanceKeyMap *InstanceKeyMap) Intersect(other *InstanceKeyMap) *InstanceKeyMap

Intersect returns a keymap which is the intersection of this and another map

func (InstanceKeyMap) MarshalJSON

func (instanceKeyMap InstanceKeyMap) MarshalJSON() ([]byte, error)

MarshalJSON will marshal this map as JSON

func (*InstanceKeyMap) ReadCommaDelimitedList

func (instanceKeyMap *InstanceKeyMap) ReadCommaDelimitedList(list string) error

ReadJSON unmarshalls a json into this map

func (*InstanceKeyMap) ReadJSON

func (instanceKeyMap *InstanceKeyMap) ReadJSON(jsonString string) error

ReadJSON unmarshalls a json into this map

func (*InstanceKeyMap) ToCommaDelimitedList

func (instanceKeyMap *InstanceKeyMap) ToCommaDelimitedList() string

ToCommaDelimitedList will export this map in comma delimited format

func (*InstanceKeyMap) ToJSON

func (instanceKeyMap *InstanceKeyMap) ToJSON() (string, error)

ToJSON will marshal this map as JSON

func (*InstanceKeyMap) ToJSONString

func (instanceKeyMap *InstanceKeyMap) ToJSONString() string

ToJSONString will marshal this map as JSON

func (*InstanceKeyMap) UnmarshalJSON

func (instanceKeyMap *InstanceKeyMap) UnmarshalJSON(b []byte) error

UnmarshalJSON reds this object from JSON

type InstanceTag

type InstanceTag struct {
	Key InstanceKey
	T   Tag
}

type Maintenance

type Maintenance struct {
	MaintenanceID  uint
	Key            InstanceKey
	BeginTimestamp string
	SecondsElapsed uint
	IsActive       bool
	Owner          string
	Reason         string
}

Maintenance indicates a maintenance entry (also in the database)

type MinimalInstance

type MinimalInstance struct {
	Key         InstanceKey
	PrimaryKey  InstanceKey
	ClusterName string
}

func (*MinimalInstance) ToInstance

func (minimalInstance *MinimalInstance) ToInstance() *Instance

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)

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))

String 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 PostponedFunctionsContainer

type PostponedFunctionsContainer struct {
	// contains filtered or unexported fields
}

func NewPostponedFunctionsContainer

func NewPostponedFunctionsContainer() *PostponedFunctionsContainer

func (*PostponedFunctionsContainer) AddPostponedFunction

func (postponedFuncsContainer *PostponedFunctionsContainer) AddPostponedFunction(postponedFunction func() error, description string)

func (*PostponedFunctionsContainer) Descriptions

func (postponedFuncsContainer *PostponedFunctionsContainer) Descriptions() []string

func (*PostponedFunctionsContainer) Len

func (postponedFuncsContainer *PostponedFunctionsContainer) Len() int

func (*PostponedFunctionsContainer) Wait

func (postponedFuncsContainer *PostponedFunctionsContainer) Wait()

type Process

type Process struct {
	InstanceHostname string
	InstancePort     int
	ID               int64
	User             string
	Host             string
	Db               string
	Command          string
	Time             int64
	State            string
	Info             string
	StartedAt        string
}

Process presents a MySQL executing thread (as observed by PROCESSLIST)

type ReplicationAnalysis

type ReplicationAnalysis struct {
	AnalyzedInstanceKey                       InstanceKey
	AnalyzedInstancePrimaryKey                InstanceKey
	TabletType                                topodatapb.TabletType
	PrimaryTimeStamp                          time.Time
	ClusterDetails                            ClusterInfo
	AnalyzedInstanceDataCenter                string
	AnalyzedInstanceRegion                    string
	AnalyzedKeyspace                          string
	AnalyzedShard                             string
	AnalyzedInstancePhysicalEnvironment       string
	AnalyzedInstanceBinlogCoordinates         BinlogCoordinates
	IsPrimary                                 bool
	IsClusterPrimary                          bool
	IsCoPrimary                               bool
	LastCheckValid                            bool
	LastCheckPartialSuccess                   bool
	CountReplicas                             uint
	CountValidReplicas                        uint
	CountValidReplicatingReplicas             uint
	CountReplicasFailingToConnectToPrimary    uint
	CountDowntimedReplicas                    uint
	ReplicationDepth                          uint
	IsFailingToConnectToPrimary               bool
	ReplicationStopped                        bool
	Analysis                                  AnalysisCode
	Description                               string
	StructureAnalysis                         []StructureAnalysisCode
	IsDowntimed                               bool
	IsReplicasDowntimed                       bool // as good as downtimed because all replicas are downtimed AND analysis is all about the replicas (e.e. AllPrimaryReplicasNotReplicating)
	DowntimeEndTimestamp                      string
	DowntimeRemainingSeconds                  int
	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
	CountAdditionalAgreeingNodes              int
	StartActivePeriod                         string
	SkippableDueToDowntime                    bool
	GTIDMode                                  string
	MinReplicaGTIDMode                        string
	MaxReplicaGTIDMode                        string
	MaxReplicaGTIDErrant                      string
	CommandHint                               string
	IsReadOnly                                bool
}

ReplicationAnalysis notes analysis on replication chain status, per instance

func GetReplicationAnalysis

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

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

func (*ReplicationAnalysis) AnalysisString

func (replicationAnalysis *ReplicationAnalysis) AnalysisString() string

AnalysisString returns a human friendly description of all analysis issues

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 ReplicationAnalysisChangelog

type ReplicationAnalysisChangelog struct {
	AnalyzedInstanceKey InstanceKey
	Changelog           []string
}

type ReplicationAnalysisHints

type ReplicationAnalysisHints struct {
	IncludeDowntimed bool
	IncludeNoProblem bool
	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 mysql.ReplicationState) ReplicationThreadState

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

func ReplicationThreadStateFromStatus

func ReplicationThreadStateFromStatus(status string) ReplicationThreadState

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"
)

type Tag

type Tag struct {
	TagName  string
	TagValue string
	HasValue bool
	Negate   bool
}

func NewTag

func NewTag(tagName string, tagValue string) (*Tag, error)

func ParseIntersectTags

func ParseIntersectTags(tagsString string) (tags [](*Tag), err error)

func ParseTag

func ParseTag(tagString string) (*Tag, error)

func ReadInstanceTags

func ReadInstanceTags(instanceKey *InstanceKey) (tags [](*Tag), err error)

func (*Tag) Display

func (tag *Tag) Display() string

func (*Tag) String

func (tag *Tag) String() string

Jump to

Keyboard shortcuts

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