-
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
pkg(both): a separate library for DML row change #4376
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. |
Codecov Report
Flags with carried forward coverage won't be shown. Click here to find out more. @@ Coverage Diff @@
## master #4376 +/- ##
================================================
- Coverage 55.5183% 55.4169% -0.1014%
================================================
Files 495 498 +3
Lines 61151 61649 +498
================================================
+ Hits 33950 34164 +214
- Misses 23789 24063 +274
- Partials 3412 3422 +10 |
/cc @glorv |
pkg/sqlmodel/row_change.go
Outdated
if tiCtx != nil { | ||
ret.tiSessionCtx = tiCtx | ||
} else { | ||
ret.tiSessionCtx = utils.NewSessionCtx(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.
Can you check the cost of NewSessionCtx
?
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.
changed to use a global variable
dm/pkg/utils/common.go
Outdated
variables.Rng.SetSeed1(0) | ||
variables.Rng.SetSeed2(0) |
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.
What are these two lines used for?
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.
Removed now. Originally I'm use different session context instance for each RowChange, their random seed fields are different so can't pass DeepEquals
I think this library can provide different Causality function like RowCausality, TableCausality 🤔
Will add it in future PR because I want to reduce divergence with #4313 |
pkg/sqlmodel/multivalue.go
Outdated
"github.com/pingcap/tiflow/pkg/quotes" | ||
) | ||
|
||
// SameTypeTargetAndColumns check whether two row changes have same type, target and columns, so they can be merged to a |
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.
Please keep line width within 80 chars.
pkg/sqlmodel/row_change.go
Outdated
r.identityInfo = schema.GetDownStreamTI(r.targetTableInfo, r.sourceTableInfo) | ||
} | ||
|
||
func getColsAndValuesOfIdx(columns []*timodel.ColumnInfo, indexColumns *timodel.IndexInfo, data []interface{}) ([]*timodel.ColumnInfo, []interface{}) { |
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.
Please keep line width within 80 chars.
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.
1 table = 4 spaces.
ping @glorv |
ping @amyangfei @liuzix @GMHDBJD |
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: d58b935
|
/check-issue-triage-complete |
/run-dm-integration-test |
/hold test failed |
/run-dm-integration-test |
/unhold |
This pull request has been accepted and is ready to merge. Commit hash: f2c4bcb
|
/run-kafka-integration-test |
What problem does this PR solve?
Issue Number: ref #3242
What is changed and how it works?
provide a representation for DML (row change), and some conversion of it. Also fix some wrong behaviour of original code (such as we should decide generated column from target table structure)
next PR I'll let DM adopt this library, and future plans are
Check List
Tests
Code changes
Side effects
Related changes
Release note