Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 3341f40

Browse files
authored
Max index length (#220)
* restore: set max-index-length to max * restore:add max-index-length params * address comment * address comment
1 parent 01de3f5 commit 3341f40

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pkg/task/restore.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"github.com/pingcap/log"
1111
"github.com/pingcap/parser/model"
1212
"github.com/pingcap/tidb-tools/pkg/filter"
13+
"github.com/pingcap/tidb/config"
1314
"github.com/spf13/pflag"
1415
"go.uber.org/zap"
1516

@@ -148,6 +149,15 @@ func RunRestore(c context.Context, g glue.Glue, cmdName string, cfg *RestoreConf
148149
return err
149150
}
150151
// execute DDL first
152+
153+
// set max-index-length before execute DDLs and create tables
154+
// we set this value to max(3072*4), otherwise we might not restore table
155+
// when upstream and downstream both set this value greater than default(3072)
156+
conf := config.GetGlobalConfig()
157+
conf.MaxIndexLength = config.DefMaxOfMaxIndexLength
158+
config.StoreGlobalConfig(conf)
159+
log.Warn("set max-index-length to max(3072*4) to skip check index length in DDL")
160+
151161
err = client.ExecDDLs(ddlJobs)
152162
if err != nil {
153163
return errors.Trace(err)

0 commit comments

Comments
 (0)