Documentation ¶
Index ¶
- Constants
- Variables
- func CompareGTID(gSet1, gSet2 gmysql.GTIDSet) (int, bool)
- func CompareLocation(location1, location2 Location, cmpGTID bool) int
- func ComparePosition(pos1, pos2 gmysql.Position) int
- func ExtractPos(pos gmysql.Position, uuids []string) (uuidWithSuffix string, relaySubDirSuffix string, realPos gmysql.Position, ...)
- func ExtractSuffix(name string) (int, error)
- func IsFreshPosition(location Location, flavor string, cmpGTID bool) bool
- func NewLocalBinlogPosFinder(tctx *tcontext.Context, enableGTID bool, flavor string, relayDir string) *binlogPosFinder
- func NewRemoteBinlogPosFinder(tctx *tcontext.Context, db *conn.BaseDB, ...) *binlogPosFinder
- func PositionFromPosStr(str string) (gmysql.Position, error)
- func PositionFromStr(s string) (gmysql.Position, error)
- func ReadSortedBinlogFromDir(dirpath string) ([]string, error)
- func RealMySQLPos(pos gmysql.Position) (gmysql.Position, error)
- func RemoveRelaySubDirSuffix(pos gmysql.Position) gmysql.Position
- func VerifyBinlogPos(pos string) (*gmysql.Position, error)
- type FileSizes
- type Location
- func (l Location) Clone() Location
- func (l Location) CloneWithFlavor(flavor string) Location
- func (l *Location) CopyWithoutSuffixFrom(from Location)
- func (l Location) GTIDSetStr() string
- func (l *Location) GetGTID() gmysql.GTIDSet
- func (l *Location) ResetSuffix()
- func (l *Location) SetGTID(gset gmysql.GTIDSet) error
- func (l Location) String() string
- func (l *Location) Update(gtidStr string) error
- type PosType
- type SourceStatus
Constants ¶
const ( // MinRelaySubDirSuffix is same as relay.MinRelaySubDirSuffix. MinRelaySubDirSuffix = 1 // FileHeaderLen is the length of binlog file header. FileHeaderLen = 4 )
const FakeBinlogName = "start-task with --start-time"
FakeBinlogName is used to bypass the checking of meta in task config when start-task with --start-time.
Variables ¶
var MinPosition = gmysql.Position{Pos: 4}
MinPosition is the min binlog position.
Functions ¶
func CompareGTID ¶
CompareGTID returns:
1, true if gSet1 is bigger than gSet2 0, true if gSet1 is equal to gSet2 -1, true if gSet1 is less than gSet2
but if can't compare gSet1 and gSet2, will returns 0, false.
func CompareLocation ¶
CompareLocation returns:
1 if point1 is bigger than point2 0 if point1 is equal to point2 -1 if point1 is less than point2
func ComparePosition ¶
ComparePosition returns:
1 if pos1 is bigger than pos2 0 if pos1 is equal to pos2 -1 if pos1 is less than pos2
func ExtractPos ¶
func ExtractPos(pos gmysql.Position, uuids []string) (uuidWithSuffix string, relaySubDirSuffix string, realPos gmysql.Position, err error)
ExtractPos extracts (uuidWithSuffix, RelaySubDirSuffix, originalPos) from input position (originalPos or convertedPos). nolint:nakedret
func ExtractSuffix ¶
ExtractSuffix extracts RelaySubDirSuffix from input name.
func IsFreshPosition ¶
IsFreshPosition returns true when location1 is a fresh location without any info.
func NewLocalBinlogPosFinder ¶
func NewRemoteBinlogPosFinder ¶
func NewRemoteBinlogPosFinder(tctx *tcontext.Context, db *conn.BaseDB, syncCfg replication.BinlogSyncerConfig, enableGTID bool) *binlogPosFinder
func PositionFromPosStr ¶
PositionFromPosStr constructs a mysql.Position from a string representation like `(mysql-bin.000001, 2345)`.
func PositionFromStr ¶
PositionFromStr constructs a mysql.Position from a string representation like `mysql-bin.000001:2345`.
func ReadSortedBinlogFromDir ¶
ReadSortedBinlogFromDir reads and returns all binlog files (sorted ascending by binlog filename and sequence number).
func RealMySQLPos ¶
RealMySQLPos parses a relay position and returns a mysql position and whether error occurs if parsed successfully and `RelaySubDirSuffix` in binlog filename exists, sets position Name to `originalPos.BinlogBaseName + binlogFilenameSep + originalPos.BinlogSeq`. if parsed failed returns the given position and the traced error.
func RemoveRelaySubDirSuffix ¶
RemoveRelaySubDirSuffix removes relay dir suffix from binlog filename of a position. for example: mysql-bin|000001.000002 -> mysql-bin.000002.
Types ¶
type FileSizes ¶
type FileSizes []binlogSize
FileSizes is a list of binlog filename and size.
func GetBinaryLogs ¶
GetBinaryLogs returns binlog filename and size of upstream.
func GetLocalBinaryLogs ¶
type Location ¶
type Location struct { // a structure represents the file offset in binlog file Position gmysql.Position // used to distinguish injected events by DM when it's not 0 Suffix int // contains filtered or unexported fields }
Location identifies the location of binlog events.
func MustZeroLocation ¶
MustZeroLocation returns a new Location. The flavor must not be empty. in DM the flavor is adjusted before write to etcd.
func NewLocation ¶
NewLocation creates a new Location from given binlog position and GTID.
func ZeroLocation ¶
ZeroLocation returns a new Location. The flavor should not be empty.
func (Location) CloneWithFlavor ¶
CloneWithFlavor clones the location, and if the GTIDSet is nil, will create a GTIDSet with specified flavor.
func (*Location) CopyWithoutSuffixFrom ¶
CopyWithoutSuffixFrom copies a same Location without suffix. Note that gtidSet is shared.
func (Location) GTIDSetStr ¶
GTIDSetStr returns gtid set's string.
func (*Location) GetGTID ¶
GetGTID return gtidSet of Location. NOTE: for most cases you should clone before call Update on the returned GTID set, unless you know there's no other reference using the GTID set.