Documentation ¶
Overview ¶
Copyright 2021 SANGFOR TECHNOLOGIES
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 SANGFOR TECHNOLOGIES ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 SANGFOR TECHNOLOGIES ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 SANGFOR TECHNOLOGIES ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 SANGFOR TECHNOLOGIES ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 SANGFOR TECHNOLOGIES ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 SANGFOR TECHNOLOGIES ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 SANGFOR TECHNOLOGIES ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 SANGFOR TECHNOLOGIES ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- func AcknowledgeAllRecoveries(owner string, comment string) (countAcknowledgedEntries int64, err error)
- func AcknowledgeClusterRecoveries(clusterName string, owner string, comment string) (countAcknowledgedEntries int64, err error)
- func AcknowledgeCrashedRecoveries() (countAcknowledgedEntries int64, err error)
- func AcknowledgeInstanceCompletedRecoveries(instanceKey *dtstruct.InstanceKey, owner string, comment string) (countAcknowledgedEntries int64, err error)
- func AcknowledgeInstanceFailureDetection(instanceKey *dtstruct.InstanceKey) error
- func AcknowledgeInstanceRecoveries(instanceKey *dtstruct.InstanceKey, owner string, comment string) (countAcknowledgedEntries int64, err error)
- func AcknowledgeRecoveries(owner string, comment string, markEndRecovery bool, whereClause string, ...) (countAcknowledgedEntries int64, err error)
- func AcknowledgeRecovery(recoveryId int64, owner string, comment string) (countAcknowledgedEntries int64, err error)
- func AcknowledgeRecoveryByUID(recoveryUID string, owner string, comment string) (countAcknowledgedEntries int64, err error)
- func ApplyPoolInstance(submission *dtstruct.PoolInstancesSubmission) error
- func AttemptFailureDetectionRegistration(analysisEntry *dtstruct.ReplicationAnalysis) (registrationSuccessful bool, err error)
- func AttemptRecoveryRegistration(analysisEntry *dtstruct.ReplicationAnalysis, ...) (*dtstruct.TopologyRecovery, error)
- func AuditInstanceAnalysisInChangelog(instanceKey *dtstruct.InstanceKey, analysisCode dtstruct.AnalysisCode) error
- func AuditOperation(auditType string, instanceKey *dtstruct.InstanceKey, clusterName string, ...)
- func AuditTopologyRecovery(topologyRecovery *dtstruct.TopologyRecovery, message string) error
- func AuthCheck(r render.Render, req *http.Request, user auth.User) bool
- func AuthCheckAndGetInstanceKey(params martini.Params, r render.Render, req *http.Request, user auth.User, ...) (*dtstruct.InstanceKey, error)
- func AuthCheckAndGetInstanceKeyWithClusterId(params martini.Params, r render.Render, req *http.Request, user auth.User, ...) (*dtstruct.InstanceKey, error)
- func AuthCheckAndGetRequest(params martini.Params, r render.Render, req *http.Request, user auth.User) (request *dtstruct.Request, err error)
- func BeginBoundedMaintenance(instanceKey *dtstruct.InstanceKey, owner string, reason string, ...) (int64, error)
- func BeginDowntime(downtime *dtstruct.Downtime) (err error)
- func BeginMaintenance(instanceKey *dtstruct.InstanceKey, owner string, reason string) (int64, error)
- func BulkReadCandidateDatabaseInstance() ([]dtstruct.CandidateDatabaseInstance, error)
- func CheckAndRecover(handler dtstruct.HamHandler, specificInstance *dtstruct.InstanceKey, ...) (recoveryAttempted bool, promotedReplicaKey *dtstruct.InstanceKey, err error)
- func ClearAcknowledgedFailureDetections(whereClause string, args []interface{}) error
- func ClearActiveFailureDetections() error
- func ClearActiveRecoveries() error
- func DeduceClusterName(nameOrAlias string) (clusterName string, err error)
- func DeleteHostnameResolves() error
- func DeleteHostnameUnresolve(instanceKey *dtstruct.InstanceKey) error
- func DeleteInvalidHostnameResolves() error
- func DisableRecovery() error
- func EnableRecovery() error
- func EnableSyslog() (err error)
- func EndDowntime(instanceKey *dtstruct.InstanceKey) (unDowntime bool, err error)
- func EndMaintenance(maintenanceToken int64) (wasMaintenance bool, err error)
- func EndMaintenanceByInstanceKey(instanceKey *dtstruct.InstanceKey) (wasMaintenance bool, err error)
- func ExecuteCheckAndRecoverFunction(analysisEntry dtstruct.ReplicationAnalysis, ...) (recoveryAttempted bool, topologyRecovery *dtstruct.TopologyRecovery, err error)
- func ExecuteProcess(command string, env []string, topologyRecovery *dtstruct.TopologyRecovery, ...) (err error)
- func ExecuteProcesses(processes []string, description string, ...) (err error)
- func ExpireAudit() error
- func ExpireBlockedRecoveries() error
- func ExpireCandidateInstances() error
- func ExpireClusterDomainName() error
- func ExpireFailureDetectionHistory() error
- func ExpireHostnameUnresolve() error
- func ExpireInstanceAnalysisChangelog() (err error)
- func ExpireMaintenance() error
- func ExpireMasterPositionEquivalence() error
- func ExpirePoolInstance() (err error)
- func ExpireStaleInstanceBinlogCoordinates() error
- func ExpireTableData(tableName string, timestampColumn string) error
- func ExpireTopologyRecoveryHistory() error
- func ExpireTopologyRecoveryStepsHistory() error
- func FigureClusterName(clusterHint string, instanceKey *dtstruct.InstanceKey, ...) (clusterName string, err error)
- func FigureClusterNameByHint(hint string) (clusterName string, err error)
- func FigureInstanceKey(instanceKey *dtstruct.InstanceKey, thisInstanceKey *dtstruct.InstanceKey) (*dtstruct.InstanceKey, error)
- func FindFuzzyInstances(fuzzyInstanceKey *dtstruct.InstanceKey) ([]*dtstruct.InstanceKey, error)
- func FindInstanceClusterName(instanceKey *dtstruct.InstanceKey) (string, error)
- func FlushNontrivialResolveCacheToDatabase() error
- func ForgetExpiredHostnameResolves() error
- func ForgetInstance(instanceKey *dtstruct.InstanceKey) error
- func ForgetLongUnseenClusterAliases() error
- func ForgetLongUnseenInstances() error
- func ForgetUnseenInstancesDifferentlyResolved() error
- func GetAddr(hostname string) (string, error)
- func GetCNAME(hostname string) (string, error)
- func GetClusterMasterKVPair(clusterAlias string, masterKey *dtstruct.InstanceKey) *dtstruct.KVPair
- func GetClusterMasterKVPairs(clusterAlias string, masterKey *dtstruct.InstanceKey) (kvPairs []*dtstruct.KVPair)
- func GetClusterName(instanceKey *dtstruct.InstanceKey) (clusterName string, err error)
- func GetClusterNameWithAlias(clusterAlias string, instanceKey *dtstruct.InstanceKey, ...) (clusterName string)
- func GetGeneralAttribute(attributeName string) (result string, err error)
- func GetHeuristicClusterDomainInstanceAttribute(dbt string, clusterName string) (instanceKey *dtstruct.InstanceKey, err error)
- func GetHostAttribute(hostname string, attributeName string) (string, error)
- func GetHostAttributesByAttribute(attributeName string, valueMatch string) ([]dtstruct.HostAttributes, error)
- func GetHostAttributesByMatch(hostnameMatch string, attributeNameMatch string, attributeValueMatch string) ([]dtstruct.HostAttributes, error)
- func GetInstanceKey(dbt string, host string, port string) (dtstruct.InstanceKey, error)
- func GetInstanceKeyInternal(dbt string, host string, port string, resolve bool) (dtstruct.InstanceKey, error)
- func GetInstanceKeysByTag(tag *dtstruct.Tag) (tagged *dtstruct.InstanceKeyMap, err error)
- func GetInstanceKeysByTags(tagsString string) (tagged *dtstruct.InstanceKeyMap, err error)
- func GetProxyAuthUser(req *http.Request) string
- func InMaintenance(instanceKey *dtstruct.InstanceKey) (inMaintenance bool, err error)
- func InstanceTagExists(instanceKey *dtstruct.InstanceKey, tag *dtstruct.Tag) (tagExists bool, err error)
- func IsAuthorizedForAction(req *http.Request, user auth.User) bool
- func IsHostnameResolveMethodNone() bool
- func IsInstanceForgotten(instanceKey *dtstruct.InstanceKey) bool
- func IsLeader() bool
- func IsLeaderOrActive() bool
- func IsRecoveryDisabled() (disabled bool, err error)
- func LoadHostnameResolveCache() error
- func MasterFailoverGeographicConstraintSatisfied(analysisEntry *dtstruct.ReplicationAnalysis, ...) (satisfied bool, dissatisfiedReason string)
- func MkInsertOdku(table string, columns []string, values []string, nrRows int, insertIgnore bool) (string, error)
- func MultiPathCheck(failed *dtstruct.InstanceKey, upstream *dtstruct.InstanceKey, ...) bool
- func NewRawInstanceKeyStrings(dbt, hostname string, port string) (*dtstruct.InstanceKey, error)
- func NewResolveInstanceKey(dbt string, hostname string, port int) (*dtstruct.InstanceKey, error)
- func NewResolveInstanceKeyStrings(dbt string, hostname string, port string) (*dtstruct.InstanceKey, error)
- func ParseRawInstanceKey(dbt string, hostPort string) (instanceKey *dtstruct.InstanceKey, err error)
- func ParseResolveInstanceKey(dbt string, hostPort string) (instanceKey *dtstruct.InstanceKey, err error)
- func PutInstanceTag(instanceKey *dtstruct.InstanceKey, tag *dtstruct.Tag) (err error)
- func ReadActiveClusterRecovery(clusterName string) ([]*dtstruct.TopologyRecovery, error)
- func ReadActiveMaintenance() ([]dtstruct.Maintenance, error)
- func ReadActiveRecoveries() ([]*dtstruct.TopologyRecovery, error)
- func ReadAliasByClusterName(clusterName string) (alias string, err error)
- func ReadAllClusterInfo(dbt string, clusterName string) ([]dtstruct.ClusterInfo, error)
- func ReadAllClusterPoolInstance() ([]*dtstruct.ClusterPoolInstance, error)
- func ReadAllHostnameResolves() ([]dtstruct.HostnameResolve, error)
- func ReadAllHostnameUnresolves() ([]dtstruct.HostnameUnresolve, error)
- func ReadAllHostnameUnresolvesRegistrations() (registrations []dtstruct.HostnameRegistration, err error)
- func ReadAllInstanceKeys() ([]dtstruct.InstanceKey, error)
- func ReadBlockedRecoveries(clusterName string) ([]dtstruct.BlockedTopologyRecovery, error)
- func ReadClusterAliasOverride(instance *dtstruct.Instance) (err error)
- func ReadClusterInfo(dbt string, clusterName string) (*dtstruct.ClusterInfo, error)
- func ReadClusterNameByAlias(alias string) (clusterName string, err error)
- func ReadClusterPoolInstance(clusterName string, pool string) (result []*dtstruct.ClusterPoolInstance, err error)
- func ReadClusterPoolInstancesMap(clusterName string, pool string) (*dtstruct.PoolInstancesMap, error)
- func ReadClusters(dbt string) (clusterNames []string, err error)
- func ReadCommaDelimitedList(instKeyMap *dtstruct.InstanceKeyMap, dbt string, list string) error
- func ReadCompletedRecoveries(page int) ([]*dtstruct.TopologyRecovery, error)
- func ReadFailureDetection(detectionId int64) ([]*dtstruct.TopologyRecovery, error)
- func ReadFuzzyInstanceKey(fuzzyInstanceKey *dtstruct.InstanceKey) *dtstruct.InstanceKey
- func ReadFuzzyInstanceKeyIfPossible(fuzzyInstanceKey *dtstruct.InstanceKey) *dtstruct.InstanceKey
- func ReadHistoryClusterInstances(clusterName string, historyTimestampPattern string) ([](*dtstruct.Instance), error)
- func ReadHostnameIPs(hostname string) (ipv4 string, ipv6 string, err error)
- func ReadInActivePeriodClusterRecovery(clusterName string) ([]*dtstruct.TopologyRecovery, error)
- func ReadInActivePeriodSuccessorInstanceRecovery(instanceKey *dtstruct.InstanceKey) ([]*dtstruct.TopologyRecovery, error)
- func ReadInstanceClusterAttributes(instance dtstruct.InstanceAdaptor) (err error)
- func ReadInstancePromotionRule(instance dtstruct.InstanceAdaptor) (err error)
- func ReadInstanceTag(instanceKey *dtstruct.InstanceKey, tag *dtstruct.Tag) (tagExist bool, err error)
- func ReadInstanceTags(instanceKey *dtstruct.InstanceKey) (tags []*dtstruct.Tag, err error)
- func ReadMaintenanceInstanceKey(maintenanceToken int64) (*dtstruct.InstanceKey, error)
- func ReadRecentAudit(instanceKey *dtstruct.InstanceKey, page int) ([]dtstruct.Audit, error)
- func ReadRecentFailureDetections(dbType string, clusterAlias string, page int) ([]*dtstruct.TopologyRecovery, error)
- func ReadRecentRecoveries(dbType string, clusterName string, clusterAlias string, ...) ([]*dtstruct.TopologyRecovery, error)
- func ReadRecentlyActiveClusterRecovery(dbt string, clusterName string) ([]*dtstruct.TopologyRecovery, error)
- func ReadRecentlyActiveInstanceRecovery(instanceKey *dtstruct.InstanceKey) ([]*dtstruct.TopologyRecovery, error)
- func ReadRecovery(recoveryId int64) ([]*dtstruct.TopologyRecovery, error)
- func ReadRecoveryByUID(recoveryUID string) ([]*dtstruct.TopologyRecovery, error)
- func ReadReplicationAnalysisChangelog() (res []*dtstruct.ReplicationAnalysisChangelog, err error)
- func ReadResolvedHostname(hostname string) (resolvedHostname string, err error)
- func ReadTopologyRecoverySteps(recoveryUID string) ([]dtstruct.TopologyRecoveryStep, error)
- func ReadUnambiguousSuggestedClusterAlias() (result map[string]dtstruct.InstanceKey, err error)
- func ReadUnknownMasterHostnameResolves() (map[string]string, error)
- func ReadUnresolvedHostname(hostname string) (string, error)
- func ReadUnseenMasterKey() (res []dtstruct.InstanceKey, err error)
- func RecordStaleInstanceBinlogCoordinates(instanceKey *dtstruct.InstanceKey, binlogCoordinates *dtstruct.LogCoordinates) error
- func RegisterBlockedRecoveries(analysisEntry *dtstruct.ReplicationAnalysis, ...) error
- func RegisterCandidateInstance(candidate *dtstruct.CandidateDatabaseInstance) error
- func RegisterHostnameUnresolve(registration *dtstruct.HostnameRegistration) (err error)
- func ReplaceAliasClusterName(oldClusterName string, newClusterName string) (err error)
- func ReplaceClusterName(oldClusterName string, newClusterName string) error
- func ResetHostnameResolveCache() error
- func ResolveHostname(hostname string) (string, error)
- func ResolveHostnameForInstanceKey(instanceKey *dtstruct.InstanceKey) (*dtstruct.InstanceKey, error)
- func ResolveHostnameIPs(hostname string) error
- func ResolveRecovery(topologyRecovery *dtstruct.TopologyRecovery, ...) error
- func ResolveUnknownMasterHostnameResolves() error
- func Respond(r render.Render, apiResponse *dtstruct.APIResponse)
- func SetGeneralAttribute(attributeName string, attributeValue string) error
- func SetHostAttribute(hostname string, attributeName string, attributeValue string) (err error)
- func SetRecoveryDisabled(disabled bool) error
- func SnapshotTopologies() error
- func UnresolveHostname(instanceKey *dtstruct.InstanceKey, ...) (dtstruct.InstanceKey, bool, error)
- func Untag(instanceKey *dtstruct.InstanceKey, tag *dtstruct.Tag) (tagged *dtstruct.InstanceKeyMap, err error)
- func UpdateClusterAliases() error
- func UpdateInstanceClusterName(instance dtstruct.InstanceAdaptor) error
- func UpdateInstanceLastAttemptedCheck(instanceKey *dtstruct.InstanceKey) error
- func UpdateInstanceLastChecked(instanceKey *dtstruct.InstanceKey, partialSuccess bool) error
- func UpdateInstanceRoleAndState(instanceKey *dtstruct.InstanceKey, role, state string) error
- func UpdateResolvedHostname(hostname string, resolvedHostname string) bool
- func WithCurrentTime(cdi *dtstruct.CandidateDatabaseInstance) *dtstruct.CandidateDatabaseInstance
- func WriteClusterAlias(clusterName string, alias string) error
- func WriteClusterAliasManualOverride(clusterName string, alias string) error
- func WriteClusterDomainName(clusterName string, domainName string) error
- func WriteHostnameIPs(hostname string, ipv4String string, ipv6String string) error
- func WriteHostnameUnresolve(instanceKey *dtstruct.InstanceKey, unresolvedHostname string) error
- func WriteMasterPositionEquivalence(master1Key *dtstruct.InstanceKey, ...) error
- func WritePoolInstance(pool string, instKeyList []*dtstruct.InstanceKey) error
- func WriteResolveRecovery(topologyRecovery *dtstruct.TopologyRecovery) error
- func WriteResolvedHostname(hostname string, resolvedHostname string) error
- func WriteTopologyRecovery(topologyRecovery *dtstruct.TopologyRecovery) (*dtstruct.TopologyRecovery, error)
- func WriteTopologyRecoveryStep(topologyRecoveryStep *dtstruct.TopologyRecoveryStep) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AcknowledgeAllRecoveries ¶
func AcknowledgeAllRecoveries(owner string, comment string) (countAcknowledgedEntries int64, err error)
AcknowledgeAllRecoveries acknowledges all unacknowledged recoveries.
func AcknowledgeClusterRecoveries ¶
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 ¶
AcknowledgeCrashedRecoveries marks recoveries whose processing nodes has crashed as acknowledged.
func AcknowledgeInstanceCompletedRecoveries ¶
func AcknowledgeInstanceCompletedRecoveries(instanceKey *dtstruct.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 AcknowledgeInstanceFailureDetection ¶
func AcknowledgeInstanceFailureDetection(instanceKey *dtstruct.InstanceKey) error
AcknowledgeInstanceFailureDetection clears a failure detection for a particular instance. This is automated by recovery process: it makes sense to acknowledge the detection of an instance just recovered.
func AcknowledgeInstanceRecoveries ¶
func AcknowledgeInstanceRecoveries(instanceKey *dtstruct.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 AcknowledgeRecoveries ¶
func AcknowledgeRecoveries(owner string, comment string, markEndRecovery bool, whereClause string, args []interface{}) (countAcknowledgedEntries int64, err error)
AcknowledgeRecoveries sets acknowledged* details and clears the in_active_period flags from a set of entries
func AcknowledgeRecovery ¶
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 AcknowledgeRecoveryByUID ¶
func AcknowledgeRecoveryByUID(recoveryUID string, 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 ApplyPoolInstance ¶
func ApplyPoolInstance(submission *dtstruct.PoolInstancesSubmission) error
ApplyPoolInstance
func AttemptFailureDetectionRegistration ¶
func AttemptFailureDetectionRegistration(analysisEntry *dtstruct.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 AttemptRecoveryRegistration ¶
func AttemptRecoveryRegistration(analysisEntry *dtstruct.ReplicationAnalysis, failIfFailedInstanceInActiveRecovery bool, failIfClusterInActiveRecovery bool) (*dtstruct.TopologyRecovery, error)
AttemptRecoveryRegistration tries to add a recovery entry; if this fails that means recovery is already in place.
func AuditInstanceAnalysisInChangelog ¶
func AuditInstanceAnalysisInChangelog(instanceKey *dtstruct.InstanceKey, analysisCode dtstruct.AnalysisCode) error
AuditInstanceAnalysisInChangelog will write down an instance's analysis in the database_instance_analysis_changelog table. To not repeat recurring analysis code, the database_instance_last_analysis table is used, so that only changes to analysis codes are written.
func AuditOperation ¶
func AuditOperation(auditType string, instanceKey *dtstruct.InstanceKey, clusterName string, message string)
AuditOperation creates and writes a new audit entry by given params
func AuditTopologyRecovery ¶
func AuditTopologyRecovery(topologyRecovery *dtstruct.TopologyRecovery, message string) error
AuditTopologyRecovery audits a single step in a topology recovery process.
func AuthCheckAndGetInstanceKey ¶
func AuthCheckAndGetInstanceKey(params martini.Params, r render.Render, req *http.Request, user auth.User, resolve bool) (*dtstruct.InstanceKey, error)
AuthCheckAndGetInstanceKey check user authorization and generate instance key using params
func AuthCheckAndGetInstanceKeyWithClusterId ¶
func AuthCheckAndGetInstanceKeyWithClusterId(params martini.Params, r render.Render, req *http.Request, user auth.User, resolve bool) (*dtstruct.InstanceKey, error)
AuthCheckAndGetInstanceKeyWithClusterId check user authorization and cluster id, generate instance key using params
func AuthCheckAndGetRequest ¶
func AuthCheckAndGetRequest(params martini.Params, r render.Render, req *http.Request, user auth.User) (request *dtstruct.Request, err error)
AuthCheckAndGetInstanceKeyWithClusterId check user authorization and cluster id, generate instance key using params
func BeginBoundedMaintenance ¶
func BeginBoundedMaintenance(instanceKey *dtstruct.InstanceKey, owner string, reason string, durationSeconds uint, explicitlyBounded bool) (int64, error)
BeginBoundedMaintenance will make new maintenance entry for given instanceKey.
func BeginDowntime ¶
BeginDowntime will make mark an instance as downtimed (or override existing downtime period)
func BeginMaintenance ¶
func BeginMaintenance(instanceKey *dtstruct.InstanceKey, owner string, reason string) (int64, error)
BeginMaintenance will make new maintenance entry for given instanceKey. Maintenance time is unbounded
func BulkReadCandidateDatabaseInstance ¶
func BulkReadCandidateDatabaseInstance() ([]dtstruct.CandidateDatabaseInstance, error)
BulkReadCandidateDatabaseInstance returns a slice of CandidateDatabaseInstance converted to JSON.
root@my [ham4db]> select * from ham_database_instance_candidate; +-------------------+------+---------------------+----------+----------------+ | hostname | port | last_suggested_timestamp | priority | promotion_rule | +-------------------+------+---------------------+----------+----------------+ | host1.example.com | 3306 | 2016-11-22 17:41:06 | 1 | prefer | | host2.example.com | 3306 | 2016-11-22 17:40:24 | 1 | prefer | +-------------------+------+---------------------+----------+----------------+ 2 rows in set (0.00 sec)
func CheckAndRecover ¶
func CheckAndRecover(handler dtstruct.HamHandler, specificInstance *dtstruct.InstanceKey, candidateInstanceKey *dtstruct.InstanceKey, skipProcesses bool) (recoveryAttempted bool, promotedReplicaKey *dtstruct.InstanceKey, err error)
CheckAndRecover is the main entry point for the recovery mechanism
func ClearAcknowledgedFailureDetections ¶
ClearAcknowledgedFailureDetections clears the "in_active_period" flag for detections that were acknowledged
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 DeduceClusterName ¶
DeduceClusterName attempts to resolve a cluster name given a name or alias. If unsuccessful to match by alias, the function returns the same given string
func DeleteHostnameResolves ¶
func DeleteHostnameResolves() error
deleteHostnameResolves compeltely erases the database cache
func DeleteHostnameUnresolve ¶
func DeleteHostnameUnresolve(instanceKey *dtstruct.InstanceKey) error
DeleteHostnameUnresolve removes an unresolve entry
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 DisableRecovery ¶
func DisableRecovery() error
DisableRecovery ensures recoveries are disabled globally
func EnableRecovery ¶
func EnableRecovery() error
EnableRecovery ensures recoveries are enabled globally
func EnableSyslog ¶
func EnableSyslog() (err error)
EnableSyslog enables, if possible, writes to syslog. These will execute in addition to normal logging
func EndDowntime ¶
func EndDowntime(instanceKey *dtstruct.InstanceKey) (unDowntime bool, err error)
EndDowntime will remove downtime flag from an instance
func EndMaintenance ¶
EndMaintenance will terminate an active maintenance via maintenanceToken
func EndMaintenanceByInstanceKey ¶
func EndMaintenanceByInstanceKey(instanceKey *dtstruct.InstanceKey) (wasMaintenance bool, err error)
EndMaintenanceByInstanceKey will terminate an active maintenance using given instanceKey as hint
func ExecuteCheckAndRecoverFunction ¶
func ExecuteCheckAndRecoverFunction(analysisEntry dtstruct.ReplicationAnalysis, candidateInstanceKey *dtstruct.InstanceKey, forceInstanceRecovery bool, skipProcesses bool, getCheckAndRecoverFunction func(dtstruct.AnalysisCode, *dtstruct.InstanceKey) (checkAndRecoverFunction func(dtstruct.ReplicationAnalysis, *dtstruct.InstanceKey, bool, bool) (bool, *dtstruct.TopologyRecovery, error), isActionableRecovery bool), runEmergentOperations func(*dtstruct.ReplicationAnalysis), pathCheck func(*dtstruct.InstanceKey, *dtstruct.InstanceKey, bool) bool, ) (recoveryAttempted bool, topologyRecovery *dtstruct.TopologyRecovery, err error)
ExecuteCheckAndRecoverFunction will choose the correct check & recovery function based on analysis. It executes the function synchronuously
func ExecuteProcess ¶
func ExecuteProcesses ¶
func ExecuteProcesses(processes []string, description string, topologyRecovery *dtstruct.TopologyRecovery, failOnError bool) (err error)
executeProcesses executes a list of processes
func ExpireBlockedRecoveries ¶
func ExpireBlockedRecoveries() error
ExpireBlockedRecoveries clears listing of blocked recoveries that are no longer actually blocked.
func ExpireCandidateInstances ¶
func ExpireCandidateInstances() error
ExpireCandidateInstances removes stale master candidate suggestions.
func ExpireClusterDomainName ¶
func ExpireClusterDomainName() error
ExpireClusterDomainName expires cluster_domain_name entries that haven't been updated recently.
func ExpireFailureDetectionHistory ¶
func ExpireFailureDetectionHistory() error
ExpireFailureDetectionHistory removes old rows from the ham_topology_failure_detection table
func ExpireHostnameUnresolve ¶
func ExpireHostnameUnresolve() error
ExpireHostnameUnresolve expires ham_hostname_unresolved entries that haven't been updated recently.
func ExpireInstanceAnalysisChangelog ¶
func ExpireInstanceAnalysisChangelog() (err 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 ExpireMasterPositionEquivalence ¶
func ExpireMasterPositionEquivalence() error
ExpireMasterPositionEquivalence expires old mysql_master_position_equivalence
func ExpirePoolInstance ¶
func ExpirePoolInstance() (err error)
ExpirePoolInstance clean up the database_instance_pool table from expired items
func ExpireStaleInstanceBinlogCoordinates ¶
func ExpireStaleInstanceBinlogCoordinates() error
func ExpireTableData ¶
func ExpireTopologyRecoveryHistory ¶
func ExpireTopologyRecoveryHistory() error
ExpireTopologyRecoveryHistory removes old rows from the ham_topology_failure_detection table
func ExpireTopologyRecoveryStepsHistory ¶
func ExpireTopologyRecoveryStepsHistory() error
ExpireTopologyRecoveryStepsHistory removes old rows from the ham_topology_failure_detection table
func FigureClusterName ¶
func FigureClusterName(clusterHint string, instanceKey *dtstruct.InstanceKey, thisInstanceKey *dtstruct.InstanceKey) (clusterName string, err error)
FigureClusterName will make a best effort to deduce a cluster name using either a given alias or an instanceKey. First attempt is at alias, and if that doesn't work, we try instanceKey. - clusterHint may be an empty string
func FigureClusterNameByHint ¶
figureClusterName is a convenience function to get a cluster name from hints
func FigureInstanceKey ¶
func FigureInstanceKey(instanceKey *dtstruct.InstanceKey, thisInstanceKey *dtstruct.InstanceKey) (*dtstruct.InstanceKey, error)
FigureInstanceKey tries to figure out a key
func FindFuzzyInstances ¶
func FindFuzzyInstances(fuzzyInstanceKey *dtstruct.InstanceKey) ([]*dtstruct.InstanceKey, error)
FindFuzzyInstances return instances whose names are like the one given (host & port substrings) For example, the given `mydb-3:3306` might find `myhosts-mydb301-production.mycompany.com:3306`
func FindInstanceClusterName ¶
func FindInstanceClusterName(instanceKey *dtstruct.InstanceKey) (string, error)
FindFuzzyInstances return instances whose names are like the one given (host & port substrings) For example, the given `mydb-3:3306` might find `myhosts-mydb301-production.mycompany.com:3306`
func FlushNontrivialResolveCacheToDatabase ¶
func FlushNontrivialResolveCacheToDatabase() error
func ForgetExpiredHostnameResolves ¶
func ForgetExpiredHostnameResolves() error
ForgetExpiredHostnameResolves
func ForgetInstance ¶
func ForgetInstance(instanceKey *dtstruct.InstanceKey) error
ForgetInstance removes an instance entry from the backed database. It may be auto-rediscovered through topology or requested for discovery by multiple means.
func ForgetLongUnseenClusterAliases ¶
func ForgetLongUnseenClusterAliases() error
ForgetLongUnseenClusterAliases will remove entries of cluster_aliases that have long since been last seen. This function is compatible with ForgetLongUnseenInstances
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 GetClusterMasterKVPair ¶
func GetClusterMasterKVPair(clusterAlias string, masterKey *dtstruct.InstanceKey) *dtstruct.KVPair
GetClusterMasterKVPair construct master kv pair using prefix in config
func GetClusterMasterKVPairs ¶
func GetClusterMasterKVPairs(clusterAlias string, masterKey *dtstruct.InstanceKey) (kvPairs []*dtstruct.KVPair)
GetClusterMasterKVPairs returns all KV pairs associated with a master. This includes the full identity of the master as well as a breakdown by hostname, port, ipv4, ipv6
func GetClusterName ¶
func GetClusterName(instanceKey *dtstruct.InstanceKey) (clusterName string, err error)
GetClusterName get cluster name for given instance
func GetClusterNameWithAlias ¶
func GetClusterNameWithAlias(clusterAlias string, instanceKey *dtstruct.InstanceKey, thisInstanceKey *dtstruct.InstanceKey) (clusterName string)
getClusterName will make a best effort to deduce a cluster name using either a given alias or an instanceKey. First attempt is at alias, and if that doesn't work, we try instanceKey.
func GetGeneralAttribute ¶
GetGeneralAttribute expects to return a single attribute value (not associated with a specific hostname)
func GetHeuristicClusterDomainInstanceAttribute ¶
func GetHeuristicClusterDomainInstanceAttribute(dbt string, clusterName string) (instanceKey *dtstruct.InstanceKey, err error)
GetHeuristicClusterDomainInstanceAttribute attempts detecting the cluster domain for the given cluster, and return the instance key associated as writer with that domain
func GetHostAttribute ¶
GetHostAttribute expects to return a single attribute for a given hostname/attribute-name combination or error on empty result
func GetHostAttributesByAttribute ¶
func GetHostAttributesByAttribute(attributeName string, valueMatch string) ([]dtstruct.HostAttributes, error)
GetHostAttributesByAttribute
func GetHostAttributesByMatch ¶
func GetHostAttributesByMatch(hostnameMatch string, attributeNameMatch string, attributeValueMatch string) ([]dtstruct.HostAttributes, error)
GetHostAttributesByMatch
func GetInstanceKey ¶
GetInstanceKey
func GetInstanceKeyInternal ¶
func GetInstanceKeyInternal(dbt string, host string, port string, resolve bool) (dtstruct.InstanceKey, error)
GetInstanceKeyInternal
func GetInstanceKeysByTag ¶
func GetInstanceKeysByTag(tag *dtstruct.Tag) (tagged *dtstruct.InstanceKeyMap, err error)
func GetInstanceKeysByTags ¶
func GetInstanceKeysByTags(tagsString string) (tagged *dtstruct.InstanceKeyMap, err error)
func GetProxyAuthUser ¶
func InMaintenance ¶
func InMaintenance(instanceKey *dtstruct.InstanceKey) (inMaintenance bool, err error)
InMaintenance checks whether a given instance is under maintenacne
func InstanceTagExists ¶
func IsAuthorizedForAction ¶
IsAuthorizedForAction checks req to see whether authenticated user has write-privileges. This depends on configured authentication method.
func IsHostnameResolveMethodNone ¶
func IsHostnameResolveMethodNone() bool
IsHostnameResolveMethodNone check if hostname resolve method in config is none
func IsInstanceForgotten ¶
func IsInstanceForgotten(instanceKey *dtstruct.InstanceKey) bool
IsInstanceForgotten check if instance is forgotten
func IsLeaderOrActive ¶
func IsLeaderOrActive() bool
func IsRecoveryDisabled ¶
IsRecoveryDisabled returns true if Recoveries are disabled globally
func LoadHostnameResolveCache ¶
func LoadHostnameResolveCache() error
LoadHostnameResolveCache check hostname resolve method, if not none, load all hostname from backend database to hostname cache
func MasterFailoverGeographicConstraintSatisfied ¶
func MasterFailoverGeographicConstraintSatisfied(analysisEntry *dtstruct.ReplicationAnalysis, suggestedInstance dtstruct.InstanceAdaptor) (satisfied bool, dissatisfiedReason string)
func MkInsertOdku ¶
func MultiPathCheck ¶
func MultiPathCheck(failed *dtstruct.InstanceKey, upstream *dtstruct.InstanceKey, downstreamMap dtstruct.InstanceKeyMap, pathCheck func(*dtstruct.InstanceKey, *dtstruct.InstanceKey, bool) bool) bool
MultiPathCheck check if instance is alive by its upstream and downstream
func NewRawInstanceKeyStrings ¶
func NewRawInstanceKeyStrings(dbt, hostname string, port string) (*dtstruct.InstanceKey, error)
NewRawInstanceKeyStrings creates a new instance key based on string params without resolve
func NewResolveInstanceKey ¶
NewResolveInstanceKey
func NewResolveInstanceKeyStrings ¶
func NewResolveInstanceKeyStrings(dbt string, hostname string, port string) (*dtstruct.InstanceKey, error)
NewResolveInstanceKeyStrings creates and resolves a new instance key based on string params
func ParseRawInstanceKey ¶
func ParseRawInstanceKey(dbt string, hostPort string) (instanceKey *dtstruct.InstanceKey, err error)
func ParseResolveInstanceKey ¶
func ParseResolveInstanceKey(dbt string, hostPort string) (instanceKey *dtstruct.InstanceKey, err error)
func PutInstanceTag ¶
func PutInstanceTag(instanceKey *dtstruct.InstanceKey, tag *dtstruct.Tag) (err error)
PutInstanceTag put new tag on given instance, if tag is exist, update its value and timestamp
func ReadActiveClusterRecovery ¶
func ReadActiveClusterRecovery(clusterName string) ([]*dtstruct.TopologyRecovery, error)
ReadActiveRecoveries reads active recovery entry/audit entries from topology_recovery
func ReadActiveMaintenance ¶
func ReadActiveMaintenance() ([]dtstruct.Maintenance, error)
ReadActiveMaintenance returns the list of currently active maintenance entries
func ReadActiveRecoveries ¶
func ReadActiveRecoveries() ([]*dtstruct.TopologyRecovery, error)
ReadActiveRecoveries reads active recovery entry/audit entries from topology_recovery
func ReadAliasByClusterName ¶
ReadAliasByClusterName returns the cluster alias for the given cluster name, or the cluster name itself if not explicit alias found
func ReadAllClusterInfo ¶
func ReadAllClusterInfo(dbt string, clusterName string) ([]dtstruct.ClusterInfo, error)
ReadAllClusterInfo reads names of all known clusters and some aggregated info
func ReadAllClusterPoolInstance ¶
func ReadAllClusterPoolInstance() ([]*dtstruct.ClusterPoolInstance, error)
ReadAllClusterPoolInstance returns all clusters-pools-instances associations
func ReadAllHostnameResolves ¶
func ReadAllHostnameResolves() ([]dtstruct.HostnameResolve, error)
ReadAllHostnameResolves
func ReadAllHostnameUnresolves ¶
func ReadAllHostnameUnresolves() ([]dtstruct.HostnameUnresolve, error)
ReadAllHostnameUnresolves returns the content of the ham_hostname_unresolved table
func ReadAllHostnameUnresolvesRegistrations ¶
func ReadAllHostnameUnresolvesRegistrations() (registrations []dtstruct.HostnameRegistration, err error)
ReadAllHostnameUnresolves returns the content of the ham_hostname_unresolved table
func ReadAllInstanceKeys ¶
func ReadAllInstanceKeys() ([]dtstruct.InstanceKey, error)
ReadAllInstanceKeys
func ReadBlockedRecoveries ¶
func ReadBlockedRecoveries(clusterName string) ([]dtstruct.BlockedTopologyRecovery, error)
ReadBlockedRecoveries reads blocked recovery entries, potentially filtered by cluster name (empty to unfilter)
func ReadClusterAliasOverride ¶
ReadClusterAliasOverride reads and applies SuggestedClusterAlias based on ham_cluster_alias_override
func ReadClusterInfo ¶
func ReadClusterInfo(dbt string, clusterName string) (*dtstruct.ClusterInfo, error)
ReadClusterInfo reads some info about a given cluster
func ReadClusterNameByAlias ¶
ReadClusterNameByAlias
func ReadClusterPoolInstance ¶
func ReadClusterPoolInstance(clusterName string, pool string) (result []*dtstruct.ClusterPoolInstance, err error)
ReadClusterPoolInstance reads cluster-pool-instance associations for given cluster and pool
func ReadClusterPoolInstancesMap ¶
func ReadClusterPoolInstancesMap(clusterName string, pool string) (*dtstruct.PoolInstancesMap, error)
ReadClusterPoolInstancesMap returns association of pools-to-instances for a given cluster and potentially for a given pool.
func ReadClusters ¶
ReadClusters reads names of all known clusters
func ReadCommaDelimitedList ¶
func ReadCommaDelimitedList(instKeyMap *dtstruct.InstanceKeyMap, dbt string, list string) error
ReadJson unmarshalls a json into this map
func ReadCompletedRecoveries ¶
func ReadCompletedRecoveries(page int) ([]*dtstruct.TopologyRecovery, error)
ReadCompletedRecoveries reads completed recovery entry/audit entries from topology_recovery
func ReadFailureDetection ¶
func ReadFailureDetection(detectionId int64) ([]*dtstruct.TopologyRecovery, error)
ReadFailureDetection
func ReadFuzzyInstanceKey ¶
func ReadFuzzyInstanceKey(fuzzyInstanceKey *dtstruct.InstanceKey) *dtstruct.InstanceKey
ReadFuzzyInstanceKey accepts a fuzzy instance key and expects to return a single, fully qualified, known instance key.
func ReadFuzzyInstanceKeyIfPossible ¶
func ReadFuzzyInstanceKeyIfPossible(fuzzyInstanceKey *dtstruct.InstanceKey) *dtstruct.InstanceKey
ReadFuzzyInstanceKeyIfPossible accepts a fuzzy instance key and hopes to return a single, fully qualified, known instance key, or else the original given key
func ReadHistoryClusterInstances ¶
func ReadHistoryClusterInstances(clusterName string, historyTimestampPattern string) ([](*dtstruct.Instance), error)
ReadHistoryClusterInstances reads (thin) instances from history
func ReadHostnameIPs ¶
readUnresolvedHostname reverse-reads hostname resolve. It returns a hostname which matches given pattern and resovles to resolvedHostname, or, in the event no such hostname is found, the given resolvedHostname, unchanged.
func ReadInActivePeriodClusterRecovery ¶
func ReadInActivePeriodClusterRecovery(clusterName string) ([]*dtstruct.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 *dtstruct.InstanceKey) ([]*dtstruct.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 ReadInstanceClusterAttributes ¶
func ReadInstanceClusterAttributes(instance dtstruct.InstanceAdaptor) (err error)
ReadInstanceClusterAttributes will return the cluster name for a given instance by looking at its master and getting it from there. It is a non-recursive function and so-called-recursion is performed upon periodic reading of instances.
func ReadInstancePromotionRule ¶
func ReadInstancePromotionRule(instance dtstruct.InstanceAdaptor) (err error)
func ReadInstanceTag ¶
func ReadInstanceTag(instanceKey *dtstruct.InstanceKey, tag *dtstruct.Tag) (tagExist bool, err error)
ReadInstanceTag check if tag is exist on given instance and update tag param value when exist
func ReadInstanceTags ¶
func ReadInstanceTags(instanceKey *dtstruct.InstanceKey) (tags []*dtstruct.Tag, err error)
func ReadMaintenanceInstanceKey ¶
func ReadMaintenanceInstanceKey(maintenanceToken int64) (*dtstruct.InstanceKey, error)
ReadMaintenanceInstanceKey will return the instanceKey for active maintenance by maintenanceToken
func ReadRecentAudit ¶
ReadRecentAudit returns a list of audit entries order chronologically descending, using page number.
func ReadRecentFailureDetections ¶
func ReadRecentFailureDetections(dbType string, clusterAlias string, page int) ([]*dtstruct.TopologyRecovery, error)
ReadRecentFailureDetections
func ReadRecentRecoveries ¶
func ReadRecentRecoveries(dbType string, clusterName string, clusterAlias string, unacknowledgedOnly bool, page int) ([]*dtstruct.TopologyRecovery, error)
ReadCRecoveries reads latest recovery entries from topology_recovery
func ReadRecentlyActiveClusterRecovery ¶
func ReadRecentlyActiveClusterRecovery(dbt string, clusterName string) ([]*dtstruct.TopologyRecovery, error)
ReadRecentlyActiveClusterRecovery reads recently completed entries for a given cluster
func ReadRecentlyActiveInstanceRecovery ¶
func ReadRecentlyActiveInstanceRecovery(instanceKey *dtstruct.InstanceKey) ([]*dtstruct.TopologyRecovery, error)
ReadRecentlyActiveInstanceRecovery reads recently completed entries for a given instance
func ReadRecovery ¶
func ReadRecovery(recoveryId int64) ([]*dtstruct.TopologyRecovery, error)
ReadRecovery reads completed recovery entry/audit entries from topology_recovery
func ReadRecoveryByUID ¶
func ReadRecoveryByUID(recoveryUID string) ([]*dtstruct.TopologyRecovery, error)
ReadRecoveryByUID reads completed recovery entry/audit entries from topology_recovery
func ReadReplicationAnalysisChangelog ¶
func ReadReplicationAnalysisChangelog() (res []*dtstruct.ReplicationAnalysisChangelog, err error)
ReadReplicationAnalysisChangelog query all analysis change log and group by instance
func ReadResolvedHostname ¶
ReadResolvedHostname return the resolved hostname given a hostname, or empty if not exists
func ReadTopologyRecoverySteps ¶
func ReadTopologyRecoverySteps(recoveryUID string) ([]dtstruct.TopologyRecoveryStep, error)
ReadTopologyRecoverySteps reads recovery steps for a given recovery
func ReadUnambiguousSuggestedClusterAlias ¶
func ReadUnambiguousSuggestedClusterAlias() (result map[string]dtstruct.InstanceKey, err error)
ReadUnambiguousSuggestedClusterAlias reads potential master hostname:port who have suggested cluster aliases, where no one else shares said suggested cluster alias. Such hostname:port are likely true owners of the alias.
func ReadUnknownMasterHostnameResolves ¶
ReadUnknownMasterHostnameResolves will figure out the resolved hostnames of master-hosts which cannot be found. It uses the hostname_resolve_history table to heuristically guess the correct hostname (based on "this was the last time we saw this hostname and it resolves into THAT")
func ReadUnresolvedHostname ¶
readUnresolvedHostname reverse-reads hostname resolve. It returns a hostname which matches given pattern and resovles to resolvedHostname, or, in the event no such hostname is found, the given resolvedHostname, unchanged.
func ReadUnseenMasterKey ¶
func ReadUnseenMasterKey() (res []dtstruct.InstanceKey, err error)
ReadUnseenMasterKey will read list of masters that have never been seen, and yet whose replicas seem to be replicating.
func RecordStaleInstanceBinlogCoordinates ¶
func RecordStaleInstanceBinlogCoordinates(instanceKey *dtstruct.InstanceKey, binlogCoordinates *dtstruct.LogCoordinates) error
RecordInstanceCoordinatesHistory snapshots the binlog coordinates of instances
func RegisterBlockedRecoveries ¶
func RegisterBlockedRecoveries(analysisEntry *dtstruct.ReplicationAnalysis, blockingRecoveries []*dtstruct.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 RegisterCandidateInstance ¶
func RegisterCandidateInstance(candidate *dtstruct.CandidateDatabaseInstance) error
RegisterCandidateInstance markes a given instance as suggested for successoring a master in the event of failover.
func RegisterHostnameUnresolve ¶
func RegisterHostnameUnresolve(registration *dtstruct.HostnameRegistration) (err error)
func ReplaceAliasClusterName ¶
ReplaceAliasClusterName replaces alis mapping of one cluster name onto a new cluster name. Used in topology failover/recovery
func ReplaceClusterName ¶
ReplaceClusterName replaces all occurances of oldClusterName with newClusterName It is called after a master failover
func ResetHostnameResolveCache ¶
func ResetHostnameResolveCache() error
func ResolveHostname ¶
ResolveHostname Attempt to resolve a hostname. This may return a database cached hostname or otherwise it may resolve the hostname via CNAME
func ResolveHostnameForInstanceKey ¶
func ResolveHostnameForInstanceKey(instanceKey *dtstruct.InstanceKey) (*dtstruct.InstanceKey, error)
func ResolveHostnameIPs ¶
func ResolveRecovery ¶
func ResolveRecovery(topologyRecovery *dtstruct.TopologyRecovery, successorInstance dtstruct.InstanceAdaptor) 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 ResolveUnknownMasterHostnameResolves ¶
func ResolveUnknownMasterHostnameResolves() error
ResolveUnknownMasterHostnameResolves 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 SetGeneralAttribute ¶
SetGeneralAttribute sets an attribute not associated with a host. Its a key-value thing
func SetHostAttribute ¶
SetHostAttribute save the attribute name and value to database
func SetRecoveryDisabled ¶
func SnapshotTopologies ¶
func SnapshotTopologies() error
SnapshotTopologies records topology graph for all existing topologies
func UnresolveHostname ¶
func UnresolveHostname(instanceKey *dtstruct.InstanceKey, f func(*dtstruct.InstanceKey) (dtstruct.InstanceAdaptor, error)) (dtstruct.InstanceKey, bool, error)
func Untag ¶
func Untag(instanceKey *dtstruct.InstanceKey, tag *dtstruct.Tag) (tagged *dtstruct.InstanceKeyMap, err error)
Untag delete tag from given instance, return all instance with tag
func UpdateClusterAliases ¶
func UpdateClusterAliases() error
UpdateClusterAliases writes down the cluster_alias table based on information gained from ham_database_instance
func UpdateInstanceClusterName ¶
func UpdateInstanceClusterName(instance dtstruct.InstanceAdaptor) error
UpdateInstanceClusterName update instance cluster name.
func UpdateInstanceLastAttemptedCheck ¶
func UpdateInstanceLastAttemptedCheck(instanceKey *dtstruct.InstanceKey) error
UpdateInstanceLastAttemptedCheck updates the last_attempted_check timestamp in the ham4db 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_timestamp is *newer* than last_checked_timestamp, that's bad news and means we have a "hanging" issue.
func UpdateInstanceLastChecked ¶
func UpdateInstanceLastChecked(instanceKey *dtstruct.InstanceKey, partialSuccess bool) error
UpdateInstanceLastChecked updates the last_check timestamp in the ham4db backed database for a given instance
func UpdateInstanceRoleAndState ¶
func UpdateInstanceRoleAndState(instanceKey *dtstruct.InstanceKey, role, state string) error
UpdateInstanceRoleAndState updates the role and state in the ham4db backed database for a given instance
func UpdateResolvedHostname ¶
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 WithCurrentTime ¶
func WithCurrentTime(cdi *dtstruct.CandidateDatabaseInstance) *dtstruct.CandidateDatabaseInstance
WithCurrentTime reads and returns the current timestamp as string. This is an unfortunate workaround
// to support both MySQL and SQLite in all possible timezones. SQLite only speaks UTC where MySQL has // timezone support. By reading the time as string we get the database's de-facto notion of the time, // which we can then feed back to it.
func WriteClusterAlias ¶
WriteClusterAlias will write (and override) a single cluster name mapping
func WriteClusterAliasManualOverride ¶
WriteClusterAliasManualOverride will write (and override) a single cluster name mapping
func WriteClusterDomainName ¶
WriteClusterDomainName will write (and override) the domain name of a cluster
func WriteHostnameIPs ¶
writeHostnameIPs stroes an ipv4 and ipv6 associated witha hostname, if available
func WriteHostnameUnresolve ¶
func WriteHostnameUnresolve(instanceKey *dtstruct.InstanceKey, unresolvedHostname string) error
WriteHostnameUnresolve upserts an entry in hostname_unresolve
func WriteMasterPositionEquivalence ¶
func WriteMasterPositionEquivalence(master1Key *dtstruct.InstanceKey, master1BinlogCoordinates *dtstruct.LogCoordinates, master2Key *dtstruct.InstanceKey, master2BinlogCoordinates *dtstruct.LogCoordinates) error
func WritePoolInstance ¶
func WritePoolInstance(pool string, instKeyList []*dtstruct.InstanceKey) error
WritePoolInstance will write (and override) a single cluster name mapping
func WriteResolveRecovery ¶
func WriteResolveRecovery(topologyRecovery *dtstruct.TopologyRecovery) error
func WriteResolvedHostname ¶
WriteResolvedHostname stores a hostname and the resolved hostname to backend database
func WriteTopologyRecovery ¶
func WriteTopologyRecovery(topologyRecovery *dtstruct.TopologyRecovery) (*dtstruct.TopologyRecovery, error)
func WriteTopologyRecoveryStep ¶
func WriteTopologyRecoveryStep(topologyRecoveryStep *dtstruct.TopologyRecoveryStep) error
WriteTopologyRecoveryStep writes down a single step in a recovery process
Types ¶
This section is empty.
Source Files ¶
- analysis_dao.go
- attributes_dao.go
- audit_dao.go
- base_dao.go
- candidate_database_instance_dao.go
- cluster.go
- cluster_alias_dao.go
- cluster_domain_dao.go
- http.go
- instance_dao.go
- instance_key.go
- maintenance_dao.go
- master_equivalence_dao.go
- pool_dao.go
- process.go
- raft.go
- recovery.go
- resolve_dao.go
- tag_dao.go