Documentation ¶
Overview ¶
package vdiff implements the Vitess Diff functionality which compares the logical contents of MySQL tables across keyspaces and shards
Please see ./README.md for more information.
Index ¶
- Variables
- type DiffMismatch
- type DiffReport
- type Engine
- func (vde *Engine) Close()
- func (vde *Engine) InitDBConfig(dbcfgs *dbconfigs.DBConfigs)
- func (vde *Engine) IsOpen() bool
- func (vde *Engine) Open(ctx context.Context, vre *vreplication.Engine)
- func (vde *Engine) PerformVDiffAction(ctx context.Context, req *tabletmanagerdatapb.VDiffRequest) (resp *tabletmanagerdatapb.VDiffResponse, err error)
- type ProgressReport
- type RowDiff
- type VDiffAction
- type VDiffState
Constants ¶
This section is empty.
Variables ¶
var ( Actions = []VDiffAction{CreateAction, ShowAction, StopAction, ResumeAction, DeleteAction} ActionArgs = []string{AllActionArg, LastActionArg} )
var BackgroundOperationTimeout = topo.RemoteOperationTimeout * 4
how long to wait for background operations to complete
var ErrMaxDiffDurationExceeded = vterrors.Errorf(vtrpcpb.Code_DEADLINE_EXCEEDED, "table diff was stopped due to exceeding the max-diff-duration time")
var ErrVDiffStoppedByUser = vterrors.Errorf(vtrpcpb.Code_CANCELED, "vdiff was stopped by user")
Functions ¶
This section is empty.
Types ¶
type DiffMismatch ¶
type DiffMismatch struct { Source *RowDiff `json:"Source,omitempty"` Target *RowDiff `json:"Target,omitempty"` }
DiffMismatch is a sample of row diffs between source and target.
type DiffReport ¶
type DiffReport struct { TableName string // counts ProcessedRows int64 MatchingRows int64 MismatchedRows int64 ExtraRowsSource int64 ExtraRowsTarget int64 // actual data for a few sample rows ExtraRowsSourceDiffs []*RowDiff `json:"ExtraRowsSourceSample,omitempty"` ExtraRowsTargetDiffs []*RowDiff `json:"ExtraRowsTargetSample,omitempty"` MismatchedRowsDiffs []*DiffMismatch `json:"MismatchedRowsSample,omitempty"` }
DiffReport is the summary of differences for one table.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
func NewEngine ¶
func NewEngine(ts *topo.Server, tablet *topodata.Tablet, collationEnv *collations.Environment, parser *sqlparser.Parser) *Engine
func NewTestEngine ¶ added in v0.16.0
func NewTestEngine(ts *topo.Server, tablet *topodata.Tablet, dbn string, dbcf func() binlogplayer.DBClient, tmcf func() tmclient.TabletManagerClient) *Engine
NewTestEngine creates an Engine for use in tests. It uses the custom db client factory and tablet manager client factory, while setting the fortests field to true to modify any engine behavior when used in tests (e.g. not starting the retry goroutine).
func (*Engine) InitDBConfig ¶
func (*Engine) PerformVDiffAction ¶
func (vde *Engine) PerformVDiffAction(ctx context.Context, req *tabletmanagerdatapb.VDiffRequest) (resp *tabletmanagerdatapb.VDiffResponse, err error)
type ProgressReport ¶ added in v0.15.0
type RowDiff ¶
type RowDiff struct { Row map[string]string `json:"Row,omitempty"` Query string `json:"Query,omitempty"` }
RowDiff is a row that didn't match as part of the comparison.
type VDiffAction ¶
type VDiffAction string //nolint
const ( CreateAction VDiffAction = "create" ShowAction VDiffAction = "show" StopAction VDiffAction = "stop" ResumeAction VDiffAction = "resume" DeleteAction VDiffAction = "delete" AllActionArg = "all" LastActionArg = "last" )
type VDiffState ¶
type VDiffState string //nolint
VDiff operation and table states: pending/started/stopped/completed/error/unknown
const ( PendingState VDiffState = "pending" StartedState VDiffState = "started" StoppedState VDiffState = "stopped" CompletedState VDiffState = "completed" ErrorState VDiffState = "error" UnknownState VDiffState = "" TimestampFormat = "2006-01-02 15:04:05" )