-
Notifications
You must be signed in to change notification settings - Fork 288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimist: return ConflictNone if a conflict DDL has no conflict with at lease one normal table #5414
Conversation
[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. |
} | ||
|
||
// judge this normal table is smaller(same as allTableSmaller) | ||
if _, err = joined.Compare(prevTable); err == nil { |
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.
copy from
tiflow/dm/pkg/shardddl/optimism/lock.go
Line 1003 in 08928bf
if _, err = joined.Compare(ti); err == nil { |
} | ||
|
||
// judge this normal table is larger(same as allTableLarger) | ||
if joined, err = prevTable.Join(ti); err != nil { |
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.
copy from
tiflow/dm/pkg/shardddl/optimism/lock.go
Line 1043 in 08928bf
joined, err := ti.Join(finalTi) |
@@ -889,8 +889,8 @@ func (l *Lock) trySyncForOneDDL(source, schema, table string, prevTable, postTab | |||
|
|||
log.L().Info("found conflict for DDL", zap.String("source", source), zap.String("schema", schema), zap.String("table", table), zap.Stringer("prevTable", prevTable), zap.Stringer("postTable", postTable), log.ShortError(tableErr)) | |||
|
|||
if idempotent { | |||
log.L().Info("return conflict DDL for idempotent DDL", zap.String("source", source), zap.String("schema", schema), zap.String("table", table), zap.Stringer("prevTable", prevTable), zap.Stringer("postTable", postTable)) | |||
if idempotent || l.noConflictWithOneNormalTable(source, schema, table, prevTable, postTable) { |
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.
idempotent means the DDL has already been executed in this table before.
noConflictWithOneNormalTable means the DDL has already been executed in at least one other table before.
Codecov Report
Flags with carried forward coverage won't be shown. Click here to find out more. @@ Coverage Diff @@
## master #5414 +/- ##
================================================
- Coverage 56.1240% 55.6597% -0.4644%
================================================
Files 522 528 +6
Lines 65325 69456 +4131
================================================
+ Hits 36663 38659 +1996
- Misses 25094 27095 +2001
- Partials 3568 3702 +134 |
/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.
LGTM
/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
/merge |
This pull request has been accepted and is ready to merge. Commit hash: b395963
|
…at lease one normal table (pingcap#5414) ref pingcap#4287
What problem does this PR solve?
Issue Number: ref #4287
What is changed and how it works?
When a conflict DDL has no conflict with at least one normal table, we regard it can be executed in downstream.
e.g.
when we receive a conflict ddl
alter table tb2 rename b to a
, before this pr, tb2 will be skipped and wait tb3's rename column DDL, after this pr, tb2 will directly executed this DDL because tb1 has already have columna
and no columnb
. That is to say we use a more optimist algorithm in this pr.Check List
Tests
Release note