ham

package
v0.0.0-...-6b32d26 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2021 License: Apache-2.0 Imports: 38 Imported by: 0

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.

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.

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.

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.

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

Constants

This section is empty.

Variables

View Source
var GroupReplicationNotSupportedErrors = map[uint16]bool{

	1193: true,
	1146: true,
}

We use this map to identify whether the query failed because the server does not support group replication or due to a different reason.

View Source
var ReadTopologyInstanceCounter = metrics.NewCounter()

var accessDeniedCounter = metrics.NewCounter()

Functions

func CanReplicateFrom

func CanReplicateFrom(fst dtstruct.InstanceAdaptor, thr dtstruct.InstanceAdaptor) (bool, error)

CanReplicateFrom uses heursitics to decide whether this instacne can practically replicate from other instance. Checks are made to binlog format, version number, binary logs etc.

func CategorizeReplication

func CategorizeReplication(topologyRecovery *dtstruct.TopologyRecovery, failedInstanceKey *dtstruct.InstanceKey, promotedRepIsIdeal func(dtstruct.InstanceAdaptor, bool) bool) (aheadReplicas, equalReplicas, laterReplicas, cannotReplicateReplicas []*mdtstruct.MysqlInstance, promotedReplica *mdtstruct.MysqlInstance, err error)

func ChangeMasterCredentials

func ChangeMasterCredentials(instanceKey *dtstruct.InstanceKey, creds *dtstruct.ReplicationCredentials) (*mdtstruct.MysqlInstance, error)

ChangeMasterCredentials issues a CHANGE MASTER TO... MASTER_USER=, MASTER_PASSWORD=...

func ChangeMasterTo

func ChangeMasterTo(instanceKey *dtstruct.InstanceKey, masterKey *dtstruct.InstanceKey, masterBinlogCoordinates *dtstruct.LogCoordinates, skipUnresolve bool, gtidHint mconstant.OperationGTIDHint) (*mdtstruct.MysqlInstance, error)

ChangeMasterTo changes the given instance's master according to given input.

func CheckAndInjectPseudoGTIDOnWriter

func CheckAndInjectPseudoGTIDOnWriter(instance *dtstruct.MysqlInstance) (injected bool, err error)

CheckAndInjectPseudoGTIDOnWriter checks whether pseudo-GTID can and should be injected on given instance, and if so, attempts to inject.

func CheckAndRecoverDeadMaster

func CheckAndRecoverDeadMaster(analysisEntry dtstruct.ReplicationAnalysis, candidateInstanceKey *dtstruct.InstanceKey, forceInstanceRecovery bool, skipProcesses bool) (recoveryAttempted bool, topologyRecovery *dtstruct.TopologyRecovery, err error)

checkAndRecoverDeadMaster checks a given analysis, decides whether to take action, and possibly takes action Returns true when action was taken.

func CheckAndRecoverGenericProblem

func CheckAndRecoverGenericProblem(analysisEntry dtstruct.ReplicationAnalysis, candidateInstanceKey *dtstruct.InstanceKey, forceInstanceRecovery bool, skipProcesses bool) (bool, *dtstruct.TopologyRecovery, error)

CheckAndRecoverGenericProblem is a general-purpose recovery function

func CheckMaxScale

func CheckMaxScale(instance *mdtstruct.MysqlInstance, sdb *sql.DB, latency *stopwatch.NamedStopwatch) (isMaxScale bool, resolvedHostname string, err error)

Check if the instance is a MaxScale binlog server (a proxy not a real MySQL server) and also update the resolved hostname

func CheckMoveViaGTID

func CheckMoveViaGTID(instance, otherInstance *mdtstruct.MysqlInstance) (err error)

func ContinuousDiscovery

func ContinuousDiscovery()

func CorrelateBinlogCoordinates

func CorrelateBinlogCoordinates(instance *mdtstruct.MysqlInstance, binlogCoordinates *dtstruct.LogCoordinates, otherInstance *mdtstruct.MysqlInstance) (*dtstruct.LogCoordinates, int, error)

CorrelateBinlogCoordinates find out, if possible, the binlog coordinates of given otherInstance that correlate with given coordinates of given instance.

func CorrelateRelaylogCoordinates

func CorrelateRelaylogCoordinates(instance *mdtstruct.MysqlInstance, relaylogCoordinates *dtstruct.LogCoordinates, otherInstance *mdtstruct.MysqlInstance) (instanceCoordinates, correlatedCoordinates, nextCoordinates *dtstruct.LogCoordinates, found bool, err error)

func DelayReplication

func DelayReplication(instanceKey *dtstruct.InstanceKey, seconds int) error

DelayReplication set the replication delay given seconds keeping the current state of the replication threads.

func DetachMaster

func DetachMaster(instanceKey *dtstruct.InstanceKey) (*mdtstruct.MysqlInstance, error)

DetachMaster detaches a replica from its master by corrupting the Master_Host (in such way that is reversible)

func DisableGTID

func DisableGTID(instanceKey *dtstruct.InstanceKey) (*mdtstruct.MysqlInstance, error)

DisableGTID will attempt to disable GTID-mode (either Oracle or MariaDB) and revert to binlog file:pos replication

func EmptyCommitInstance

func EmptyCommitInstance(instanceKey *dtstruct.InstanceKey) error

func EnableGTID

func EnableGTID(instanceKey *dtstruct.InstanceKey) (*mdtstruct.MysqlInstance, error)

EnableGTID will attempt to enable GTID-mode (either Oracle or MariaDB)

func EnableMasterSSL

func EnableMasterSSL(instanceKey *dtstruct.InstanceKey) (*mdtstruct.MysqlInstance, error)

EnableMasterSSL issues CHANGE MASTER TO MASTER_SSL=1

func EnableSemiSync

func EnableSemiSync(instanceKey *dtstruct.InstanceKey, master, replica bool) error

EnableSemiSync sets the rpl_semi_sync_(master|replica)_enabled variables on a given instance.

func ErrantGTIDInjectEmpty

func ErrantGTIDInjectEmpty(instanceKey *dtstruct.InstanceKey) (instance *mdtstruct.MysqlInstance, clusterMaster *mdtstruct.MysqlInstance, countInjectedTransactions int64, err error)

ErrantGTIDInjectEmpty will inject an empty transaction on the master of an instance's cluster in order to get rid of an errant transaction observed on the instance.

