-
Notifications
You must be signed in to change notification settings - Fork 287
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
syncer(dm): use DML library #4313
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. |
42845c2
to
a2ac57d
Compare
/run-dm-integration-test |
GBK integration test has passed succesful, I'll split this PR into smaller ones to make it easier to review |
/run-dm-integration-test |
/run-dm-integration-test |
/run-dm-integration-test |
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
} | ||
case del: | ||
// do nothing because anything + DELETE => DELETE | ||
} |
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.
Why not also skip reduce RowChangeDelete?
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.
we only run compactor for row changes whose PR/UK doesn't change, I think it's both OK.
And I want to apply Reduce to all combinations of row change so I want to reduce the presence of skipReduce
. If we implement multi-row version of UPDATE in future, I think we can also remove the // DELETE + INSERT => INSERT with safemode
extra path
dm/syncer/compactor.go
Outdated
if j.dml.op == update && j.dml.updateIdentify() { | ||
delDML, insertDML := updateToDelAndInsert(j.dml) | ||
if j.dml.IsIdentityUpdated() { | ||
delDML, insertDML := j.dml.Split() |
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.
How about SplitUpdate()
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
ptal @Ehco1996 @glorv @lichunzhu CI has passed in previous commits |
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
case sqlmodel.RowChangeUpdate: | ||
if j.safeMode { | ||
query, arg = j.dml.GenSQL(sqlmodel.DMLDelete) | ||
appendQueryAndArg() |
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.
Seems we can move all appendQueryAndArg
out of the switch except this one
dm/syncer/job.go
Outdated
} | ||
|
||
// newDummyJob is only used in tests. | ||
func newDummyJob(tp opType, targetTable *filter.Table, ddls ...string) *job { |
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.
Nit: We can move this function to _test.go since it is a package private function.
dm/syncer/dml.go
Outdated
} | ||
return | ||
} | ||
|
||
// genDMLParam stores pruned columns, data as well as the original columns, data, index. |
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.
We should update this comment
updated, PTAL @lichunzhu |
Codecov Report
Flags with carried forward coverage won't be shown. Click here to find out more. @@ Coverage Diff @@
## master #4313 +/- ##
================================================
- Coverage 55.6402% 55.5038% -0.1364%
================================================
Files 494 503 +9
Lines 61283 62129 +846
================================================
+ Hits 34098 34484 +386
- Misses 23750 24195 +445
- Partials 3435 3450 +15 |
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: 935c1ea
|
/run-leak-test |
/run-kafka-integration-test |
2 similar comments
/run-kafka-integration-test |
/run-kafka-integration-test |
/run-kafka-integration-test /tidb=pr/32081 |
What problem does this PR solve?
Issue Number: ref #3242
What is changed and how it works?
DM side switched to the DML library of #4376
Check List
Tests
Code changes
Side effects
Related changes
Release note