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

Max index length #220

Merged
merged 5 commits into from
Apr 2, 2020
Merged
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
10 changes: 10 additions & 0 deletions pkg/task/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/pingcap/log"
"github.com/pingcap/parser/model"
"github.com/pingcap/tidb-tools/pkg/filter"
"github.com/pingcap/tidb/config"
"github.com/spf13/pflag"
"go.uber.org/zap"

Expand Down Expand Up @@ -148,6 +149,15 @@ func RunRestore(c context.Context, g glue.Glue, cmdName string, cfg *RestoreConf
return err
}
// execute DDL first

// set max-index-length before execute DDLs and create tables
// we set this value to max(3072*4), otherwise we might not restore table
// when upstream and downstream both set this value greater than default(3072)
conf := config.GetGlobalConfig()
conf.MaxIndexLength = config.DefMaxOfMaxIndexLength
config.StoreGlobalConfig(conf)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to log a warning or explain it in our document.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay,add a warn log

log.Warn("set max-index-length to max(3072*4) to skip check index length in DDL")

err = client.ExecDDLs(ddlJobs)
if err != nil {
return errors.Trace(err)
Expand Down