Documentation ¶
Index ¶
- Constants
- Variables
- func IsMariaDB(version string) bool
- type Checker
- func NewMySQLBinlogEnableChecker(db *sql.DB, dbinfo *dbutil.DBConfig) Checker
- func NewMySQLBinlogFormatChecker(db *sql.DB, dbinfo *dbutil.DBConfig) Checker
- func NewMySQLBinlogRowImageChecker(db *sql.DB, dbinfo *dbutil.DBConfig) Checker
- func NewMySQLServerIDChecker(db *sql.DB, dbinfo *dbutil.DBConfig) Checker
- func NewMySQLVersionChecker(db *sql.DB, dbinfo *dbutil.DBConfig) Checker
- func NewShardingTablesCheck(name string, dbs map[string]*sql.DB, tables map[string]map[string][]string, ...) Checker
- func NewSourceDumpPrivilegeChecker(db *sql.DB, dbinfo *dbutil.DBConfig) Checker
- func NewSourceReplicationPrivilegeChecker(db *sql.DB, dbinfo *dbutil.DBConfig) Checker
- func NewTablesChecker(db *sql.DB, dbinfo *dbutil.DBConfig, tables map[string][]string, ...) Checker
- type MySQLBinlogEnableChecker
- type MySQLBinlogFormatChecker
- type MySQLBinlogRowImageChecker
- type MySQLServerIDChecker
- type MySQLVersion
- type MySQLVersionChecker
- type Result
- type ResultSummary
- type Results
- type ShardingTablesCheck
- type SourceDumpPrivilegeChecker
- type SourceReplicatePrivilegeChecker
- type State
- type TablesChecker
Constants ¶
const AutoIncrementKeyChecking = "auto-increment key checking"
AutoIncrementKeyChecking is an identification for auto increment key checking
Variables ¶
var MaxVersion = MySQLVersion{math.MaxUint8, math.MaxUint8, math.MaxUint8}
MaxVersion define a maximum version
var MinVersion = MySQLVersion{0, 0, 0}
MinVersion define a mininum version
var SupportedVersion = map[string]struct { Min MySQLVersion Max MySQLVersion }{ "mysql": { MySQLVersion{5, 6, 0}, MaxVersion, }, "mariadb": { MySQLVersion{10, 1, 2}, MaxVersion, }, }
SupportedVersion defines the MySQL/MariaDB version that DM/syncer supports * 5.6.0 <= MySQL Version * 10.1.2 <= Mariadb Version
Functions ¶
Types ¶
type Checker ¶
Checker is interface that defines checker to check configurations of system. It is mainly used for configuration checking of data synchronization between database systems.
func NewMySQLBinlogEnableChecker ¶
NewMySQLBinlogEnableChecker returns a Checker.
func NewMySQLBinlogFormatChecker ¶
NewMySQLBinlogFormatChecker returns a Checker.
func NewMySQLBinlogRowImageChecker ¶
NewMySQLBinlogRowImageChecker returns a Checker
func NewMySQLServerIDChecker ¶
NewMySQLServerIDChecker returns a Checker
func NewMySQLVersionChecker ¶
NewMySQLVersionChecker returns a Checker
func NewShardingTablesCheck ¶
func NewShardingTablesCheck(name string, dbs map[string]*sql.DB, tables map[string]map[string][]string, mapping map[string]*column.Mapping, checkAutoIncrementPrimaryKey bool, enableANSIQuotes bool) Checker
NewShardingTablesCheck returns a Checker
func NewSourceDumpPrivilegeChecker ¶
NewSourceDumpPrivilegeChecker returns a Checker.
func NewSourceReplicationPrivilegeChecker ¶
NewSourceReplicationPrivilegeChecker returns a Checker.
type MySQLBinlogEnableChecker ¶
type MySQLBinlogEnableChecker struct {
// contains filtered or unexported fields
}
MySQLBinlogEnableChecker checks whether `log_bin` variable is enabled in MySQL.
func (*MySQLBinlogEnableChecker) Check ¶
func (pc *MySQLBinlogEnableChecker) Check(ctx context.Context) *Result
Check implements the Checker interface.
func (*MySQLBinlogEnableChecker) Name ¶
func (pc *MySQLBinlogEnableChecker) Name() string
Name implements the Checker interface.
type MySQLBinlogFormatChecker ¶
type MySQLBinlogFormatChecker struct {
// contains filtered or unexported fields
}
MySQLBinlogFormatChecker checks mysql binlog_format.
func (*MySQLBinlogFormatChecker) Check ¶
func (pc *MySQLBinlogFormatChecker) Check(ctx context.Context) *Result
Check implements the Checker interface.
func (*MySQLBinlogFormatChecker) Name ¶
func (pc *MySQLBinlogFormatChecker) Name() string
Name implements the Checker interface.
type MySQLBinlogRowImageChecker ¶
type MySQLBinlogRowImageChecker struct {
// contains filtered or unexported fields
}
MySQLBinlogRowImageChecker checks mysql binlog_row_image
func (*MySQLBinlogRowImageChecker) Check ¶
func (pc *MySQLBinlogRowImageChecker) Check(ctx context.Context) *Result
Check implements the Checker interface. 'binlog_row_image' is introduced since mysql 5.6.2, and mariadb 10.1.6. > In MySQL 5.5 and earlier, full row images are always used for both before images and after images. So we need check 'binlog_row_image' after mysql 5.6.2 version and mariadb 10.1.6. ref: - https://dev.mysql.com/doc/refman/5.6/en/replication-options-binary-log.html#sysvar_binlog_row_image - https://mariadb.com/kb/en/library/replication-and-binary-log-server-system-variables/#binlog_row_image
func (*MySQLBinlogRowImageChecker) Name ¶
func (pc *MySQLBinlogRowImageChecker) Name() string
Name implements the Checker interface.
type MySQLServerIDChecker ¶
type MySQLServerIDChecker struct {
// contains filtered or unexported fields
}
MySQLServerIDChecker checks mysql/mariadb server ID.
func (*MySQLServerIDChecker) Check ¶
func (pc *MySQLServerIDChecker) Check(ctx context.Context) *Result
Check implements the Checker interface.
func (*MySQLServerIDChecker) Name ¶
func (pc *MySQLServerIDChecker) Name() string
Name implements the Checker interface.
type MySQLVersion ¶
type MySQLVersion [3]uint
MySQLVersion represents MySQL version number.
func (MySQLVersion) String ¶
func (v MySQLVersion) String() string
String implements the Stringer interface.
type MySQLVersionChecker ¶
type MySQLVersionChecker struct {
// contains filtered or unexported fields
}
MySQLVersionChecker checks mysql/mariadb/rds,... version.
func (*MySQLVersionChecker) Check ¶
func (pc *MySQLVersionChecker) Check(ctx context.Context) *Result
Check implements the Checker interface. we only support version >= 5.6
func (*MySQLVersionChecker) Name ¶
func (pc *MySQLVersionChecker) Name() string
Name implements the Checker interface.
type Result ¶
type Result struct { ID uint64 `json:"id"` Name string `json:"name"` Desc string `json:"desc"` State State `json:"state"` ErrorMsg string `json:"errorMsg"` Instruction string `json:"instruction"` Extra string `json:"extra"` }
Result is result of check
type ResultSummary ¶
type ResultSummary struct { Passed bool `json:"passed"` Total int64 `json:"total"` Successful int64 `json:"successful"` Failed int64 `json:"failed"` Warning int64 `json:"warning"` }
ResultSummary is summary of all check results
type Results ¶
type Results struct { Results []*Result `json:"results"` Summary *ResultSummary `json:"summary"` }
Results contains all check results and summary
type ShardingTablesCheck ¶
type ShardingTablesCheck struct {
// contains filtered or unexported fields
}
ShardingTablesCheck checks consistency of table structures of one sharding group * check whether they have same column list * check whether they have auto_increment key
func (*ShardingTablesCheck) Check ¶
func (c *ShardingTablesCheck) Check(ctx context.Context) *Result
Check implements Checker interface
func (*ShardingTablesCheck) Name ¶
func (c *ShardingTablesCheck) Name() string
Name implements Checker interface
type SourceDumpPrivilegeChecker ¶
type SourceDumpPrivilegeChecker struct {
// contains filtered or unexported fields
}
SourceDumpPrivilegeChecker checks dump privileges of source DB.
func (*SourceDumpPrivilegeChecker) Check ¶
func (pc *SourceDumpPrivilegeChecker) Check(ctx context.Context) *Result
Check implements the Checker interface. We only check RELOAD, SELECT privileges.
func (*SourceDumpPrivilegeChecker) Name ¶
func (pc *SourceDumpPrivilegeChecker) Name() string
Name implements the Checker interface.
type SourceReplicatePrivilegeChecker ¶
type SourceReplicatePrivilegeChecker struct {
// contains filtered or unexported fields
}
SourceReplicatePrivilegeChecker checks replication privileges of source DB.
func (*SourceReplicatePrivilegeChecker) Check ¶
func (pc *SourceReplicatePrivilegeChecker) Check(ctx context.Context) *Result
Check implements the Checker interface. We only check REPLICATION SLAVE, REPLICATION CLIENT privileges.
func (*SourceReplicatePrivilegeChecker) Name ¶
func (pc *SourceReplicatePrivilegeChecker) Name() string
Name implements the Checker interface.
type TablesChecker ¶
type TablesChecker struct {
// contains filtered or unexported fields
}
TablesChecker checks compatibility of table structures, there are differences between MySQL and TiDB. In generally we need to check definitions of columns, constraints and table options. Because of the early TiDB engineering design, we did not have a complete list of check items, which are all based on experience now.
func (*TablesChecker) Check ¶
func (c *TablesChecker) Check(ctx context.Context) *Result
Check implements Checker interface
func (*TablesChecker) Name ¶
func (c *TablesChecker) Name() string
Name implements Checker interface