gtids

package
v0.0.0-...-c4b68aa Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2025 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

gtid.go

Index

Constants

This section is empty.

Variables

View Source
var (
	Db1 *sql.DB
	Db2 *sql.DB
	Err error
)

Functions

func CheckGtidSetSubset

func CheckGtidSetSubset(db1 *sql.DB, db2 *sql.DB, source string, target string, fix bool, fixReplica bool)

function to check the GTID set subset issue and fix it if the -fix flag is set

func ConnectToDatabase

func ConnectToDatabase(source string, target string)

ConnectToDatabase connects to the source and target Host(s) database at the same time.

func ConnectToDatabaseWithPort

func ConnectToDatabaseWithPort(source string, sourcePort string, target string, targetPort string)

ConnectToDatabaseWithPort connects to the source and target Host(s) database with custom ports.

func ReadMyCnf

func ReadMyCnf()

ReadMyCnf reads the ~/.my.cnf file to get the database credentials

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 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 (ogs *OracleGtidSet) Explode() (result [](*OracleGtidSetEntry))

String returns a user-friendly string representation of this entry

func (*OracleGtidSet) IsEmpty

func (ogs *OracleGtidSet) IsEmpty() bool

func (*OracleGtidSet) RemoveUUID

func (ogs *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 (ogs *OracleGtidSet) RetainUUID(uuid string) (anythingRemoved bool)

RetainUUID retains only entries that belong to given UUID.

func (*OracleGtidSet) RetainUUIDs

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

RetainUUIDs retains only entries that belong to given UUIDs.

func (*OracleGtidSet) SharedUUIDs

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

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

func (*OracleGtidSet) String

func (ogs *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 (oge *OracleGtidSetEntry) Explode() (result [](*OracleGtidSetEntry))

String returns a user-friendly string representation of this entry

func (*OracleGtidSetEntry) String

func (oge *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