func ErrantGTIDResetMaster

func ErrantGTIDResetMaster(instanceKey *dtstruct.InstanceKey) (instance *mdtstruct.MysqlInstance, err error)

ErrantGTIDResetMaster will issue a safe RESET MASTER on a replica that replicates via GTID: It will make sure the gtid_purged set matches the executed set value as read just before the RESET. this will enable new replicas to be attached to given instance without complaints about missing/purged entries. This function requires that the instance does not have replicas.

func ExecSQLOnInstance

func ExecSQLOnInstance(instanceKey *dtstruct.InstanceKey, query string, args ...interface{}) (sql.Result, error)

func ExpireInjectedPseudoGTID

func ExpireInjectedPseudoGTID() error

ExpireInjectedPseudoGTID

func FindLastPseudoGTIDEntry

func FindLastPseudoGTIDEntry(instance *mdtstruct.MysqlInstance, recordedInstanceRelayLogCoordinates dtstruct.LogCoordinates, maxBinlogCoordinates *dtstruct.LogCoordinates, exhaustiveSearch bool, expectedBinlogFormat *string) (instancePseudoGtidCoordinates *dtstruct.LogCoordinates, instancePseudoGtidText string, err error)

FindLastPseudoGTIDEntry will search an instance's binary logs or relay logs for the last pseudo-GTID entry, and return found coordinates as well as entry text

func FlushBinaryLogs

func FlushBinaryLogs(instanceKey *dtstruct.InstanceKey, count int) (*mdtstruct.MysqlInstance, error)

FlushBinaryLogs attempts a 'FLUSH BINARY LOGS' statement on the given instance.

func FlushBinaryLogsTo

func FlushBinaryLogsTo(instanceKey *dtstruct.InstanceKey, logFile string) (*mdtstruct.MysqlInstance, error)

FlushBinaryLogsTo attempts to 'FLUSH BINARY LOGS' until given binary log is reached

func ForceAnalysisEntry

func ForceAnalysisEntry(clusterName string, analysisCode dtstruct.AnalysisCode, commandHint string, failedInstanceKey *dtstruct.InstanceKey) (analysisEntry dtstruct.ReplicationAnalysis, err error)

func ForgetInstance

func ForgetInstance(instanceKey *dtstruct.InstanceKey) error

ForgetInstance delete instance from table

func GTIDSubtract

func GTIDSubtract(instanceKey *dtstruct.InstanceKey, gtidSet string, gtidSubset string) (gtidSubtract string, err error)

func GetCandidateReplica

func GetCandidateReplica(masterKey *dtstruct.InstanceKey, forRematchPurposes bool) (*mdtstruct.MysqlInstance, []*mdtstruct.MysqlInstance, []*mdtstruct.MysqlInstance, []*mdtstruct.MysqlInstance, []*mdtstruct.MysqlInstance, error)

GetCandidateReplica chooses the best replica to promote given a (possibly dead) master

func GetCandidateReplicaOfBinlogServerTopology

func GetCandidateReplicaOfBinlogServerTopology(masterKey *dtstruct.InstanceKey) (candidateReplica *mdtstruct.MysqlInstance, err error)

GetCandidateReplicaOfBinlogServerTopology chooses the best replica to promote given a (possibly dead) master

func GetCandidateSiblingOfIntermediateMaster

func GetCandidateSiblingOfIntermediateMaster(topologyRecovery *dtstruct.TopologyRecovery, intermediateMasterInstance *mdtstruct.MysqlInstance) (*mdtstruct.MysqlInstance, error)

GetCandidateSiblingOfIntermediateMaster chooses the best sibling of a dead intermediate master to whom the IM's replicas can be moved.

func GetCheckAndRecoverFunction

func GetCheckAndRecoverFunction(analysisCode dtstruct.AnalysisCode, analyzedInstanceKey *dtstruct.InstanceKey) (
	checkAndRecoverFunction func(analysisEntry dtstruct.ReplicationAnalysis, candidateInstanceKey *dtstruct.InstanceKey, forceInstanceRecovery bool, skipProcesses bool) (recoveryAttempted bool, topologyRecovery *dtstruct.TopologyRecovery, err error),
	isActionableRecovery bool,
)

func GetClusterHeuristicLag

func GetClusterHeuristicLag(clusterName string) (int64, error)

GetClusterHeuristicLag returns a heuristic lag for a cluster, based on its OSC replicas

func GetClusterOSCReplicas

func GetClusterOSCReplicas(clusterName string) ([]*mdtstruct.MysqlInstance, error)

GetClusterOSCReplicas returns a heuristic list of replicas which are fit as controll replicas for an OSC operation. These would be intermediate masters

func GetEquivalentBinlogCoordinatesFor

func GetEquivalentBinlogCoordinatesFor(instanceCoordinates *dtstruct.InstanceBinlogCoordinates, belowKey *dtstruct.InstanceKey) (*dtstruct.LogCoordinates, error)

func GetEquivalentMasterCoordinates

func GetEquivalentMasterCoordinates(instanceCoordinates *dtstruct.InstanceBinlogCoordinates) (result [](*dtstruct.InstanceBinlogCoordinates), err error)

func GetHeuristiclyRecentCoordinatesForInstance

func GetHeuristiclyRecentCoordinatesForInstance(instanceKey *dtstruct.InstanceKey) (selfCoordinates *dtstruct.LogCoordinates, relayLogCoordinates *dtstruct.LogCoordinates, err error)

GetHeuristiclyRecentCoordinatesForInstance returns valid and reasonably recent coordinates for given instance.

func GetInfoFromInstance

func GetInfoFromInstance(instanceKey *dtstruct.InstanceKey, checkOnly, bufferWrites bool, latency *stopwatch.NamedStopwatch, agent string) (*mdtstruct.MysqlInstance, error)

func GetInstancesMaxLag

func GetInstancesMaxLag(instances []*mdtstruct.MysqlInstance) (maxLag int64, err error)

GetInstancesMaxLag returns the maximum lag in a set of instances

func GetLastExecutedEntryInRelayLogs

func GetLastExecutedEntryInRelayLogs(instance *mdtstruct.MysqlInstance, minBinlogCoordinates *dtstruct.LogCoordinates, recordedInstanceRelayLogCoordinates dtstruct.LogCoordinates) (binlogEvent *dtstruct.BinlogEvent, err error)

