Skip to content
This repository has been archived by the owner on Dec 8, 2021. It is now read-only.

Commit

Permalink
backend/tidb: temporarily disable the strict-mode value check in tidb…
Browse files Browse the repository at this point in the history
… backend (#551)

* temporarily disable the strict-mode value check in tidb backend since it's buggy

* add link to related issue
  • Loading branch information
glorv committed Jan 29, 2021
1 parent 6f1a46f commit b2cfdd4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
15 changes: 8 additions & 7 deletions lightning/backend/tidb.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,14 @@ func (enc *tidbEncoder) appendSQL(sb *strings.Builder, datum *types.Datum, col *
value := strconv.AppendFloat(buffer[:0], datum.GetFloat64(), 'g', -1, 64)
sb.Write(value)
case types.KindString:
if enc.mode.HasStrictMode() {
d, err := table.CastValue(enc.se, *datum, col.ToInfo(), false, false)
if err != nil {
return errors.Trace(err)
}
datum = &d
}
// See: https://github.com/pingcap/tidb-lightning/issues/550
//if enc.mode.HasStrictMode() {
// d, err := table.CastValue(enc.se, *datum, col.ToInfo(), false, false)
// if err != nil {
// return errors.Trace(err)
// }
// datum = &d
//}

enc.appendSQLBytes(sb, datum.GetBytes())
case types.KindBytes:
Expand Down
3 changes: 2 additions & 1 deletion lightning/backend/tidb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ func (s *mysqlSuite) TestWriteRowsErrorOnDup(c *C) {
c.Assert(err, IsNil)
}

func (s *mysqlSuite) TestStrictMode(c *C) {
// TODO: temporarily disable this test before we fix strict mode
func (s *mysqlSuite) testStrictMode(c *C) {
ft := *types.NewFieldType(mysql.TypeVarchar)
ft.Charset = charset.CharsetUTF8MB4
col0 := &model.ColumnInfo{ID: 1, Name: model.NewCIStr("s0"), State: model.StatePublic, Offset: 0, FieldType: ft}
Expand Down

0 comments on commit b2cfdd4

Please sign in to comment.