Documentation ¶
Index ¶
Constants ¶
View Source
const ( LocalDirPerm os.FileMode = 0o755 LocalFilePerm os.FileMode = 0o644 LogFileName = "sync_diff.log" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
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"` // 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 // 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 string `toml:"password" json:"password"` SqlMode string `toml:"sql-mode" json:"sql-mode"` Snapshot string `toml:"snapshot" json:"snapshot"` RouteRules []string `toml:"route-rules" json:"route-rules"` Router *router.Table Conn *sql.DB }
DataSource represents the Source Config.
func (*DataSource) ToDBConfig ¶
func (d *DataSource) ToDBConfig() *dbutil.DBConfig
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.