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 NewSourcePrivilegeChecker(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 SourcePrivilegeChecker
- type State
- type TablesChecker
Constants ¶
const AutoIncrementKeyChecking = "auto-increment key checking"
AutoIncrementKeyChecking is an identification for auto increment key checking
Variables ¶
var MinVersion = [3]uint{5, 5, 0}
MinVersion is mysql minimal version required
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) Checker
NewShardingTablesCheck returns a Checker
func NewSourcePrivilegeChecker ¶
NewSourcePrivilegeChecker 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) IsAtLeast ¶
func (v MySQLVersion) IsAtLeast(min MySQLVersion) bool
IsAtLeast means v >= min
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.5
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 SourcePrivilegeChecker ¶
type SourcePrivilegeChecker struct {
// contains filtered or unexported fields
}
SourcePrivilegeChecker checks data source privileges.
func (*SourcePrivilegeChecker) Check ¶
func (pc *SourcePrivilegeChecker) Check(ctx context.Context) *Result
Check implements the Checker interface. We only check REPLICATION SLAVE, REPLICATION CLIENT, RELOAD privileges. REPLICATION SLAVE and REPLICATION CLIENT are required. RELOAD is strongly suggested to have.
func (*SourcePrivilegeChecker) Name ¶
func (pc *SourcePrivilegeChecker) 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 differents 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