-
Notifications
You must be signed in to change notification settings - Fork 188
Conversation
/run-all-tests |
/build |
/run-all-tests |
/run-all-tests |
/run-all-tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will review soon
@@ -202,3 +202,26 @@ func (o *Optimist) PendingOperation() *optimism.Operation { | |||
op := *o.pendingOp | |||
return &op | |||
} | |||
|
|||
// CheckPersistentData check and fix the persistent data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may address that currently this function is not used because user will meet error at early version if set unsupported case-sensitive.
@@ -840,6 +843,44 @@ func (cp *RemoteCheckPoint) Load(tctx *tcontext.Context) error { | |||
return terror.WithScope(terror.DBErrorAdapt(rows.Err(), terror.ErrDBDriverError), terror.ScopeDownstream) | |||
} | |||
|
|||
// CheckAndUpdate check the checkpoint data consistency and try to fix them if possible. | |||
func (cp *RemoteCheckPoint) CheckAndUpdate(ctx context.Context, schemas map[string]string, tables map[string]map[string]string) error { | |||
cp.Lock() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe no lock is needed (but it's OK to acquire a lock)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rest lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will review later
if lcSetting == utils.LCTableNamesMixed { | ||
msg := "can not set `case-sensitive = true` when upstream `lower_case_table_names = 2`" | ||
log.L().Error(msg, zap.Any("instance", cfg)) | ||
return nil, errors.New(msg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this make a chaos test fail?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure 🤔
pkg/shardddl/optimism/info.go
Outdated
@@ -344,3 +344,47 @@ func (oldInfo *OldInfo) toInfo() Info { | |||
TableInfosAfter: []*model.TableInfo{oldInfo.TableInfoAfter}, | |||
} | |||
} | |||
|
|||
// CheckDDLInfos try to check and fix all the schema and table names for DDL info. | |||
func CheckDDLInfos(cli *clientv3.Client, source string, schemaMap map[string]string, talesMap map[string]map[string]string) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func CheckDDLInfos(cli *clientv3.Client, source string, schemaMap map[string]string, talesMap map[string]map[string]string) error { | |
func CheckDDLInfos(cli *clientv3.Client, source string, schemaMap map[string]string, tablesMap map[string]map[string]string) error { |
pkg/utils/common.go
Outdated
// GenTableID generates table ID. | ||
func GenTableID(schema, table string) (id string, isSchemaOnly bool) { | ||
if len(table) == 0 { | ||
return fmt.Sprintf("`%s`", schema), true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this have a better performance?
return fmt.Sprintf("`%s`", schema), true | |
return "`" + schema + "`", true |
pkg/utils/common.go
Outdated
if len(table) == 0 { | ||
return fmt.Sprintf("`%s`", schema), true | ||
} | ||
return fmt.Sprintf("`%s`.`%s`", schema, table), false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
syncer/checkpoint.go
Outdated
tctx := &tcontext.Context{ | ||
Logger: log.L(), | ||
Ctx: ctx, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tctx := &tcontext.Context{ | |
Logger: log.L(), | |
Ctx: ctx, | |
} | |
tctx := tcontext.NewContext(ctx, log.L()) |
@@ -65,6 +65,8 @@ type OnlinePlugin interface { | |||
Clear(tctx *tcontext.Context) error | |||
// Close closes online ddl plugin | |||
Close() | |||
// CheckAndUpdate try to check and fix the shcema/table case-sensitive issue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// CheckAndUpdate try to check and fix the shcema/table case-sensitive issue | |
// CheckAndUpdate try to check and fix the schema/table case-sensitive issue |
/run-all-tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 0a09c5b
|
/run-all-tests |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
In response to a cherrypick label: new pull request created: #1886. |
What problem does this PR solve?
Fix the bug that
case-sensitive
can not take effect as expected.What is changed and how it works?
lower_case_table_names
setting at bootstrap, do not allow setcase-sensitive = true
whenlower_case_table_names = true
lower_case_table_names
, return Name.O for 0, and Name.L for 1/2.lower_case_table_names = 0
Check List
Tests
Code changes
Side effects
lower_case_table_names = 0
, we can't rollback to the origin version since some persistent data has been changed.Related changes