Documentation ¶
Index ¶
- Constants
- Variables
- func AcknowledgeCrashedRecoveries() (countAcknowledgedEntries int64, err error)
- func AcknowledgeInstanceCompletedRecoveries(instanceKey *inst.InstanceKey, 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(specificInstance *inst.InstanceKey, candidateInstanceKey *inst.InstanceKey, ...) (recoveryAttempted bool, promotedReplicaKey *inst.InstanceKey, err error)
- func ClearActiveFailureDetections() error
- func ClearActiveRecoveries() error
- func ContinuousDiscovery()
- func DisableRecovery() error
- func DiscoverInstance(instanceKey inst.InstanceKey, 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, instanceKey inst.InstanceKey) (context.Context, func(*error), error)
- func OpenTabletDiscovery() <-chan time.Time
- func RefreshAllKeyspaces()
- func RefreshKeyspace(keyspaceName string) error
- func RegisterBlockedRecoveries(analysisEntry *inst.ReplicationAnalysis, ...) error
- func RegisterFlags(fs *pflag.FlagSet)
- type BlockedTopologyRecovery
- type PrimaryRecoveryType
- type RecoveryAcknowledgement
- type RecoveryType
- type TopologyRecovery
- func AttemptRecoveryRegistration(analysisEntry *inst.ReplicationAnalysis, ...) (*TopologyRecovery, error)
- func NewTopologyRecovery(replicationAnalysis inst.ReplicationAnalysis) *TopologyRecovery
- func ReadInActivePeriodClusterRecovery(clusterName string) ([]*TopologyRecovery, error)
- func ReadInActivePeriodSuccessorInstanceRecovery(instanceKey *inst.InstanceKey) ([]*TopologyRecovery, error)
- func ReadRecentRecoveries(clusterName string, unacknowledgedOnly bool, page int) ([]*TopologyRecovery, error)
- type TopologyRecoveryStep
Constants ¶
const ( PrimaryRecovery RecoveryType = "PrimaryRecovery" CoPrimaryRecovery RecoveryType = "CoPrimaryRecovery" IntermediatePrimaryRecovery RecoveryType = "IntermediatePrimaryRecovery" CheckAndRecoverGenericProblemRecoveryName string = "CheckAndRecoverGenericProblem" RecoverDeadPrimaryRecoveryName string = "RecoverDeadPrimary" RecoverPrimaryHasPrimaryRecoveryName string = "RecoverPrimaryHasPrimary" CheckAndRecoverLockedSemiSyncPrimaryRecoveryName string = "CheckAndRecoverLockedSemiSyncPrimary" ElectNewPrimaryRecoveryName string = "ElectNewPrimary" FixPrimaryRecoveryName string = "FixPrimary" FixReplicaRecoveryName string = "FixReplica" )
const TopologyRecoveriesTemplate = `` /* 497-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(instanceKey *inst.InstanceKey, 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(specificInstance *inst.InstanceKey, candidateInstanceKey *inst.InstanceKey, skipProcesses bool) (recoveryAttempted bool, promotedReplicaKey *inst.InstanceKey, err error)
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 ¶
func DiscoverInstance(instanceKey inst.InstanceKey, forceDiscovery bool)
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, instanceKey inst.InstanceKey) (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 RefreshAllKeyspaces ¶
func RefreshAllKeyspaces()
RefreshAllKeyspaces reloads the keyspace information for the keyspaces that vtorc is concerned with.
func RefreshKeyspace ¶
RefreshKeyspace refreshes the keyspace's information for the given keyspace from the topo
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 BlockedTopologyRecovery ¶
type BlockedTopologyRecovery struct { FailedInstanceKey inst.InstanceKey ClusterName string Analysis inst.AnalysisCode LastBlockedTimestamp string BlockingRecoveryID int64 }
BlockedTopologyRecovery represents an entry in the blocked_topology_recovery table
type PrimaryRecoveryType ¶
type PrimaryRecoveryType string
const ( NotPrimaryRecovery PrimaryRecoveryType = "NotPrimaryRecovery" PrimaryRecoveryGTID PrimaryRecoveryType = "PrimaryRecoveryGTID" PrimaryRecoveryBinlogServer PrimaryRecoveryType = "PrimaryRecoveryBinlogServer" PrimaryRecoveryUnknown PrimaryRecoveryType = "PrimaryRecoveryUnknown" )
type RecoveryAcknowledgement ¶
type RecoveryType ¶
type RecoveryType string
type TopologyRecovery ¶
type TopologyRecovery struct { inst.PostponedFunctionsContainer ID int64 UID string AnalysisEntry inst.ReplicationAnalysis SuccessorKey *inst.InstanceKey SuccessorAlias string IsActive bool IsSuccessful bool LostReplicas inst.InstanceKeyMap ParticipatingInstanceKeys inst.InstanceKeyMap AllErrors []string RecoveryStartTimestamp string RecoveryEndTimestamp string ProcessingNodeHostname string ProcessingNodeToken string Acknowledged bool AcknowledgedAt string AcknowledgedBy string AcknowledgedComment string LastDetectionID int64 RelatedRecoveryID int64 Type RecoveryType RecoveryType PrimaryRecoveryType }
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(clusterName string) ([]*TopologyRecovery, error)
ReadInActivePeriodClusterRecovery reads recoveries (possibly complete!) that are in active period. (may be used to block further recoveries on this cluster)
func ReadInActivePeriodSuccessorInstanceRecovery ¶
func ReadInActivePeriodSuccessorInstanceRecovery(instanceKey *inst.InstanceKey) ([]*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(clusterName string, 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