Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go/vt/worker/chunk.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func generateChunks(ctx context.Context, wr *wrangler.Wrangler, tablet *topodata
qr, err := wr.TabletManagerClient().ExecuteFetchAsApp(shortCtx, tablet, true, []byte(query), 1)
cancel()
if err != nil {
return nil, vterrors.Wrapf(err, "tablet: %v, table: %v: cannot determine MIN and MAX of the first primary key column. ExecuteFetchAsApp: %v", topoproto.TabletAliasString(tablet.Alias), td.Name, err)
return nil, vterrors.Wrapf(err, "tablet: %v, table: %v: cannot determine MIN and MAX of the first primary key column. ExecuteFetchAsApp", topoproto.TabletAliasString(tablet.Alias), td.Name)
}
if len(qr.Rows) != 1 {
return nil, fmt.Errorf("tablet: %v, table: %v: cannot determine MIN and MAX of the first primary key column. Zero rows were returned", topoproto.TabletAliasString(tablet.Alias), td.Name)
Expand Down
32 changes: 16 additions & 16 deletions go/vt/worker/diff_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ func CompareRows(fields []*querypb.Field, compareCount int, left, right []sqltyp
r := rv.([]byte)
return bytes.Compare(l, r), nil
default:
return 0, fmt.Errorf("Unsuported type %T returned by mysql.proto.Convert", l)
return 0, fmt.Errorf("Unsupported type %T returned by mysql.proto.Convert", l)
}
}
return 0, nil
Expand All @@ -440,27 +440,27 @@ func CompareRows(fields []*querypb.Field, compareCount int, left, right []sqltyp
// It assumes left and right are sorted by ascending primary key.
// it will record errors if extra rows exist on either side.
type RowDiffer struct {
left *RowReader
right *RowReader
pkFieldCount int
left *RowReader
right *RowReader
tableDefinition *tabletmanagerdatapb.TableDefinition
}

// NewRowDiffer returns a new RowDiffer
func NewRowDiffer(left, right *QueryResultReader, tableDefinition *tabletmanagerdatapb.TableDefinition) (*RowDiffer, error) {
func NewRowDiffer(left, right ResultReader, tableDefinition *tabletmanagerdatapb.TableDefinition) (*RowDiffer, error) {
leftFields := left.Fields()
rightFields := right.Fields()
if len(leftFields) != len(rightFields) {
return nil, fmt.Errorf("Cannot diff inputs with different types")
return nil, fmt.Errorf("[table=%v] Cannot diff inputs with different types", tableDefinition.Name)
}
for i, field := range leftFields {
if field.Type != rightFields[i].Type {
return nil, fmt.Errorf("Cannot diff inputs with different types: field %v types are %v and %v", i, field.Type, rightFields[i].Type)
return nil, fmt.Errorf("[table=%v] Cannot diff inputs with different types: field %v types are %v and %v", tableDefinition.Name, i, field.Type, rightFields[i].Type)
}
}
return &RowDiffer{
left: NewRowReader(left),
right: NewRowReader(right),
pkFieldCount: len(tableDefinition.PrimaryKeyColumns),
left: NewRowReader(left),
right: NewRowReader(right),
tableDefinition: tableDefinition,
}, nil
}

Expand Down Expand Up @@ -529,10 +529,10 @@ func (rd *RowDiffer) Go(log logutil.Logger) (dr DiffReport, err error) {
continue
}

if f >= rd.pkFieldCount {
if f >= len(rd.tableDefinition.PrimaryKeyColumns) {
// rows have the same primary key, only content is different
if dr.mismatchedRows < 10 {
log.Errorf("Different content %v in same PK: %v != %v", dr.mismatchedRows, left, right)
log.Errorf("[table=%v] Different content %v in same PK: %v != %v", rd.tableDefinition.Name, dr.mismatchedRows, left, right)
}
dr.mismatchedRows++
advanceLeft = true
Expand All @@ -541,20 +541,20 @@ func (rd *RowDiffer) Go(log logutil.Logger) (dr DiffReport, err error) {
}

// have to find the 'smallest' row and advance it
c, err := CompareRows(rd.left.Fields(), rd.pkFieldCount, left, right)
c, err := CompareRows(rd.left.Fields(), len(rd.tableDefinition.PrimaryKeyColumns), left, right)
if err != nil {
return dr, err
}
if c < 0 {
if dr.extraRowsLeft < 10 {
log.Errorf("Extra row %v on left: %v", dr.extraRowsLeft, left)
log.Errorf("[table=%v] Extra row %v on left: %v", rd.tableDefinition.Name, dr.extraRowsLeft, left)
}
dr.extraRowsLeft++
advanceLeft = true
continue
} else if c > 0 {
if dr.extraRowsRight < 10 {
log.Errorf("Extra row %v on right: %v", dr.extraRowsRight, right)
log.Errorf("[table=%v] Extra row %v on right: %v", rd.tableDefinition.Name, dr.extraRowsRight, right)
}
dr.extraRowsRight++
advanceRight = true
Expand All @@ -565,7 +565,7 @@ func (rd *RowDiffer) Go(log logutil.Logger) (dr DiffReport, err error) {
// they're the same. Logging a regular difference
// then, and advancing both.
if dr.mismatchedRows < 10 {
log.Errorf("Different content %v in same PK: %v != %v", dr.mismatchedRows, left, right)
log.Errorf("[table=%v] Different content %v in same PK: %v != %v", rd.tableDefinition.Name, dr.mismatchedRows, left, right)
}
dr.mismatchedRows++
advanceLeft = true
Expand Down
Loading