Skip to content
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

Merged
merged 16 commits into from
Feb 11, 2022
Merged

syncer(dm): use DML library #4313

merged 16 commits into from
Feb 11, 2022

Conversation

lance6716
Copy link
Contributor

@lance6716 lance6716 commented Jan 13, 2022

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

  • pass original test

Code changes

Side effects

Related changes

Release note

`None`.

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Jan 13, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • GMHDBJD
  • glorv

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added do-not-merge/needs-linked-issue do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jan 13, 2022
@ti-chi-bot ti-chi-bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jan 13, 2022
@Ehco1996 Ehco1996 added area/ticdc Issues or PRs related to TiCDC. area/dm Issues or PRs related to DM. labels Jan 13, 2022
@lance6716 lance6716 force-pushed the common-dml branch 4 times, most recently from 42845c2 to a2ac57d Compare January 16, 2022 09:45
@lance6716
Copy link
Contributor Author

/run-dm-integration-test

@lance6716
Copy link
Contributor Author

GBK integration test has passed succesful, I'll split this PR into smaller ones to make it easier to review

@lance6716
Copy link
Contributor Author

/run-dm-integration-test

@lance6716
Copy link
Contributor Author

/run-dm-integration-test

@lance6716
Copy link
Contributor Author

/run-dm-integration-test

@lance6716
Copy link
Contributor Author

@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 26, 2022
@lance6716
Copy link
Contributor Author

unit tests and integration tests passed. Most changes are to cope with existing unit tests and delete repeat codes.

/cc @GMHDBJD @glorv @Ehco1996

Copy link
Contributor

@GMHDBJD GMHDBJD left a 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
}
Copy link
Contributor

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?

Copy link
Contributor Author

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

if j.dml.op == update && j.dml.updateIdentify() {
delDML, insertDML := updateToDelAndInsert(j.dml)
if j.dml.IsIdentityUpdated() {
delDML, insertDML := j.dml.Split()
Copy link
Contributor

Choose a reason for hiding this comment

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

How about SplitUpdate()

Copy link
Contributor

@GMHDBJD GMHDBJD left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Feb 10, 2022
@lance6716
Copy link
Contributor Author

ptal @Ehco1996 @glorv @lichunzhu

CI has passed in previous commits

Copy link
Contributor

@glorv glorv left a 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()
Copy link
Contributor

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 {
Copy link
Contributor

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.

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Feb 11, 2022
dm/syncer/dml.go Outdated
}
return
}

// genDMLParam stores pruned columns, data as well as the original columns, data, index.
Copy link
Contributor

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

@lance6716
Copy link
Contributor Author

updated, PTAL @lichunzhu

@codecov-commenter
Copy link

codecov-commenter commented Feb 11, 2022

Codecov Report

Merging #4313 (935c1ea) into master (9607554) will decrease coverage by 0.1363%.
The diff coverage is 61.6892%.

Flag Coverage Δ
cdc 60.3103% <62.9976%> (+0.3880%) ⬆️
dm 51.3658% <61.0678%> (-0.6631%) ⬇️

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     

Copy link
Contributor

@lichunzhu lichunzhu left a comment

Choose a reason for hiding this comment

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

LGTM

@lance6716
Copy link
Contributor Author

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 935c1ea

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Feb 11, 2022
@lance6716
Copy link
Contributor Author

/run-leak-test
/run-integration-test
/run-kafka-integration-test

@lance6716
Copy link
Contributor Author

/run-kafka-integration-test

2 similar comments
@lance6716
Copy link
Contributor Author

/run-kafka-integration-test

@lance6716
Copy link
Contributor Author

/run-kafka-integration-test

@lance6716
Copy link
Contributor Author

/run-kafka-integration-test /tidb=pr/32081

@ti-chi-bot ti-chi-bot merged commit edad7da into pingcap:master Feb 11, 2022
zhaoxinyu pushed a commit to zhaoxinyu/ticdc that referenced this pull request Feb 16, 2022
@lance6716 lance6716 deleted the common-dml branch October 13, 2022 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/dm Issues or PRs related to DM. area/ticdc Issues or PRs related to TiCDC. release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants