Documentation ¶
Index ¶
- type Bound
- type ChunkRange
- type RowData
- type RowDatas
- type TableDiff
- func (t *TableDiff) CheckTableData(ctx context.Context) (equal bool, err error)
- func (t *TableDiff) CheckTableStruct(ctx context.Context) (bool, error)
- func (t *TableDiff) Equal(ctx context.Context, writeFixSQL func(string) error) (bool, bool, error)
- func (t *TableDiff) LoadCheckpoint(ctx context.Context) ([]*ChunkRange, error)
- func (t *TableDiff) UpdateSummaryInfo(ctx context.Context) chan bool
- func (t *TableDiff) WriteSqls(ctx context.Context, writeFixSQL func(string) error) chan bool
- type TableInstance
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bound ¶
type Bound struct { Column string `json:"column"` Lower string `json:"lower"` Upper string `json:"upper"` HasLower bool `json:"has-lower"` HasUpper bool `json:"has-upper"` }
Bound represents a bound for a column
type ChunkRange ¶
type ChunkRange struct { ID int `json:"id"` Bounds []*Bound `json:"bounds"` Where string `json:"where"` Args []string `json:"args"` State string `json:"state"` // contains filtered or unexported fields }
ChunkRange represents chunk range
func SplitChunks ¶
func SplitChunks(ctx context.Context, table *TableInstance, splitFields, limits string, chunkSize int, collation string, useTiDBStatsInfo bool, cpDB *sql.DB, ) (chunks []*ChunkRange, err error)
SplitChunks splits the table to some chunks.
func (*ChunkRange) String ¶
func (c *ChunkRange) String() string
String returns the string of ChunkRange, used for log.
type RowData ¶
type RowData struct { Data map[string]*dbutil.ColumnData Source int }
RowData is the struct of rows selected from mysql/tidb
type RowDatas ¶
type RowDatas struct { Rows []RowData OrderKeyCols []*model.ColumnInfo }
RowDatas is a heap of MergeItems.
func (*RowDatas) Pop ¶
func (r *RowDatas) Pop() interface{}
Pop implements heap.Interface's Pop function
type TableDiff ¶
type TableDiff struct { // source tables SourceTables []*TableInstance `json:"source-tables"` // target table TargetTable *TableInstance `json:"target-table"` // columns be ignored IgnoreColumns []string `json:"-"` // field should be the primary key, unique key or field with index Fields string `json:"fields"` // select range, for example: "age > 10 AND age < 20" Range string `json:"range"` // for example, the whole data is [1...100] // we can split these data to [1...10], [11...20], ..., [91...100] // the [1...10] is a chunk, and it's chunk size is 10 // size of the split chunk ChunkSize int `json:"chunk-size"` // sampling check percent, for example 10 means only check 10% data Sample int `json:"sample"` // how many goroutines are created to check data CheckThreadCount int `json:"-"` // set false if want to compare the data directly UseChecksum bool `json:"-"` // set true if just want compare data by checksum, will skip select data when checksum is not equal OnlyUseChecksum bool `json:"-"` // collation config in mysql/tidb, should corresponding to charset. Collation string `json:"collation"` // ignore check table's struct IgnoreStructCheck bool `json:"-"` // ignore check table's data IgnoreDataCheck bool `json:"-"` // set true will continue check from the latest checkpoint UseCheckpoint bool `json:"-"` // get tidb statistics information from which table instance. if is nil, will split chunk by random. TiDBStatsSource *TableInstance `json:"tidb-stats-source"` CpDB *sql.DB `json:"-"` // contains filtered or unexported fields }
TableDiff saves config for diff table
func (*TableDiff) CheckTableData ¶
CheckTableData checks table's data
func (*TableDiff) CheckTableStruct ¶
CheckTableStruct checks table's struct
func (*TableDiff) LoadCheckpoint ¶
func (t *TableDiff) LoadCheckpoint(ctx context.Context) ([]*ChunkRange, error)
LoadCheckpoint do some prepare work before check data, like adjust config and create checkpoint table
func (*TableDiff) UpdateSummaryInfo ¶
UpdateSummaryInfo updates summary information
Click to show internal directories.
Click to hide internal directories.