Documentation ¶
Index ¶
- Variables
- func AddSuffixForUUID(uuid string, ID int) string
- func CompareBinlogPos(a, b mysql.Position, deviation float64) int
- func CompareShardingDDLs(s, t []string) bool
- func DecodeBinlogPosition(pos string) (*mysql.Position, error)
- func Decrypt(ciphertextB64 string) (string, error)
- func DecryptOrPlaintext(ciphertextB64 string) string
- func Encrypt(plaintext string) (string, error)
- func ExtractTable(name string) (string, string, error)
- func FetchAllDoTables(db *sql.DB, bw *filter.Filter) (map[string][]string, error)
- func FetchTargetDoTables(db *sql.DB, bw *filter.Filter, router *router.Table) (map[string][]*filter.Table, error)
- func GenFakeRotateEvent(nextLogName string, logPos uint64, serverID uint32) (*replication.BinlogEvent, error)
- func GenHashKey(key string) uint32
- func GenTableKey(schema, table string) string
- func GetAllServerID(ctx context.Context, db *sql.DB) (map[uint32]struct{}, error)
- func GetFileSize(file string) (int64, error)
- func GetFlavor(ctx context.Context, db *sql.DB) (string, error)
- func GetGlobalVariable(db *sql.DB, variable string) (value string, err error)
- func GetMariaDBGTID(db *sql.DB) (gtid.Set, error)
- func GetMariaDBGtidDomainID(db *sql.DB) (uint32, error)
- func GetMariaDBUUID(db *sql.DB) (string, error)
- func GetMasterStatus(db *sql.DB, flavor string) (gmysql.Position, gtid.Set, error)
- func GetParser(db *sql.DB, ansiQuotesMode bool) (*parser.Parser, error)
- func GetRawInfo() string
- func GetSQLMode(db *sql.DB) (tmysql.SQLMode, error)
- func GetServerID(db *sql.DB) (uint32, error)
- func GetServerUUID(db *sql.DB, flavor string) (string, error)
- func GetSlaveServerID(ctx context.Context, db *sql.DB) (map[uint32]struct{}, error)
- func GetSuffixUUID(indexPath, uuid string) (string, error)
- func GetUUIDBySuffix(uuids []string, suffix string) string
- func HasAnsiQuotesMode(db *sql.DB) (bool, error)
- func IsBuildInSkipDDL(sql string) bool
- func IsContextCanceledError(err error) bool
- func IsDirExists(name string) bool
- func IsErrBinlogPurged(err error) bool
- func IsFileExists(name string) bool
- func IsMySQLError(err error, code uint16) bool
- func IsNoSuchThreadError(err error) bool
- func JoinProcessErrors(errors []*pb.ProcessError) string
- func KillConn(db *sql.DB, connID uint32) error
- func ParseMetaData(filename string) (*mysql.Position, error)
- func ParseSuffixForUUID(uuid string) (string, int, error)
- func ParseUUIDIndex(indexPath string) ([]string, error)
- func PrintInfo(app string, callback func())
- func PrintInfo2(app string)
- func SuffixIntToStr(ID int) string
- func TrimCtrlChars(s string) string
- func TruncateInterface(v interface{}, n int) string
- func TruncateString(s string, n int) string
- func WaitSomething(backoff int, waitTime time.Duration, fn func() bool) bool
- type StorageSize
Constants ¶
This section is empty.
Variables ¶
var ( ReleaseVersion = "None" BuildTS = "None" GitHash = "None" GitBranch = "None" GoVersion = "None" )
Version information.
var ( UUIDIndexFilename = "server-uuid.index" MetaFilename = "relay.meta" )
not support to config yet
var ( // OsExit is function placeholder for os.Exit OsExit func(int) )
Functions ¶
func AddSuffixForUUID ¶
AddSuffixForUUID adds a suffix for UUID
func CompareBinlogPos ¶
CompareBinlogPos compares binlog positions. The result will be 0 if |a-b| < deviation, otherwise -1 if a < b, and +1 if a > b.
func CompareShardingDDLs ¶
CompareShardingDDLs compares s and t ddls only concern in content, ignore order of ddl
func DecodeBinlogPosition ¶
DecodeBinlogPosition parses a mysql.Position from string format
func DecryptOrPlaintext ¶ added in v1.0.6
DecryptOrPlaintext tries to decrypt base64 encoded ciphertext to plaintext or return plaintext
func ExtractTable ¶
ExtractTable extracts schema and table from `schema`.`table`
func FetchAllDoTables ¶
FetchAllDoTables returns all need to do tables after filtered (fetches from upstream MySQL)
func FetchTargetDoTables ¶
func FetchTargetDoTables(db *sql.DB, bw *filter.Filter, router *router.Table) (map[string][]*filter.Table, error)
FetchTargetDoTables returns all need to do tables after filtered and routed (fetches from upstream MySQL)
func GenFakeRotateEvent ¶
func GenFakeRotateEvent(nextLogName string, logPos uint64, serverID uint32) (*replication.BinlogEvent, error)
GenFakeRotateEvent generates a fake ROTATE_EVENT without checksum ref: https://github.com/mysql/mysql-server/blob/4f1d7cf5fcb11a3f84cff27e37100d7295e7d5ca/sql/rpl_binlog_sender.cc#L855
func GenTableKey ¶
GenTableKey generates a key for table
func GetAllServerID ¶ added in v1.0.2
GetAllServerID gets all slave server id and master server id
func GetFileSize ¶
GetFileSize return the size of the file.
func GetGlobalVariable ¶
GetGlobalVariable gets server's global variable
func GetMariaDBGTID ¶
GetMariaDBGTID gets MariaDB's `gtid_binlog_pos` it can not get by `SHOW MASTER STATUS`
func GetMariaDBGtidDomainID ¶
GetMariaDBGtidDomainID gets MariaDB server's `gtid_domain_id`
func GetMariaDBUUID ¶
GetMariaDBUUID gets equivalent `server_uuid` for MariaDB `gtid_domain_id` joined `server_id` with domainServerIDSeparator
func GetMasterStatus ¶
GetMasterStatus gets status from master
func GetServerID ¶
GetServerID gets server's `server_id`
func GetServerUUID ¶
GetServerUUID gets server's `server_uuid`
func GetSlaveServerID ¶ added in v1.0.2
GetSlaveServerID gets all slave server id
func GetSuffixUUID ¶
GetSuffixUUID gets UUID (with suffix) by UUID (without suffix) when multi UUIDs (without suffix) are the same, the newest will be return
func GetUUIDBySuffix ¶
GetUUIDBySuffix gets UUID from uuids by suffix
func HasAnsiQuotesMode ¶
HasAnsiQuotesMode checks whether database has `ANSI_QUOTES` set
func IsBuildInSkipDDL ¶ added in v1.0.3
IsBuildInSkipDDL return true when checked sql that will be skipped for syncer
func IsContextCanceledError ¶ added in v1.0.3
IsContextCanceledError checks whether err is context.Canceled
func IsErrBinlogPurged ¶
IsErrBinlogPurged checks whether err is BinlogPurged error
func IsMySQLError ¶
IsMySQLError checks whether err is MySQLError error
func IsNoSuchThreadError ¶
IsNoSuchThreadError checks whether err is NoSuchThreadError
func JoinProcessErrors ¶ added in v1.0.4
func JoinProcessErrors(errors []*pb.ProcessError) string
JoinProcessErrors return the string of pb.ProcessErrors joined by ", "
func ParseMetaData ¶
ParseMetaData parses mydumper's output meta file and returns binlog position
func ParseSuffixForUUID ¶
ParseSuffixForUUID parses UUID (with suffix) to (UUID without suffix, suffix) pair
func ParseUUIDIndex ¶
ParseUUIDIndex parses server-uuid.index
func PrintInfo ¶
func PrintInfo(app string, callback func())
PrintInfo prints some information of the app, like git hash, binary build time, etc.
func SuffixIntToStr ¶
SuffixIntToStr convert int-represented suffix to string-represented
func TrimCtrlChars ¶
TrimCtrlChars returns a slice of the string s with all leading and trailing control characters removed.
func TruncateInterface ¶
TruncateInterface converts the interface to a string and returns a string with only the leading (at most) n runes of the input string. If the converted string is truncated, a `...` tail will be appended. It is not effective for large structure now.
func TruncateString ¶
TruncateString returns a string with only the leading (at most) n runes of the input string. If the string is truncated, a `...` tail will be appended.
Types ¶
type StorageSize ¶
StorageSize represents the storage's capacity and available size Learn from tidb-binlog source code.
func GetStorageSize ¶
func GetStorageSize(dir string) (size StorageSize, err error)
GetStorageSize gets storage's capacity and available size