Documentation ¶
Index ¶
- Variables
- func AccountedDiscoverInstance(instanceKey inst.InstanceKey, pendingTokens chan bool, ...)
- func AttemptElection() (bool, error)
- func AttemptFailureDetectionRegistration(analysisEntry *inst.ReplicationAnalysis) (bool, error)
- func AttemptRecoveryRegistration(analysisEntry *inst.ReplicationAnalysis) (bool, error)
- func CheckAndRecover(specificInstance *inst.InstanceKey, candidateInstanceKey *inst.InstanceKey, ...) (actionTaken bool, instance *inst.Instance, err error)
- func ClearActiveFailureDetections() error
- func ClearActiveRecoveries() error
- func ContinuousAgentsPoll()
- func ContinuousDiscovery()
- func CreateElectionAnchor(force bool) error
- func DiscoverInstance(instanceKey inst.InstanceKey)
- func ElectedNode() (string, string, bool, error)
- func GetCandidateSiblingOfIntermediateMaster(intermediateMasterKey *inst.InstanceKey) (*inst.Instance, error)
- func GetHash(input []byte) string
- func GetRandomData() []byte
- func GrabElection() (bool, error)
- func IsElected() (bool, error)
- func RecoverDeadIntermediateMaster(analysisEntry inst.ReplicationAnalysis) (actionTaken bool, successorInstance *inst.Instance, err error)
- func RecoverDeadMaster(analysisEntry inst.ReplicationAnalysis) (bool, *inst.Instance, error)
- func Reelect() error
- func ResolveRecovery(failedKey *inst.InstanceKey, successorKey *inst.InstanceKey) error
- func StartDiscovery(instanceKey inst.InstanceKey)
- type HealthStatus
- type InstancesByCountSlaves
- type Token
- type TopologyRecovery
- func ReadActiveClusterRecovery(clusterName string) ([]TopologyRecovery, error)
- func ReadActiveRecoveries() ([]TopologyRecovery, error)
- func ReadCompletedRecoveries(page int) ([]TopologyRecovery, error)
- func ReadRecentFailureDetections(page int) ([]TopologyRecovery, error)
- func ReadRecentRecoveries(page int) ([]TopologyRecovery, error)
- func ReadRecentlyActiveClusterRecovery(clusterName string) ([]TopologyRecovery, error)
- func ReadRecentlyActiveInstanceRecovery(instanceKey *inst.InstanceKey) ([]TopologyRecovery, error)
Constants ¶
This section is empty.
Variables ¶
var ThisHostname string
Functions ¶
func AccountedDiscoverInstance ¶
func AccountedDiscoverInstance(instanceKey inst.InstanceKey, pendingTokens chan bool, completedTokens chan bool)
AccountedDiscoverInstance will call upon DiscoverInstance and will keep track of discovery tokens such that management of multiple discoveries can figure out whether all instances in a topology are accounted for.
func AttemptElection ¶
AttemptElection tries to grab leadership (become active node)
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 AttemptRecoveryRegistration ¶
func AttemptRecoveryRegistration(analysisEntry *inst.ReplicationAnalysis) (bool, error)
AttemptRecoveryRegistration tries to add a recovery entry; if this fails that means recovery is already in place.
func CheckAndRecover ¶
func CheckAndRecover(specificInstance *inst.InstanceKey, candidateInstanceKey *inst.InstanceKey, skipFilters bool) (actionTaken bool, instance *inst.Instance, 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 CreateElectionAnchor ¶
func DiscoverInstance ¶
func DiscoverInstance(instanceKey inst.InstanceKey)
DiscoverInstance will attempt discovering an instance (unless it is already up to date) and will list down its master and slaves (if any) for further discovery.
func ElectedNode ¶
ElectedNode returns the hostname of the elected node
func GetCandidateSiblingOfIntermediateMaster ¶
func GetCandidateSiblingOfIntermediateMaster(intermediateMasterKey *inst.InstanceKey) (*inst.Instance, error)
GetCandidateSiblingOfIntermediateMaster chooses the best sibling of a dead intermediate master to whom the IM's slaves can be moved.
func GetRandomData ¶
func GetRandomData() []byte
func GrabElection ¶
GrabElection forcibly grabs leadership. Use with care!!
func RecoverDeadMaster ¶
func Reelect ¶
func Reelect() error
Reelect clears the way for re-elections. Active node is immediately demoted.
func ResolveRecovery ¶
func ResolveRecovery(failedKey *inst.InstanceKey, successorKey *inst.InstanceKey) 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 StartDiscovery ¶
func StartDiscovery(instanceKey inst.InstanceKey)
Start discovery begins a one time asynchronuous discovery process for the given instance and all of its topology connected instances. That is, the instance will be investigated for master and slaves, and the routines will follow on each and every such found master/slave. In essense, assuming all slaves in a replication topology are running, and given a single instance in such topology, this function will detect the entire topology.
Types ¶
type HealthStatus ¶
type HealthStatus struct { Healthy bool Hostname string Token string IsActiveNode bool ActiveNode string Error error AvailableNodes []string }
func HealthTest ¶
func HealthTest() (*HealthStatus, error)
HealthTest attempts to write to the backend database and get a result
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 Token ¶
type Token struct {
Hash string
}
Token is used to identify and validate requests to this service
type TopologyRecovery ¶
type TopologyRecovery struct { Id int64 AnalysisEntry inst.ReplicationAnalysis SuccessorKey inst.InstanceKey IsActive bool RecoveryStartTimestamp string RecoveryEndTimestamp string ProcessingNodeHostname string ProcessingNodeToken string }
TopologyRecovery represents an entry in the topology_recovery table
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 ReadRecentFailureDetections ¶ added in v1.4.204
func ReadRecentFailureDetections(page int) ([]TopologyRecovery, error)
ReadCRecoveries reads latest recovery entreis from topology_recovery
func ReadRecentRecoveries ¶
func ReadRecentRecoveries(page int) ([]TopologyRecovery, error)
ReadCRecoveries reads latest recovery entreis from topology_recovery
func ReadRecentlyActiveClusterRecovery ¶
func ReadRecentlyActiveClusterRecovery(clusterName string) ([]TopologyRecovery, error)
ReadRecentlyActiveInstanceRecovery 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