Documentation
¶
Index ¶
- Constants
- Variables
- func AcknowledgeCrashedRecoveries() (countAcknowledgedEntries int64, err error)
- func AcknowledgeInstanceCompletedRecoveries(tabletAlias string, owner string, comment string) (countAcknowledgedEntries int64, err error)
- func AttemptFailureDetectionRegistration(analysisEntry *inst.ReplicationAnalysis) (registrationSuccessful bool, err error)
- func AuditTopologyRecovery(topologyRecovery *TopologyRecovery, message string) error
- func CheckAndRecover()
- func ClearActiveFailureDetections() error
- func ClearActiveRecoveries() error
- func ContinuousDiscovery()
- func DisableRecovery() error
- func DiscoverInstance(tabletAlias string, forceDiscovery bool)
- func EnableRecovery() error
- func ExpireBlockedRecoveries() error
- func ExpireFailureDetectionHistory() error
- func ExpireTopologyRecoveryHistory() error
- func ExpireTopologyRecoveryStepsHistory() error
- func IsLeader() bool
- func IsLeaderOrActive() bool
- func IsRecoveryDisabled() (disabled bool, err error)
- func LockShard(ctx context.Context, tabletAlias string, lockAction string) (context.Context, func(*error), error)
- func OpenTabletDiscovery() <-chan time.Time
- func RefreshAllKeyspacesAndShards()
- func RefreshKeyspaceAndShard(keyspaceName string, shardName string) error
- func RegisterBlockedRecoveries(analysisEntry *inst.ReplicationAnalysis, ...) error
- func RegisterFlags(fs *pflag.FlagSet)
- type RecoveryType
- type TopologyRecovery
- func AttemptRecoveryRegistration(analysisEntry *inst.ReplicationAnalysis, ...) (*TopologyRecovery, error)
- func NewTopologyRecovery(replicationAnalysis inst.ReplicationAnalysis) *TopologyRecovery
- func ReadInActivePeriodClusterRecovery(keyspace string, shard, analysis string) ([]*TopologyRecovery, error)
- func ReadInActivePeriodSuccessorInstanceRecovery(tabletAlias string) ([]*TopologyRecovery, error)
- func ReadRecentRecoveries(unacknowledgedOnly bool, page int) ([]*TopologyRecovery, error)
- type TopologyRecoveryStep
Constants ¶
const ( CheckAndRecoverGenericProblemRecoveryName string = "CheckAndRecoverGenericProblem" RecoverDeadPrimaryRecoveryName string = "RecoverDeadPrimary" RecoverPrimaryTabletDeletedRecoveryName string = "RecoverPrimaryTabletDeleted" RecoverPrimaryHasPrimaryRecoveryName string = "RecoverPrimaryHasPrimary" CheckAndRecoverLockedSemiSyncPrimaryRecoveryName string = "CheckAndRecoverLockedSemiSyncPrimary" ElectNewPrimaryRecoveryName string = "ElectNewPrimary" FixPrimaryRecoveryName string = "FixPrimary" FixReplicaRecoveryName string = "FixReplica" RecoverErrantGTIDDetectedName string = "RecoverErrantGTIDDetected" )
const (
DiscoveryMetricsName = "DISCOVERY_METRICS"
)
const TopologyRecoveriesTemplate = `` /* 576-byte string literal not displayed */
TopologyRecoveriesTemplate is the HTML to use to display the topology recovery steps list object
Variables ¶
var ( // ErrNoPrimaryTablet is a fixed error message. ErrNoPrimaryTablet = errors.New("no primary tablet found") )
Functions ¶
func AcknowledgeCrashedRecoveries ¶
AcknowledgeCrashedRecoveries marks recoveries whose processing nodes has crashed as acknowledged.
func AcknowledgeInstanceCompletedRecoveries ¶
func AcknowledgeInstanceCompletedRecoveries(tabletAlias string, owner string, comment string) (countAcknowledgedEntries int64, err error)
AcknowledgeInstanceCompletedRecoveries marks active and COMPLETED recoveries for given instane as acknowledged. This also implied clearing their active period, which in turn enables further recoveries on those topologies
func AttemptFailureDetectionRegistration ¶
func AttemptFailureDetectionRegistration(analysisEntry *inst.ReplicationAnalysis) (registrationSuccessful bool, err error)
AttemptFailureDetectionRegistration tries to add a failure-detection entry; if this fails that means the problem has already been detected
func AuditTopologyRecovery ¶
func AuditTopologyRecovery(topologyRecovery *TopologyRecovery, message string) error
AuditTopologyRecovery audits a single step in a topology recovery process.
func CheckAndRecover ¶
func CheckAndRecover()
CheckAndRecover is the main entry point for the recovery mechanism
func ClearActiveFailureDetections ¶
func ClearActiveFailureDetections() error
ClearActiveFailureDetections clears the "in_active_period" flag for old-enough detections, thereby allowing for further detections on cleared instances.
func ClearActiveRecoveries ¶
func ClearActiveRecoveries() error
ClearActiveRecoveries clears the "in_active_period" flag for old-enough recoveries, thereby allowing for further recoveries on cleared instances.
func ContinuousDiscovery ¶
func ContinuousDiscovery()
ContinuousDiscovery starts an asynchronuous infinite discovery process where instances are periodically investigated and their status captured, and long since unseen instances are purged and forgotten. nolint SA1015: using time.Tick leaks the underlying ticker
func DisableRecovery ¶
func DisableRecovery() error
DisableRecovery ensures recoveries are disabled globally
func DiscoverInstance ¶
DiscoverInstance will attempt to discover (poll) an instance (unless it is already up-to-date) and will also ensure that its primary and replicas (if any) are also checked.
func EnableRecovery ¶
func EnableRecovery() error
EnableRecovery ensures recoveries are enabled globally
func ExpireBlockedRecoveries ¶
func ExpireBlockedRecoveries() error
ExpireBlockedRecoveries clears listing of blocked recoveries that are no longer actually blocked.
func ExpireFailureDetectionHistory ¶
func ExpireFailureDetectionHistory() error
ExpireFailureDetectionHistory removes old rows from the topology_failure_detection table
func ExpireTopologyRecoveryHistory ¶
func ExpireTopologyRecoveryHistory() error
ExpireTopologyRecoveryHistory removes old rows from the topology_failure_detection table
func ExpireTopologyRecoveryStepsHistory ¶
func ExpireTopologyRecoveryStepsHistory() error
ExpireTopologyRecoveryStepsHistory removes old rows from the topology_failure_detection table
func IsLeaderOrActive ¶
func IsLeaderOrActive() bool
func IsRecoveryDisabled ¶
IsRecoveryDisabled returns true if Recoveries are disabled globally
func LockShard ¶
func LockShard(ctx context.Context, tabletAlias string, lockAction string) (context.Context, func(*error), error)
LockShard locks the keyspace-shard preventing others from performing conflicting actions.
func OpenTabletDiscovery ¶
OpenTabletDiscovery opens the vitess topo if enables and returns a ticker channel for polling.
func RefreshAllKeyspacesAndShards ¶ added in v0.18.0
func RefreshAllKeyspacesAndShards()
RefreshAllKeyspacesAndShards reloads the keyspace and shard information for the keyspaces that vtorc is concerned with.
func RefreshKeyspaceAndShard ¶ added in v0.18.0
RefreshKeyspaceAndShard refreshes the keyspace record and shard record for the given keyspace and shard.
func RegisterBlockedRecoveries ¶
func RegisterBlockedRecoveries(analysisEntry *inst.ReplicationAnalysis, blockingRecoveries []*TopologyRecovery) error
RegisterBlockedRecoveries writes down currently blocked recoveries, and indicates what recovery they are blocked on. Recoveries are blocked thru the in_active_period flag, which comes to avoid flapping.
func RegisterFlags ¶
RegisterFlags registers the flags required by VTOrc
Types ¶
type RecoveryType ¶
type RecoveryType string
type TopologyRecovery ¶
type TopologyRecovery struct { ID int64 UID string AnalysisEntry inst.ReplicationAnalysis SuccessorHostname string SuccessorPort int SuccessorAlias string IsActive bool IsSuccessful bool AllErrors []string RecoveryStartTimestamp string RecoveryEndTimestamp string ProcessingNodeHostname string ProcessingNodeToken string Acknowledged bool AcknowledgedAt string AcknowledgedBy string AcknowledgedComment string LastDetectionID int64 RelatedRecoveryID int64 Type RecoveryType }
TopologyRecovery represents an entry in the topology_recovery table
func AttemptRecoveryRegistration ¶
func AttemptRecoveryRegistration(analysisEntry *inst.ReplicationAnalysis, failIfFailedInstanceInActiveRecovery bool, failIfClusterInActiveRecovery bool) (*TopologyRecovery, error)
AttemptRecoveryRegistration tries to add a recovery entry; if this fails that means recovery is already in place.
func NewTopologyRecovery ¶
func NewTopologyRecovery(replicationAnalysis inst.ReplicationAnalysis) *TopologyRecovery
func ReadInActivePeriodClusterRecovery ¶
func ReadInActivePeriodClusterRecovery(keyspace string, shard, analysis string) ([]*TopologyRecovery, error)
ReadInActivePeriodClusterRecovery reads recoveries (possibly complete!) that are in active period for the analysis. (may be used to block further recoveries of the same analysis on this cluster)
func ReadInActivePeriodSuccessorInstanceRecovery ¶
func ReadInActivePeriodSuccessorInstanceRecovery(tabletAlias string) ([]*TopologyRecovery, error)
ReadInActivePeriodSuccessorInstanceRecovery reads completed recoveries for a given instance, where said instance was promoted as result, still in active period (may be used to block further recoveries should this instance die)
func ReadRecentRecoveries ¶
func ReadRecentRecoveries(unacknowledgedOnly bool, page int) ([]*TopologyRecovery, error)
ReadRecentRecoveries reads latest recovery entries from topology_recovery
func (*TopologyRecovery) AddError ¶
func (topologyRecovery *TopologyRecovery) AddError(err error) error
func (*TopologyRecovery) AddErrors ¶
func (topologyRecovery *TopologyRecovery) AddErrors(errs []error)
type TopologyRecoveryStep ¶
func NewTopologyRecoveryStep ¶
func NewTopologyRecoveryStep(uid string, message string) *TopologyRecoveryStep