Skip to content

Commit

Permalink
Merge pull request #5896 from bumbing/upstream2
Browse files Browse the repository at this point in the history
vtgate: list only the problem values when insert fails due to vindex.Verify
  • Loading branch information
dweitzman authored Mar 17, 2020
2 parents b79c657 + 5dfc757 commit 33741d2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions go/vt/vtgate/engine/insert.go
Original file line number Diff line number Diff line change
Expand Up @@ -588,16 +588,22 @@ func (ins *Insert) processUnowned(vcursor VCursor, vindexColumnsKeys [][]sqltype
if err != nil {
return err
}

var mismatchVindexKeys [][]sqltypes.Value
for i, v := range verified {
rowNum := verifyIndexes[i]
if !v {
if ins.Opcode != InsertShardedIgnore {
return fmt.Errorf("values %v for column %v does not map to keyspace ids", vindexColumnsKeys, colVindex.Columns)
mismatchVindexKeys = append(mismatchVindexKeys, vindexColumnsKeys[rowNum])
continue
}
// InsertShardedIgnore: skip the row.
ksids[verifyIndexes[i]] = nil
continue
}
}
if len(mismatchVindexKeys) > 0 {
return fmt.Errorf("values %v for column %v does not map to keyspace ids", mismatchVindexKeys, colVindex.Columns)
}
}
return nil
}
Expand Down

0 comments on commit 33741d2

Please sign in to comment.