Documentation ¶
Index ¶
Constants ¶
Variables ¶
This section is empty.
Functions ¶
func ExportTemplateConfig ¶
Types ¶
type Config ¶
type Config struct { *flag.FlagSet `json:"-"` // log level LogLevel string `toml:"-" json:"-"` // how many goroutines are created to check data CheckThreadCount int `toml:"check-thread-count" json:"check-thread-count"` // how many goroutines are created to split chunk. A goroutine splits one table at a time. SplitThreadCount int `toml:"-" json:"split-thread-count"` // set true if want to compare rows // set false won't compare rows. ExportFixSQL bool `toml:"export-fix-sql" json:"export-fix-sql"` // only check table struct without table data. CheckStructOnly bool `toml:"check-struct-only" json:"check-struct-only"` // DMAddr is dm-master's address, the format should like "http://127.0.0.1:8261" DMAddr string `toml:"dm-addr" json:"dm-addr"` // DMTask string `toml:"dm-task" json:"dm-task"` DMTask string `toml:"dm-task" json:"dm-task"` DataSources map[string]*DataSource `toml:"data-sources" json:"data-sources"` Routes map[string]*router.TableRule `toml:"routes" json:"routes"` TableConfigs map[string]*TableConfig `toml:"table-configs" json:"table-configs"` Task TaskConfig `toml:"task" json:"task"` // config file ConfigFile string // export a template config file in the current directory Template string `toml:"-" json:"-"` // print version if set true PrintVersion bool }
Config is the configuration.
func (*Config) CheckConfig ¶
type DataSource ¶
type DataSource struct { Host string `toml:"host" json:"host"` Port int `toml:"port" json:"port"` User string `toml:"user" json:"user"` Password utils.SecretString `toml:"password" json:"password"` SqlMode string `toml:"sql-mode" json:"sql-mode"` Snapshot string `toml:"snapshot" json:"snapshot"` Security *Security `toml:"security" json:"security"` RouteRules []string `toml:"route-rules" json:"route-rules"` Router *router.Table RouteTargetSet map[string]struct{} `json:"-"` Conn *sql.DB }
DataSource represents the Source Config.
func (*DataSource) GetDSN ¶
func (d *DataSource) GetDSN() (dbDSN string)
func (*DataSource) IsAutoSnapshot ¶
func (d *DataSource) IsAutoSnapshot() bool
IsAutoSnapshot returns true if the tidb_snapshot is expected to automatically be set from the syncpoint from the target TiDB instance.
func (*DataSource) RegisterTLS ¶
func (d *DataSource) RegisterTLS() error
register TLS config for driver
func (*DataSource) SetSnapshot ¶
func (d *DataSource) SetSnapshot(newSnapshot string)
SetSnapshot changes the snapshot in configuration. This is typically used with the auto-snapshot feature.
func (*DataSource) ToDBConfig ¶
func (d *DataSource) ToDBConfig() *dbutil.DBConfig
type Security ¶
type Security struct { TLSName string `json:"tls-name"` CAPath string `toml:"ca-path" json:"ca-path"` CertPath string `toml:"cert-path" json:"cert-path"` KeyPath string `toml:"key-path" json:"key-path"` // raw content CABytes string `toml:"ca-bytes" json:"ca-bytes"` CertBytes string `toml:"cert-bytes" json:"cert-bytes"` KeyBytes string `toml:"key-bytes" json:"key-bytes"` }
TLS Security wrapper
type TableConfig ¶
type TableConfig struct { // table's filter to tell us which table should adapt to this config. TargetTables []string `toml:"target-tables" json:"target-tables"` // Internally used to indicate which specified table in target is using this config. Schema string Table string // Internally used to distinguish different config. ConfigIndex int // Internally used to valid config. HasMatched bool // columns be ignored, will not check this column's data IgnoreColumns []string `toml:"ignore-columns"` // field should be the primary key, unique key or field with index Fields []string `toml:"index-fields"` // select range, for example: "age > 10 AND age < 20" Range string `toml:"range"` TargetTableInfo *model.TableInfo // collation config in mysql/tidb Collation string `toml:"collation"` // specify the chunksize for the table ChunkSize int64 `toml:"chunk-size" json:"chunk-size"` }
TableConfig is the config of table.
func (*TableConfig) Valid ¶
func (t *TableConfig) Valid() bool
Valid returns true if table's config is valide.
type TaskConfig ¶
type TaskConfig struct { Source []string `toml:"source-instances" json:"source-instances"` Routes []string `toml:"source-routes" json:"source-routes"` Target string `toml:"target-instance" json:"target-instance"` CheckTables []string `toml:"target-check-tables" json:"target-check-tables"` TableConfigs []string `toml:"target-configs" json:"target-configs"` // OutputDir include these // 1. checkpoint Dir // 2. fix-target-sql Dir // 3. summary file // 4. sync diff log file // 5. fix OutputDir string `toml:"output-dir" json:"output-dir"` SourceInstances []*DataSource TargetInstance *DataSource TargetTableConfigs []*TableConfig TargetCheckTables filter.Filter FixDir string CheckpointDir string HashFile string }
func (*TaskConfig) ComputeConfigHash ¶
func (t *TaskConfig) ComputeConfigHash() (string, error)
ComputeConfigHash compute the hash according to the task if ConfigHash is as same as checkpoint.hash we think the second sync diff can use the checkpoint.
func (*TaskConfig) Init ¶
func (t *TaskConfig) Init( dataSources map[string]*DataSource, tableConfigs map[string]*TableConfig, ) (err error)
Click to show internal directories.
Click to hide internal directories.