func GetMasterRecoveryType

func GetMasterRecoveryType(analysisEntry *dtstruct.ReplicationAnalysis) (masterRecoveryType dtstruct.RecoveryType)

func GetNextBinlogCoordinatesToMatch

func GetNextBinlogCoordinatesToMatch(
	instance *mdtstruct.MysqlInstance,
	instanceCoordinates dtstruct.LogCoordinates,
	recordedInstanceRelayLogCoordinates dtstruct.LogCoordinates,
	maxBinlogCoordinates *dtstruct.LogCoordinates,
	other *mdtstruct.MysqlInstance,
	otherCoordinates dtstruct.LogCoordinates) (*dtstruct.LogCoordinates, int, error)

GetNextBinlogCoordinatesToMatch is given a twin-coordinates couple for a would-be replica (instance) and another instance (other). This is part of the match-below process, and is the heart of the operation: matching the binlog events starting the twin-coordinates (where both share the same Pseudo-GTID) until "instance" runs out of entries, hopefully before "other" runs out. If "other" runs out that means "instance" is more advanced in replication than "other", in which case we can't turn it into a replica of "other".

func GetPreviousKnownRelayLogCoordinatesForInstance

func GetPreviousKnownRelayLogCoordinatesForInstance(instance *mdtstruct.MysqlInstance) (relayLogCoordinates *dtstruct.LogCoordinates, err error)

GetPreviousKnownRelayLogCoordinatesForInstance returns known relay log coordinates, that are not the exact current coordinates

func GetPriorityBinlogFormatForCandidate

func GetPriorityBinlogFormatForCandidate(replicas [](*mdtstruct.MysqlInstance)) (priorityBinlogFormat string, err error)

getPriorityBinlogFormatForCandidate returns the primary (most common) binlog format found among given instances. This will be used for choosing best candidate for promotion.

func GetPriorityMajorVersionForCandidate

func GetPriorityMajorVersionForCandidate(replicas []*mdtstruct.MysqlInstance) (priorityMajorVersion string, err error)

GetPriorityMajorVersionForCandidate returns the primary (most common) major version found among given instances. This will be used for choosing best candidate for promotion.

func GetReplicationAnalysis

func GetReplicationAnalysis(clusterName, clusterId string, hints *dtstruct.ReplicationAnalysisHints) ([]dtstruct.ReplicationAnalysis, error)

GetReplicationAnalysis will check for replication problems (dead master; unreachable master; etc)

func GetReplicationRestartPreserveStatements

func GetReplicationRestartPreserveStatements(instanceKey *dtstruct.InstanceKey, injectedStatement string) (statements []string, err error)

GetReplicationRestartPreserveStatements returns a sequence of statements that make sure a replica is stopped and then returned to the same state. For example, if the replica was fully running, this will issue a STOP on both io_thread and sql_thread, followed by START on both. If one of them is not running at the time this function is called, said thread will be neither stopped nor started. The caller may provide an injected statememt, to be executed while the replica is stopped. This is useful for CHANGE MASTER TO commands, that unfortunately must take place while the replica is completely stopped.

func GetSortedReplicas

func GetSortedReplicas(masterKey *dtstruct.InstanceKey, stopReplicationMethod gconstant.StopReplicationMethod) (replicas [](*mdtstruct.MysqlInstance), err error)

GetSortedReplicas reads list of replicas of a given master, and returns them sorted by exec coordinates (most up-to-date replica first).

func GracefulMasterTakeover

