Documentation ¶
Index ¶
- Constants
- type ChunkResult
- type Report
- func (r *Report) CalculateTotalSize(ctx context.Context, db *sql.DB)
- func (r *Report) CommitSummary() error
- func (r *Report) GetSnapshot(chunkID *chunk.ChunkID, schema, table string) (*Report, error)
- func (r *Report) Init(tableDiffs []*common.TableDiff, sourceConfig [][]byte, targetConfig []byte)
- func (r *Report) LoadReport(reportInfo *Report)
- func (r *Report) Print(w io.Writer) error
- func (r *Report) SetTableDataCheckResult(schema, table string, equal bool, rowsAdd, rowsDelete int, ...)
- func (r *Report) SetTableMeetError(schema, table string, err error)
- func (r *Report) SetTableStructCheckResult(schema, table string, equal bool, skip bool)
- type ReportConfig
- type TableResult
Constants ¶
const ( // Pass means all data and struct of tables are equal Pass = "pass" // Fail means not all data or struct of tables are equal Fail = "fail" Error = "error" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChunkResult ¶
type ChunkResult struct { RowsAdd int `json:"rows-add"` // `RowsAdd` is the number of rows needed to add RowsDelete int `json:"rows-delete"` // `RowsDelete` is the number of rows needed to delete }
ChunkResult save the necessarily information to provide summary information
type Report ¶
type Report struct { sync.RWMutex Result string `json:"-"` // Result is pass or fail PassNum int32 `json:"-"` // The pass number of tables FailedNum int32 `json:"-"` // The failed number of tables TableResults map[string]map[string]*TableResult `json:"table-results"` // TableResult saved the map of `schema` => `table` => `tableResult` StartTime time.Time `json:"start-time"` Duration time.Duration `json:"time-duration"` TotalSize int64 `json:"-"` // Total size of the checked tables SourceConfig [][]byte `json:"-"` TargetConfig []byte `json:"-"` // contains filtered or unexported fields }
Report saves the check results.
func (*Report) CalculateTotalSize ¶
CalculateTotalSize calculate the total size of all the checked tables Notice, user should run the analyze table first, when some of tables' size are zero.
func (*Report) CommitSummary ¶
CommitSummary commit summary info
func (*Report) GetSnapshot ¶
GetSnapshot get the snapshot of the current state of the report, then we can restart the sync-diff and get the correct report state.
func (*Report) LoadReport ¶
LoadReport loads the report from the checkpoint
func (*Report) SetTableDataCheckResult ¶
func (r *Report) SetTableDataCheckResult(schema, table string, equal bool, rowsAdd, rowsDelete int, upCount, downCount int64, id *chunk.ChunkID)
SetTableDataCheckResult sets the data check result for table.
func (*Report) SetTableMeetError ¶
SetTableMeetError sets meet error when check the table.
type ReportConfig ¶
type ReportConfig struct { Host string `toml:"host"` Port int `toml:"port"` User string `toml:"user"` Snapshot string `toml:"snapshot,omitempty"` SqlMode string `toml:"sql-mode,omitempty"` }
ReportConfig stores the config information for the user
type TableResult ¶
type TableResult struct { Schema string `json:"schema"` Table string `json:"table"` StructEqual bool `json:"struct-equal"` DataSkip bool `json:"data-skip"` DataEqual bool `json:"data-equal"` MeetError error `json:"-"` ChunkMap map[string]*ChunkResult `json:"chunk-result"` // `ChunkMap` stores the `ChunkResult` of each chunk of the table UpCount int64 `json:"up-count"` // `UpCount` is the number of rows in the table from upstream DownCount int64 `json:"down-count"` // `DownCount` is the number of rows in the table from downstream }
TableResult saves the check result for every table.