diff --git a/dm/pkg/schema/tracker.go b/dm/pkg/schema/tracker.go index de783f4caef..86635759491 100644 --- a/dm/pkg/schema/tracker.go +++ b/dm/pkg/schema/tracker.go @@ -117,6 +117,8 @@ func NewTracker(ctx context.Context, task string, sessionCfg map[string]string, // bypass wait time of https://github.com/pingcap/tidb/pull/20550 conf.TiKVClient.AsyncCommit.SafeWindow = 0 conf.TiKVClient.AsyncCommit.AllowedClockDrift = 0 + // bypass "Specified key was too long" + conf.MaxIndexLength = 1<<32 - 1 }) if len(sessionCfg) == 0 { diff --git a/dm/pkg/schema/tracker_test.go b/dm/pkg/schema/tracker_test.go index a3c6910b029..c8f7d0a2f94 100644 --- a/dm/pkg/schema/tracker_test.go +++ b/dm/pkg/schema/tracker_test.go @@ -958,7 +958,7 @@ func (s *trackerSuite) TestVarchar20000(c *C) { mock.ExpectQuery("SHOW CREATE TABLE " + tableID).WillReturnRows( sqlmock.NewRows([]string{"Table", "Create Table"}). - AddRow("test", "create table t(c varchar(20000)) charset=utf8")) + AddRow("test", "create table t(c varchar(20000), key(c(20000))) charset=utf8")) _, err = tracker.GetDownStreamTableInfo(tcontext.Background(), tableID, oriTi) c.Assert(err, IsNil) _, ok := tracker.dsTracker.tableInfos[tableID]