func GracefulMasterTakeover(clusterName string, designatedKey *dtstruct.InstanceKey, auto bool) (topologyRecovery *dtstruct.TopologyRecovery, promotedMasterCoordinates *dtstruct.LogCoordinates, 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. It will point old master at the newly promoted master at the correct coordinates, but will not start replication.

func InjectPseudoGTIDOnWriters

func InjectPseudoGTIDOnWriters() error

InjectPseudoGTIDOnWriters will inject a PseudoGTID entry on all writable, accessible, supported writers.

func IsInEmergencyOperationGracefulPeriod

func IsInEmergencyOperationGracefulPeriod(instanceKey *dtstruct.InstanceKey) bool

func IsInjectedPseudoGTID

func IsInjectedPseudoGTID(clusterName string) (injected bool, err error)

IsInjectedPseudoGTID reads from backend DB / cache

func IsSmallerBinlogFormat

func IsSmallerBinlogFormat(binlogFormat string, otherBinlogFormat string) bool

IsSmallerBinlogFormat tests two binlog formats and sees if one is "smaller" than the other. "smaller" binlog format means you can replicate from the smaller to the larger.

func KillQuery

func KillQuery(instanceKey *dtstruct.InstanceKey, process int64) (*mdtstruct.MysqlInstance, error)

KillQuery stops replication on a given instance

func Less

func LocateErrantGTID

func LocateErrantGTID(instanceKey *dtstruct.InstanceKey) (errantBinlogs []string, err error)

func MakeCoMaster

func MakeCoMaster(instanceKey *dtstruct.InstanceKey) (*mdtstruct.MysqlInstance, error)

MakeCoMaster will attempt to make an instance co-master with its master, by making its master a replica of its own. This only works out if the master is not replicating; the master does not have a known master (it may have an unknown master).

func MakeLocalMaster

func MakeLocalMaster(instanceKey *dtstruct.InstanceKey) (*mdtstruct.MysqlInstance, error)

func MakeMaster

func MakeMaster(instanceKey *dtstruct.InstanceKey) (*mdtstruct.MysqlInstance, error)

func MasterPosWait

func MasterPosWait(instanceKey *dtstruct.InstanceKey, binlogCoordinates *dtstruct.LogCoordinates) (*mdtstruct.MysqlInstance, error)

MasterPosWait issues a MASTER_POS_WAIT() an given instance according to given coordinates.

func MatchBelow

func MatchBelow(instanceKey, otherKey *dtstruct.InstanceKey, requireInstanceMaintenance bool) (*mdtstruct.MysqlInstance, *dtstruct.LogCoordinates, error)

func MatchUp

func MatchUp(instanceKey *dtstruct.InstanceKey, requireInstanceMaintenance bool) (*mdtstruct.MysqlInstance, *dtstruct.LogCoordinates, error)

MatchUp will move a replica up the replication chain, so that it becomes sibling of its master, via Pseudo-GTID

func MatchUpReplicas

func MatchUpReplicas(masterKey *dtstruct.InstanceKey, pattern string) ([](*mdtstruct.MysqlInstance), *mdtstruct.MysqlInstance, error, []error)

MatchUpReplicas will move all replicas of given master up the replication chain, so that they become siblings of their master. This should be called when the local master dies, and all its replicas are to be resurrected via Pseudo-GTID

func MoveBelow

func MoveBelow(instanceKey, siblingKey *dtstruct.InstanceKey) (*mdtstruct.MysqlInstance, error)

MoveBelow will attempt moving instance indicated by instanceKey below its supposed sibling indicated by sinblingKey. It will perform all safety and sanity checks and will tamper with this instance's replication as well as its sibling.

func MoveBelowGTID

func MoveBelowGTID(instanceKey, otherKey *dtstruct.InstanceKey) (*mdtstruct.MysqlInstance, error)

MoveBelowGTID will attempt moving instance indicated by instanceKey below another instance using either Oracle GTID or MariaDB GTID.

func MoveEquivalent

func MoveEquivalent(instanceKey, otherKey *dtstruct.InstanceKey) (*mdtstruct.MysqlInstance, error)

MoveEquivalent will attempt moving instance indicated by instanceKey below another instance, based on known master coordinates equivalence

func MoveReplicasGTID

func MoveReplicasGTID(masterKey *dtstruct.InstanceKey, belowKey *dtstruct.InstanceKey, pattern string) (movedReplicas [](*mdtstruct.MysqlInstance), unmovedReplicas [](*mdtstruct.MysqlInstance), err error, errs []error)

MoveReplicasGTID will (attempt to) move all replicas of given master below given instance.

func MoveUp

func MoveUp(instanceKey *dtstruct.InstanceKey) (*mdtstruct.MysqlInstance, error)

MoveUp will attempt moving instance indicated by instanceKey up the topology hierarchy. It will perform all safety and sanity checks and will tamper with this instance's replication as well as its master.

func MoveUpReplicas

func MoveUpReplicas(instanceKey *dtstruct.InstanceKey, pattern string) ([]*mdtstruct.MysqlInstance, *mdtstruct.MysqlInstance, error, []error)

MoveUpReplicas will attempt moving up all replicas of a given instance, at the same time. Clock-time, this is fater than moving one at a time. However this means all replicas of the given instance, and the instance itself, will all stop replicating together.

func MultiMatchBelow

func MultiMatchBelow(replicas [](*mdtstruct.MysqlInstance), belowKey *dtstruct.InstanceKey, postponedFunctionsContainer *dtstruct.PostponedFunctionsContainer) (matchedReplicas [](*mdtstruct.MysqlInstance), belowInstance *mdtstruct.MysqlInstance, err error, errs []error)

MultiMatchBelow will efficiently match multiple replicas below a given instance. It is assumed that all given replicas are siblings

func MultiMatchReplicas

func MultiMatchReplicas(masterKey *dtstruct.InstanceKey, belowKey *dtstruct.InstanceKey, pattern string) ([]*mdtstruct.MysqlInstance, *mdtstruct.MysqlInstance, error, []error)

MultiMatchReplicas will match (via pseudo-gtid) all replicas of given master below given instance.

func OpenTopology

func OpenTopology(host string, port int, args ...interface{}) (db *sql.DB, err error)

func PopulateGroupReplicationInformation

func PopulateGroupReplicationInformation(instance *mdtstruct.MysqlInstance, db *sql.DB) error

PopulateGroupReplicationInformation obtains information about Group Replication for this host as well as other hosts who are members of the same group (if any).

func PurgeBinaryLogsTo

func PurgeBinaryLogsTo(instanceKey *dtstruct.InstanceKey, logFile string, force bool) (*mdtstruct.MysqlInstance, error)

PurgeBinaryLogsTo attempts to 'PURGE BINARY LOGS' until given binary log is reached

func PurgeBinaryLogsToLatest

func PurgeBinaryLogsToLatest(instanceKey *dtstruct.InstanceKey, force bool) (*mdtstruct.MysqlInstance, error)

PurgeBinaryLogsToLatest attempts to 'PURGE BINARY LOGS' until latest binary log

func ReadBinlogEventAtRelayLogCoordinates

func ReadBinlogEventAtRelayLogCoordinates(instanceKey *dtstruct.InstanceKey, relaylogCoordinates *dtstruct.LogCoordinates) (binlogEvent *dtstruct.BinlogEvent, err error)

func ReadBinlogServerReplicaInstances

func ReadBinlogServerReplicaInstances(masterKey *dtstruct.InstanceKey) ([]*mdtstruct.MysqlInstance, error)

ReadBinlogServerReplicaInstances reads direct replicas of a given master that are binlog servers

func ReadClusterCandidateInstances

func ReadClusterCandidateInstances(clusterName string) ([]dtstruct.InstanceAdaptor, error)

ReadClusterCandidateInstances reads cluster instances which are also marked as candidates

func ReadClusterInstances

func ReadClusterInstances(clusterName string) ([]*mdtstruct.MysqlInstance, error)

ReadClusterInstances reads all instances of a given cluster

func ReadClusterInstancesByClusterIdOrHint

func ReadClusterInstancesByClusterIdOrHint(request *dtstruct.Request) ([]*mdtstruct.MysqlInstance, error)

ReadClusterInstancesByClusterIdOrHint reads all instances of a given cluster

func ReadClusterMaster

func ReadClusterMaster(clusterName string) ([]*mdtstruct.MysqlInstance, error)

ReadClusterMaster returns the master of this cluster. - if the cluster has co-masters, the/a writable one is returned - if the cluster has a single master, that master is retuened whether it is read-only or writable.

func ReadClusterNeutralPromotionRuleInstances

func ReadClusterNeutralPromotionRuleInstances(clusterName string) (neutralInstances []*mdtstruct.MysqlInstance, err error)

ReadClusterNeutralPromotionRuleInstances reads cluster instances whose promotion-rule is marked as 'neutral'

func ReadClusterWriteableMaster

func ReadClusterWriteableMaster(clusterName string) ([]*mdtstruct.MysqlInstance, error)

ReadClusterWriteableMaster returns the/a writeable master of this cluster Typically, the cluster name indicates the master of the cluster. However, in circular master-master replication one master can assume the name of the cluster, and it is not guaranteed that it is the writeable one.

func ReadFromBackendDB

func ReadFromBackendDB(instanceKey *dtstruct.InstanceKey) (*mdtstruct.MysqlInstance, bool, error)

ReadFromBackendDB reads an instance from the ham4db backend database

func ReadHistoryClusterInstances

func ReadHistoryClusterInstances(clusterName string, historyTimestampPattern string) ([]*mdtstruct.MysqlInstance, error)

ReadHistoryClusterInstances reads (thin) instances from history

func ReadHistoryClusterInstancesByClusterIdOrHint

func ReadHistoryClusterInstancesByClusterIdOrHint(request *dtstruct.Request, historyTimestampPattern string) ([]*mdtstruct.MysqlInstance, error)

ReadHistoryClusterInstances reads (thin) instances from history

func ReadInstancesByCondition

func ReadInstancesByCondition(query string, condition string, args []interface{}, sort string) ([]*mdtstruct.MysqlInstance, error)

ReadInstancesByCondition is a generic function to read instances from the backend database

func ReadReplicaInstances

func ReadReplicaInstances(masterKey *dtstruct.InstanceKey) ([]*mdtstruct.MysqlInstance, error)

ReadReplicaInstances reads replicas of a given master

func ReadReplicaInstancesIncludingBinlogServerSubReplicas

func ReadReplicaInstancesIncludingBinlogServerSubReplicas(masterKey *dtstruct.InstanceKey) ([]*mdtstruct.MysqlInstance, error)

ReadReplicaInstancesIncludingBinlogServerSubReplicas returns a list of direct slves including any replicas of a binlog server replica

func ReadReplicationCredentials

func ReadReplicationCredentials(instanceKey *dtstruct.InstanceKey) (creds *dtstruct.ReplicationCredentials, err error)

Attempt to read and return replication credentials from the mysql.slave_master_info system table

func ReadReplicationGroupPrimary

func ReadReplicationGroupPrimary(instance *mdtstruct.MysqlInstance) (err error)

func ReadUnseenInstances

func ReadUnseenInstances() ([]*mdtstruct.MysqlInstance, error)

ReadUnseenInstances reads all instances which were not recently seen

func ReadWriteableClustersMasters

func ReadWriteableClustersMasters() (instances []*mdtstruct.MysqlInstance, err error)

ReadWriteableClustersMasters returns writeable masters of all clusters, but only one per cluster, in similar logic to ReadClusterWriteableMaster

func ReattachMaster

func ReattachMaster(instanceKey *dtstruct.InstanceKey) (*mdtstruct.MysqlInstance, error)

ReattachMaster reattaches a replica back onto its master by undoing a DetachMaster operation

func RecordInstanceCoordinatesHistory

func RecordInstanceCoordinatesHistory() error

RecordInstanceCoordinatesHistory snapshots the binlog coordinates of instances

func RecoverDeadCoMaster

func RecoverDeadCoMaster(topologyRecovery *dtstruct.TopologyRecovery, skipProcesses bool) (promotedReplica *mdtstruct.MysqlInstance, lostReplicas [](*mdtstruct.MysqlInstance), err error)

RecoverDeadCoMaster recovers a dead co-master, complete logic inside

func RecoverDeadIntermediateMaster

func RecoverDeadIntermediateMaster(topologyRecovery *dtstruct.TopologyRecovery, skipProcesses bool) (successorInstance *mdtstruct.MysqlInstance, err error)

RecoverDeadIntermediateMaster performs intermediate master recovery; complete logic inside

func RecoverDeadMaster

func RecoverDeadMaster(topologyRecovery *dtstruct.TopologyRecovery, candidateInstanceKey *dtstruct.InstanceKey, skipProcesses bool) (recoveryAttempted bool, promotedReplica *mdtstruct.MysqlInstance, lostReplicas []*mdtstruct.MysqlInstance, err error)

recoverDeadMaster recovers a dead master, complete logic inside

func RecoverDeadMasterInBinlogServerTopology

func RecoverDeadMasterInBinlogServerTopology(topologyRecovery *dtstruct.TopologyRecovery) (promotedReplica *mdtstruct.MysqlInstance, err error)

func RecoverDeadReplicationGroupMemberWithReplicas

func RecoverDeadReplicationGroupMemberWithReplicas(topologyRecovery *dtstruct.TopologyRecovery, skipProcesses bool) (successorInstance *mdtstruct.MysqlInstance, err error)

RecoverDeadReplicationGroupMemberWithReplicas performs dead group member recovery. It does so by finding members of the same replication group of the one of the failed instance, picking a random one and relocating replicas to it.

func RegisterInjectedPseudoGTID

func RegisterInjectedPseudoGTID(clusterName string) error

RegisterInjectedPseudoGTID

func RegroupReplicas

func RegroupReplicas(masterKey *dtstruct.InstanceKey, returnReplicaEvenOnFailureToRegroup bool,
	onCandidateReplicaChosen func(handler dtstruct.InstanceAdaptor),
	postponedFunctionsContainer *dtstruct.PostponedFunctionsContainer) (

	aheadReplicas []*mdtstruct.MysqlInstance,
	equalReplicas []*mdtstruct.MysqlInstance,
	laterReplicas []*mdtstruct.MysqlInstance,
	cannotReplicateReplicas []*mdtstruct.MysqlInstance,
	instance *mdtstruct.MysqlInstance,
	err error,
)

RegroupReplicas is a "smart" method of promoting one replica over the others ("promoting" it on top of its siblings) This method decides which strategy to use: GTID, Pseudo-GTID, Binlog Servers.

func RegroupReplicasBinlogServers

func RegroupReplicasBinlogServers(masterKey *dtstruct.InstanceKey, returnReplicaEvenOnFailureToRegroup bool) (repointedBinlogServers []*mdtstruct.MysqlInstance, promotedBinlogServer *mdtstruct.MysqlInstance, err error)

RegroupReplicasBinlogServers works on a binlog-servers topology. It picks the most up-to-date BLS and repoints all other BLS below it

func RegroupReplicasGTID

func RegroupReplicasGTID(
	masterKey *dtstruct.InstanceKey,
	returnReplicaEvenOnFailureToRegroup bool,
	onCandidateReplicaChosen func(handler dtstruct.InstanceAdaptor),
	postponedFunctionsContainer *dtstruct.PostponedFunctionsContainer,
	postponeAllMatchOperations func(dtstruct.InstanceAdaptor, bool) bool,
) (
	lostReplicas []*mdtstruct.MysqlInstance,
	movedReplicas []*mdtstruct.MysqlInstance,
	cannotReplicateReplicas []*mdtstruct.MysqlInstance,
	candidateReplica *mdtstruct.MysqlInstance,
	err error,
)

RegroupReplicasGTID will choose a candidate replica of a given instance, and take its siblings using GTID

func RegroupReplicasPseudoGTID

func RegroupReplicasPseudoGTID(
	masterKey *dtstruct.InstanceKey,
	returnReplicaEvenOnFailureToRegroup bool,
	onCandidateReplicaChosen func(handler dtstruct.InstanceAdaptor),
	postponedFunctionsContainer *dtstruct.PostponedFunctionsContainer,
	postponeAllMatchOperations func(dtstruct.InstanceAdaptor, bool) bool,
) (
	aheadReplicas []*mdtstruct.MysqlInstance,
	equalReplicas []*mdtstruct.MysqlInstance,
	laterReplicas []*mdtstruct.MysqlInstance,
	cannotReplicateReplicas []*mdtstruct.MysqlInstance,
	candidateReplica *mdtstruct.MysqlInstance,
	err error,
)

RegroupReplicasPseudoGTID will choose a candidate replica of a given instance, and take its siblings using pseudo-gtid

func RegroupReplicasPseudoGTIDIncludingSubReplicasOfBinlogServers

func RegroupReplicasPseudoGTIDIncludingSubReplicasOfBinlogServers(
	masterKey *dtstruct.InstanceKey,
	returnReplicaEvenOnFailureToRegroup bool,
	onCandidateReplicaChosen func(handler dtstruct.InstanceAdaptor),
	postponedFunctionsContainer *dtstruct.PostponedFunctionsContainer,
	postponeAllMatchOperations func(dtstruct.InstanceAdaptor, bool) bool,
) (
	aheadReplicas []*mdtstruct.MysqlInstance,
	equalReplicas []*mdtstruct.MysqlInstance,
	laterReplicas []*mdtstruct.MysqlInstance,
	cannotReplicateReplicas []*mdtstruct.MysqlInstance,
	candidateReplica *mdtstruct.MysqlInstance,
	err error,
)

RegroupReplicasPseudoGTIDIncludingSubReplicasOfBinlogServers uses Pseugo-GTID to regroup replicas of given instance. The function also drill in to replicas of binlog servers that are replicating from given instance, and other recursive binlog servers, as long as they're in the same binlog-server-family.

func RelocateBelow

func RelocateBelow(instanceKey, otherKey *dtstruct.InstanceKey) (interface{}, error)

RelocateBelow will attempt moving instance indicated by instanceKey below another instance. will try and figure out the best way to relocate the server. This could span normal binlog-position, pseudo-gtid, repointing, binlog servers...

func RelocateReplicas

func RelocateReplicas(instanceKey, otherKey *dtstruct.InstanceKey, pattern string) (replicas []*mdtstruct.MysqlInstance, other *mdtstruct.MysqlInstance, err error, errs []error)

RelocateReplicas will attempt moving replicas of an instance indicated by instanceKey below another instance. will try and figure out the best way to relocate the servers. This could span normal binlog-position, pseudo-gtid, repointing, binlog servers...

func RematchReplica

func RematchReplica(instanceKey *dtstruct.InstanceKey, requireInstanceMaintenance bool) (*mdtstruct.MysqlInstance, *dtstruct.LogCoordinates, error)

RematchReplica will re-match a replica to its master, using pseudo-gtid

func ReplacePromotedReplicaWithCandidate

func ReplacePromotedReplicaWithCandidate(topologyRecovery *dtstruct.TopologyRecovery, deadInstanceKey *dtstruct.InstanceKey, promotedReplica dtstruct.InstanceAdaptor, candidateInstanceKey *dtstruct.InstanceKey) (dtstruct.InstanceAdaptor, error)

replacePromotedReplicaWithCandidate is called after a master (or co-master) died and was replaced by some promotedReplica. But, is there an even better replica to promote? if candidateInstanceKey is given, then it is forced to be promoted over the promotedReplica Otherwise, search for the best to promote!

func ReplicationConfirm

func ReplicationConfirm(failedKey *dtstruct.InstanceKey, streamKey *dtstruct.InstanceKey, upstream bool) bool

ReplicationConfirm

func Repoint

func Repoint(instanceKey *dtstruct.InstanceKey, masterKey *dtstruct.InstanceKey, gtidHint constant.OperationGTIDHint) (*mdtstruct.MysqlInstance, error)

Repoint connects a replica to a master using its exact same executing coordinates. The given masterKey can be null, in which case the existing master is used. Two use cases: - masterKey is nil: use case is corrupted relay logs on replica - masterKey is not nil: using Binlog servers (coordinates remain the same)

func RepointReplicas

func RepointReplicas(instanceKey *dtstruct.InstanceKey, pattern string) ([]*mdtstruct.MysqlInstance, error, []error)

RepointReplicas repoints all replicas of a given instance onto its existing master.

func RepointReplicasTo

func RepointReplicasTo(instanceKey *dtstruct.InstanceKey, pattern string, belowKey *dtstruct.InstanceKey) ([]*mdtstruct.MysqlInstance, error, []error)

RepointReplicasTo repoints replicas of a given instance (possibly filtered) onto another master. Binlog Server is the major use case

func RepointTo

func RepointTo(replicas []*mdtstruct.MysqlInstance, belowKey *dtstruct.InstanceKey) ([]*mdtstruct.MysqlInstance, error, []error)

RepointTo repoints list of replicas onto another master. Binlog Server is the major use case

func ResetInstanceRelaylogCoordinatesHistory

func ResetInstanceRelaylogCoordinatesHistory(instanceKey *dtstruct.InstanceKey) error

ResetInstanceRelaylogCoordinatesHistory forgets about the history of an instance. This action is desirable when relay logs become obsolete or irrelevant. Such is the case on `CHANGE MASTER TO`: servers gets compeltely new relay logs.

func ResetMaster

func ResetMaster(instanceKey *dtstruct.InstanceKey) (*mdtstruct.MysqlInstance, error)

ResetMaster issues a RESET MASTER statement on given instance. Use with extreme care!

func ResetReplication

func ResetReplication(instanceKey *dtstruct.InstanceKey) (*mdtstruct.MysqlInstance, error)

ResetReplication resets a replica, breaking the replication

func ResetReplicationOperation

func ResetReplicationOperation(instanceKey *dtstruct.InstanceKey) (*mdtstruct.MysqlInstance, error)

ResetReplicationOperation will reset a replica

func RestartReplication

func RestartReplication(instanceKey *dtstruct.InstanceKey) (inst interface{}, err error)

RestartReplication stops & starts replication on a given instance

func RestartReplicationQuick

func RestartReplicationQuick(instanceKey *dtstruct.InstanceKey) error

func RetryInstanceFunction

func RetryInstanceFunction(f func() (*mdtstruct.MysqlInstance, error)) (instance *mdtstruct.MysqlInstance, err error)

func RowToInstance

func RowToInstance(m sqlutil.RowMap) *mdtstruct.MysqlInstance

readInstanceRow reads a single instance row from the ham4db backend database.

func RunEmergentOperations

func RunEmergentOperations(analysisEntry *dtstruct.ReplicationAnalysis)

func ScanInstanceRow

func ScanInstanceRow(instanceKey *dtstruct.InstanceKey, query string, dest ...interface{}) error

func SearchEntryInBinlog

func SearchEntryInBinlog(pseudoGTIDRegexp *regexp.Regexp, instanceKey *dtstruct.InstanceKey, binlog string, entryText string, monotonicPseudoGTIDEntries bool, minBinlogCoordinates *dtstruct.LogCoordinates) (dtstruct.LogCoordinates, bool, error)

SearchEntryInBinlog Given a binlog entry text (query), search it in the given binary log of a given instance

func SearchEntryInInstanceBinlogs

func SearchEntryInInstanceBinlogs(instance *mdtstruct.MysqlInstance, entryText string, monotonicPseudoGTIDEntries bool, minBinlogCoordinates *dtstruct.LogCoordinates) (*dtstruct.LogCoordinates, error)

SearchEntryInInstanceBinlogs will search for a specific text entry within the binary logs of a given instance.

func SearchEventInRelayLogs

func SearchEventInRelayLogs(searchEvent *dtstruct.BinlogEvent, instance *mdtstruct.MysqlInstance, minBinlogCoordinates *dtstruct.LogCoordinates, recordedInstanceRelayLogCoordinates dtstruct.LogCoordinates) (binlogCoordinates, nextCoordinates *dtstruct.LogCoordinates, found bool, err error)

func SetReadOnly

func SetReadOnly(instanceKey *dtstruct.InstanceKey, readOnly bool) (*mdtstruct.MysqlInstance, error)

SetReadOnly sets or clears the instance's global read_only variable

func SetSemiSyncMaster

func SetSemiSyncMaster(instanceKey *dtstruct.InstanceKey, enableMaster bool) (*mdtstruct.MysqlInstance, error)

func SetSemiSyncReplica

func SetSemiSyncReplica(instanceKey *dtstruct.InstanceKey, enableReplica bool) (*mdtstruct.MysqlInstance, error)

func SetupTopologyTLS

func SetupTopologyTLS(uri string) (string, error)

Create a TLS configuration from the config supplied CA, Certificate, and Private key. Register the TLS config with the mysql drivers as the "topology" config Modify the supplied URI to call the TLS config

func ShouldPostponeRelocatingReplica

func ShouldPostponeRelocatingReplica(replica *mdtstruct.MysqlInstance, postponedFunctionsContainer *dtstruct.PostponedFunctionsContainer) bool

func ShowBinaryLogs

func ShowBinaryLogs(instanceKey *dtstruct.InstanceKey) (binlogs []string, err error)

func ShowMasterStatus

func ShowMasterStatus(instanceKey *dtstruct.InstanceKey) (masterStatusFound bool, executedGtidSet string, err error)

func SkipQuery

func SkipQuery(instanceKey *dtstruct.InstanceKey) (*mdtstruct.MysqlInstance, error)

SkipQuery skip a single query in a failed replication instance

func SkipToNextBinaryLog

func SkipToNextBinaryLog(instanceKey *dtstruct.InstanceKey) (*mdtstruct.MysqlInstance, error)

SkipToNextBinaryLog changes master position to beginning of next binlog USE WITH CARE! Use case is binlog servers where the master was gone & replaced by another.

func SortInstancesDataCenterHint

func SortInstancesDataCenterHint(instances []*mdtstruct.MysqlInstance, dataCenterHint string)

sortInstances shuffles given list of instances according to some logic

func SortedReplicasDataCenterHint

func SortedReplicasDataCenterHint(replicas []*mdtstruct.MysqlInstance, stopReplicationMethod cconstant.StopReplicationMethod, dataCenterHint string) []*mdtstruct.MysqlInstance

sortedReplicas returns the list of replicas of some master, sorted by exec coordinates (most up-to-date replica first). This function assumes given `replicas` argument is indeed a list of instances all replicating from the same master (the result of `getReplicasForSorting()` is appropriate)

func StartReplication

func StartReplication(ctx context.Context, instanceKey *dtstruct.InstanceKey) (*mdtstruct.MysqlInstance, error)

StartReplication starts replication on a given instance.

func StartReplicationUntilMasterCoordinates

func StartReplicationUntilMasterCoordinates(instanceKey *dtstruct.InstanceKey, masterCoordinates *dtstruct.LogCoordinates) (*mdtstruct.MysqlInstance, error)

StartReplicationUntilMasterCoordinates issuesa START SLAVE UNTIL... statement on given instance

func StopReplicas

func StopReplicas(replicas []*mdtstruct.MysqlInstance, stopReplicationMethod cconstant.StopReplicationMethod, timeout time.Duration) []*mdtstruct.MysqlInstance

StopReplicas will stop replication concurrently on given set of replicas. It will potentially do nothing, or attempt to stop _nicely_ or just stop normally, all according to stopReplicationMethod

func StopReplication

func StopReplication(instanceKey *dtstruct.InstanceKey) (*mdtstruct.MysqlInstance, error)

func StopReplicationNicely

func StopReplicationNicely(instanceKey *dtstruct.InstanceKey, timeout time.Duration) (*mdtstruct.MysqlInstance, error)

StopReplicationNicely stops a replica such that SQL_thread and IO_thread are aligned (i.e. SQL_thread consumes all relay log entries) It will actually START the sql_thread even if the replica is completely stopped.

func SuggestReplacementForPromotedReplica

func SuggestReplacementForPromotedReplica(topologyRecovery *dtstruct.TopologyRecovery, deadInstanceKey *dtstruct.InstanceKey, promotedReplica dtstruct.InstanceAdaptor, candidateInstanceKey *dtstruct.InstanceKey) (replacement dtstruct.InstanceAdaptor, actionRequired bool, err error)

SuggestReplacementForPromotedReplica returns a server to take over the already promoted replica, if such server is found and makes an improvement over the promoted replica.

func TLSCheck

func TLSCheck(uri string) bool

func TakeMaster

func TakeMaster(instanceKey *dtstruct.InstanceKey, allowTakingCoMaster bool) (*mdtstruct.MysqlInstance, error)

TakeMaster will move an instance up the chain and cause its master to become its replica. It's almost a role change, just that other replicas of either 'instance' or its master are currently unaffected (they continue replicate without change) Note that the master must itself be a replica; however the grandparent does not necessarily have to be reachable and can in fact be dead.

func TakeMasterHook

func TakeMasterHook(successor *mdtstruct.MysqlInstance, demoted *mdtstruct.MysqlInstance)

Created this function to allow a hook to be called after a successful TakeMaster event

func TakeSiblings

func TakeSiblings(instanceKey *dtstruct.InstanceKey) (instance *mdtstruct.MysqlInstance, takenSiblings int, err error)

TakeSiblings is a convenience method for turning siblings of a replica to be its subordinates. This operation is a syntatctic sugar on top relocate-replicas, which uses any available means to the objective: GTID, Pseudo-GTID, binlog servers, standard replication...

func Topology

func Topology(request *dtstruct.Request, historyTimestampPattern string, tabulated bool, printTags bool) (result interface{}, err error)

Topology returns a string representation of the topology of given cluster.

func ValidateInstanceIsFound

func ValidateInstanceIsFound(instanceKey *dtstruct.InstanceKey) *mdtstruct.MysqlInstance

func WaitForExecBinlogCoordinatesToReach

func WaitForExecBinlogCoordinatesToReach(instanceKey *dtstruct.InstanceKey, coordinates *dtstruct.LogCoordinates, maxWait time.Duration) (instance *mdtstruct.MysqlInstance, exactMatch bool, err error)

func WaitForReplicationState

func WaitForReplicationState(instanceKey *dtstruct.InstanceKey, expectedState mdtstruct.ReplicationThreadState) (expectationMet bool, err error)

WaitForReplicationState waits for both replication threads to be either running or not running, together. This is useful post- `start slave` operation, ensuring both threads are actually running, or post `stop slave` operation, ensuring both threads are not running.

func WaitForSQLThreadUpToDate

func WaitForSQLThreadUpToDate(instanceKey *dtstruct.InstanceKey, overallTimeout time.Duration, staleCoordinatesTimeout time.Duration) (instance *mdtstruct.MysqlInstance, err error)

func WriteToBackendDB

func WriteToBackendDB(instances []dtstruct.InstanceAdaptor, instanceWasActuallyFound bool, updateLastSeen bool) error

Types

type OracleGtidSet

type OracleGtidSet struct {
	GtidEntries [](*OracleGtidSetEntry)
}

OracleGtidSet represents a set of GTID ranges as depicted by Retrieved_Gtid_Set, Executed_Gtid_Set or @@gtid_purged.

func GetPreviousGTIDs

func GetPreviousGTIDs(instanceKey *dtstruct.InstanceKey, binlog string) (previousGTIDs *OracleGtidSet, err error)

func NewOracleGtidSet

func NewOracleGtidSet(gtidSet string) (res *OracleGtidSet, err error)

Example input: `230ea8ea-81e3-11e4-972a-e25ec4bd140a:1-10539, 316d193c-70e5-11e5-adb2-ecf4bb2262ff:1-8935:8984-6124596, 321f5c0d-70e5-11e5-adb2-ecf4bb2262ff:1-56`

func (*OracleGtidSet) Explode

func (this *OracleGtidSet) Explode() (result [](*OracleGtidSetEntry))

String returns a user-friendly string representation of this entry

func (*OracleGtidSet) IsEmpty

func (this *OracleGtidSet) IsEmpty() bool

func (*OracleGtidSet) RemoveUUID

func (this *OracleGtidSet) RemoveUUID(uuid string) (removed bool)

RemoveUUID removes entries that belong to given UUID. By way of how this works there can only be one entry matching our UUID, but we generalize. We keep order of entries.

func (*OracleGtidSet) RetainUUID

func (this *OracleGtidSet) RetainUUID(uuid string) (anythingRemoved bool)

RetainUUID retains only entries that belong to given UUID.

func (*OracleGtidSet) RetainUUIDs

func (this *OracleGtidSet) RetainUUIDs(uuids []string) (anythingRemoved bool)

RetainUUIDs retains only entries that belong to given UUIDs.

func (*OracleGtidSet) SharedUUIDs

func (this *OracleGtidSet) SharedUUIDs(other *OracleGtidSet) (shared []string)

SharedUUIDs returns UUIDs (range-less) that are shared between the two sets

func (*OracleGtidSet) String

func (this *OracleGtidSet) String() string

type OracleGtidSetEntry

type OracleGtidSetEntry struct {
	UUID   string
	Ranges string
}

OracleGtidSetEntry represents an entry in a set of GTID ranges, for example, the entry: "316d193c-70e5-11e5-adb2-ecf4bb2262ff:1-8935:8984-6124596" (may include gaps)

func NewOracleGtidSetEntry

func NewOracleGtidSetEntry(gtidRangeString string) (*OracleGtidSetEntry, error)

NewOracleGtidSetEntry parses a single entry text

func (*OracleGtidSetEntry) Explode

func (this *OracleGtidSetEntry) Explode() (result [](*OracleGtidSetEntry))

String returns a user-friendly string representation of this entry

func (*OracleGtidSetEntry) String

func (this *OracleGtidSetEntry) String() string

String returns a user-friendly string representation of this entry

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL