Documentation ¶
Index ¶
- Constants
- func AcknowledgeClusterRecoveries(clusterName string, owner string, comment string) (countAcknowledgedEntries int64, err error)
- func AcknowledgeCrashedRecoveries() (countAcknowledgedEntries int64, err error)
- func AcknowledgeInstanceCompletedRecoveries(instanceKey *inst.InstanceKey, owner string, comment string) (countAcknowledgedEntries int64, err error)
- func AcknowledgeInstanceRecoveries(instanceKey *inst.InstanceKey, owner string, comment string) (countAcknowledgedEntries int64, err error)
- func AcknowledgeRecovery(recoveryId int64, owner string, comment string) (countAcknowledgedEntries int64, err error)
- func AttemptFailureDetectionRegistration(analysisEntry *inst.ReplicationAnalysis) (bool, error)
- func BeginAsyncRequest(asyncRequest *AsyncRequest) (bool, error)
- func CheckAndRecover(specificInstance *inst.InstanceKey, candidateInstanceKey *inst.InstanceKey, ...) (recoveryAttempted bool, promotedSlaveKey *inst.InstanceKey, err error)
- func ClearActiveFailureDetections() error
- func ClearActiveRecoveries() error
- func ContinuousAgentsPoll()
- func ContinuousDiscovery()
- func ExpireAsyncRequests() error
- func ExpireBlockedRecoveries() error
- func GetCandidateSiblingOfIntermediateMaster(intermediateMasterInstance *inst.Instance) (*inst.Instance, error)
- func RecoverDeadCoMaster(topologyRecovery *TopologyRecovery, skipProcesses bool) (promotedSlave *inst.Instance, lostSlaves [](*inst.Instance), err error)
- func RecoverDeadIntermediateMaster(topologyRecovery *TopologyRecovery, skipProcesses bool) (successorInstance *inst.Instance, err error)
- func RecoverDeadMaster(topologyRecovery *TopologyRecovery, skipProcesses bool) (promotedSlave *inst.Instance, lostSlaves [](*inst.Instance), err error)
- func RegisterBlockedRecoveries(analysisEntry *inst.ReplicationAnalysis, blockingRecoveries []TopologyRecovery) error
- func ResolveRecovery(topologyRecovery *TopologyRecovery, successorInstance *inst.Instance) error
- func WriteAsyncRequest(asyncRequest *AsyncRequest) error
- type AsyncRequest
- func NewAsyncRequest(story string, command string, instanceKey *inst.InstanceKey, ...) *AsyncRequest
- func NewEmptyAsyncRequest() *AsyncRequest
- func NewSimpleAsyncRequest(story string, command string, instanceKey *inst.InstanceKey) *AsyncRequest
- func ReadPendingAsyncRequests(limit int) (res [](*AsyncRequest), err error)
- type BlockedTopologyRecovery
- type InstancesByCountSlaves
- type MasterRecoveryType
- type TopologyRecovery
- func AttemptRecoveryRegistration(analysisEntry *inst.ReplicationAnalysis, ...) (*TopologyRecovery, error)
- func ForceExecuteRecovery(clusterName string, analysisCode inst.AnalysisCode, ...) (recoveryAttempted bool, topologyRecovery *TopologyRecovery, err error)
- func ForceMasterTakeover(clusterName string, destination *inst.Instance) (topologyRecovery *TopologyRecovery, err error)
- func GracefulMasterTakeover(clusterName string) (topologyRecovery *TopologyRecovery, ...)
- func NewTopologyRecovery(replicationAnalysis inst.ReplicationAnalysis) *TopologyRecovery
- func ReadActiveClusterRecovery(clusterName string) ([]TopologyRecovery, error)
- func ReadActiveRecoveries() ([]TopologyRecovery, error)
- func ReadCompletedRecoveries(page int) ([]TopologyRecovery, error)
- func ReadFailureDetection(detectionId int64) ([]TopologyRecovery, error)
- func ReadInActivePeriodClusterRecovery(clusterName string) ([]TopologyRecovery, error)
- func ReadInActivePeriodSuccessorInstanceRecovery(instanceKey *inst.InstanceKey) ([]TopologyRecovery, error)
- func ReadRecentFailureDetections(page int) ([]TopologyRecovery, error)
- func ReadRecentRecoveries(clusterName string, unacknowledgedOnly bool, page int) ([]TopologyRecovery, error)
- func ReadRecentlyActiveClusterRecovery(clusterName string) ([]TopologyRecovery, error)
- func ReadRecentlyActiveInstanceRecovery(instanceKey *inst.InstanceKey) ([]TopologyRecovery, error)
- func ReadRecovery(recoveryId int64) ([]TopologyRecovery, error)
Constants ¶
const ( MasterRecoveryGTID MasterRecoveryType = "MasterRecoveryGTID" MasterRecoveryPseudoGTID = "MasterRecoveryPseudoGTID" MasterRecoveryBinlogServer = "MasterRecoveryBinlogServer" )
Variables ¶
This section is empty.
Functions ¶
func AcknowledgeClusterRecoveries ¶ added in v1.4.468
func AcknowledgeClusterRecoveries(clusterName string, owner string, comment string) (countAcknowledgedEntries int64, err error)
AcknowledgeClusterRecoveries marks active recoveries for given cluster as acknowledged. This also implied clearing their active period, which in turn enables further recoveries on those topologies
func AcknowledgeCrashedRecoveries ¶ added in v1.4.475
AcknowledgeCrashedRecoveries marks recoveries whose processing nodes has crashed as acknowledged.
func AcknowledgeInstanceCompletedRecoveries ¶ added in v1.4.500
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 AcknowledgeInstanceRecoveries ¶ added in v1.4.468
func AcknowledgeInstanceRecoveries(instanceKey *inst.InstanceKey, owner string, comment string) (countAcknowledgedEntries int64, err error)
AcknowledgeInstanceRecoveries marks active recoveries for given instane as acknowledged. This also implied clearing their active period, which in turn enables further recoveries on those topologies
func AcknowledgeRecovery ¶ added in v1.4.468
func AcknowledgeRecovery(recoveryId int64, owner string, comment string) (countAcknowledgedEntries int64, err error)
AcknowledgeRecovery acknowledges a particular recovery. This also implied clearing their active period, which in turn enables further recoveries on those topologies
func AttemptFailureDetectionRegistration ¶ added in v1.4.196
func AttemptFailureDetectionRegistration(analysisEntry *inst.ReplicationAnalysis) (bool, error)
AttemptFailureDetectionRegistration tries to add a failure-detection entry; if this fails that means the problem has already been detected
func BeginAsyncRequest ¶ added in v1.4.424
func BeginAsyncRequest(asyncRequest *AsyncRequest) (bool, error)
func CheckAndRecover ¶
func CheckAndRecover(specificInstance *inst.InstanceKey, candidateInstanceKey *inst.InstanceKey, skipProcesses bool) (recoveryAttempted bool, promotedSlaveKey *inst.InstanceKey, err error)
CheckAndRecover is the main entry point for the recovery mechanism
func ClearActiveFailureDetections ¶ added in v1.4.196
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 ContinuousAgentsPoll ¶
func ContinuousAgentsPoll()
ContinuousAgentsPoll starts an asynchronuous infinite process where agents are periodically investigated and their status captured, and long since unseen agents are purged and forgotten.
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.
func ExpireAsyncRequests ¶ added in v1.4.424
func ExpireAsyncRequests() error
ExpireAsyncRequests will mark "lost" entries as being completed
func ExpireBlockedRecoveries ¶ added in v1.4.468
func ExpireBlockedRecoveries() error
ExpireBlockedRecoveries clears listing of blocked recoveries that are no longer actually blocked.
func GetCandidateSiblingOfIntermediateMaster ¶
func GetCandidateSiblingOfIntermediateMaster(intermediateMasterInstance *inst.Instance) (*inst.Instance, error)
GetCandidateSiblingOfIntermediateMaster chooses the best sibling of a dead intermediate master to whom the IM's slaves can be moved.
func RecoverDeadCoMaster ¶ added in v1.4.437
func RecoverDeadCoMaster(topologyRecovery *TopologyRecovery, skipProcesses bool) (promotedSlave *inst.Instance, lostSlaves [](*inst.Instance), err error)
RecoverDeadCoMaster recovers a dead co-master, complete logic inside
func RecoverDeadIntermediateMaster ¶
func RecoverDeadIntermediateMaster(topologyRecovery *TopologyRecovery, skipProcesses bool) (successorInstance *inst.Instance, err error)
RecoverDeadIntermediateMaster performs intermediate master recovery; complete logic inside
func RecoverDeadMaster ¶
func RecoverDeadMaster(topologyRecovery *TopologyRecovery, skipProcesses bool) (promotedSlave *inst.Instance, lostSlaves [](*inst.Instance), err error)
RecoverDeadMaster recovers a dead master, complete logic inside
func RegisterBlockedRecoveries ¶ added in v1.4.468
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 ResolveRecovery ¶
func ResolveRecovery(topologyRecovery *TopologyRecovery, successorInstance *inst.Instance) error
ResolveRecovery is called on completion of a recovery process and updates the recovery status. It does not clear the "active period" as this still takes place in order to avoid flapping.
func WriteAsyncRequest ¶ added in v1.4.424
func WriteAsyncRequest(asyncRequest *AsyncRequest) error
WriteAsyncRequest
Types ¶
type AsyncRequest ¶ added in v1.4.424
type AsyncRequest struct { Id int64 Story string Command string OperatedInstanceKey *inst.InstanceKey DestinationKey *inst.InstanceKey Pattern string GTIDHint inst.OperationGTIDHint }
AsyncRequest represents an entry in the async_request table
func NewAsyncRequest ¶ added in v1.4.424
func NewAsyncRequest(story string, command string, instanceKey *inst.InstanceKey, destinationKey *inst.InstanceKey, pattern string, gtidHint inst.OperationGTIDHint) *AsyncRequest
func NewEmptyAsyncRequest ¶ added in v1.4.424
func NewEmptyAsyncRequest() *AsyncRequest
func NewSimpleAsyncRequest ¶ added in v1.4.424
func NewSimpleAsyncRequest(story string, command string, instanceKey *inst.InstanceKey) *AsyncRequest
func ReadPendingAsyncRequests ¶ added in v1.4.424
func ReadPendingAsyncRequests(limit int) (res [](*AsyncRequest), err error)
type BlockedTopologyRecovery ¶ added in v1.4.468
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
func ReadBlockedRecoveries ¶ added in v1.4.468
func ReadBlockedRecoveries(clusterName string) ([]BlockedTopologyRecovery, error)
ReadBlockedRecoveries reads blocked recovery entries, potentially filtered by cluster name (empty to unfilter)
type InstancesByCountSlaves ¶
InstancesByCountSlaves sorts instances by umber of slaves, descending
func (InstancesByCountSlaves) Len ¶
func (this InstancesByCountSlaves) Len() int
func (InstancesByCountSlaves) Less ¶
func (this InstancesByCountSlaves) Less(i, j int) bool
func (InstancesByCountSlaves) Swap ¶
func (this InstancesByCountSlaves) Swap(i, j int)
type MasterRecoveryType ¶ added in v1.4.392
type MasterRecoveryType string
type TopologyRecovery ¶
type TopologyRecovery struct { inst.PostponedFunctionsContainer Id int64 AnalysisEntry inst.ReplicationAnalysis SuccessorKey *inst.InstanceKey SuccessorAlias string IsActive bool IsSuccessful bool LostSlaves inst.InstanceKeyMap ParticipatingInstanceKeys inst.InstanceKeyMap AllErrors []string RecoveryStartTimestamp string RecoveryEndTimestamp string ProcessingNodeHostname string ProcessingNodeToken string PostponedFunctions [](func() error) Acknowledged bool AcknowledgedAt string AcknowledgedBy string AcknowledgedComment string LastDetectionId int64 RelatedRecoveryId int64 }
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 ForceExecuteRecovery ¶ added in v1.4.580
func ForceExecuteRecovery(clusterName string, analysisCode inst.AnalysisCode, failedInstanceKey *inst.InstanceKey, candidateInstanceKey *inst.InstanceKey, skipProcesses bool) (recoveryAttempted bool, topologyRecovery *TopologyRecovery, err error)
ForceExecuteRecovery can be called to issue a recovery process even if analysis says there is no recovery case. The caller of this function injects the type of analysis it wishes the function to assume. By calling this function one takes responsibility for one's actions.
func ForceMasterTakeover ¶ added in v1.4.590
func ForceMasterTakeover(clusterName string, destination *inst.Instance) (topologyRecovery *TopologyRecovery, err error)
ForceMasterTakeover *trusts* master of given cluster is dead and fails over to designated instance, which has to be its direct child.
func GracefulMasterTakeover ¶ added in v1.4.590
func GracefulMasterTakeover(clusterName string) (topologyRecovery *TopologyRecovery, promotedMasterCoordinates *inst.BinlogCoordinates, err error)
GracefulMasterTakeover will demote master of existing topology and promote its direct replica instead. It expects that replica to have no siblings. This function is graceful in that it will first lock down the master, then wait for the designated replica to catch up with last position.
func NewTopologyRecovery ¶ added in v1.4.421
func NewTopologyRecovery(replicationAnalysis inst.ReplicationAnalysis) *TopologyRecovery
func ReadActiveClusterRecovery ¶
func ReadActiveClusterRecovery(clusterName string) ([]TopologyRecovery, error)
ReadActiveRecoveries reads active recovery entry/audit entires from topology_recovery
func ReadActiveRecoveries ¶
func ReadActiveRecoveries() ([]TopologyRecovery, error)
ReadActiveRecoveries reads active recovery entry/audit entires from topology_recovery
func ReadCompletedRecoveries ¶
func ReadCompletedRecoveries(page int) ([]TopologyRecovery, error)
ReadCompletedRecoveries reads completed recovery entry/audit entires from topology_recovery
func ReadFailureDetection ¶ added in v1.4.500
func ReadFailureDetection(detectionId int64) ([]TopologyRecovery, error)
ReadFailureDetection
func ReadInActivePeriodClusterRecovery ¶ added in v1.4.468
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 ¶ added in v1.4.468
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 ReadRecentFailureDetections ¶ added in v1.4.204
func ReadRecentFailureDetections(page int) ([]TopologyRecovery, error)
ReadRecentFailureDetections
func ReadRecentRecoveries ¶
func ReadRecentRecoveries(clusterName string, unacknowledgedOnly bool, page int) ([]TopologyRecovery, error)
ReadCRecoveries reads latest recovery entries from topology_recovery
func ReadRecentlyActiveClusterRecovery ¶
func ReadRecentlyActiveClusterRecovery(clusterName string) ([]TopologyRecovery, error)
ReadRecentlyActiveClusterRecovery reads recently completed entries for a given cluster
func ReadRecentlyActiveInstanceRecovery ¶
func ReadRecentlyActiveInstanceRecovery(instanceKey *inst.InstanceKey) ([]TopologyRecovery, error)
ReadRecentlyActiveInstanceRecovery reads recently completed entries for a given instance
func ReadRecovery ¶ added in v1.4.500
func ReadRecovery(recoveryId int64) ([]TopologyRecovery, error)
ReadRecovery reads completed recovery entry/audit entires from topology_recovery
func (*TopologyRecovery) AddError ¶ added in v1.4.421
func (this *TopologyRecovery) AddError(err error) error
func (*TopologyRecovery) AddErrors ¶ added in v1.4.421
func (this *TopologyRecovery) AddErrors(errs []error)