-
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
*(dm): move downstream table info logic into sqlmodel #4885
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. |
Signed-off-by: lance6716 <[email protected]>
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.
no big problems, nice job to megre pkg of cdc and dm 🤙🤙🤙
LGTM
dm/pkg/schema/tracker.go
Outdated
AbsoluteUKIndexInfo *model.IndexInfo // absolute uk index is a pk/uk(not null) | ||
AvailableUKIndexList []*model.IndexInfo // index list which is all uks | ||
TableInfo *model.TableInfo // tableInfo which comes from parse create statement syntaxtree | ||
WhereHandleCache *sqlmodel.WhereHandle |
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 call this cache ?
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.
it's computed once for many row changes
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.
the whole struct is cached in tr.dsTracker.tableInfos
which should be called xxxCache
.
prefer remove this suffix here.
dm/pkg/schema/tracker.go
Outdated
dti = GetDownStreamTI(downstreamTI, originTi) | ||
dti = &DownstreamTableInfo{ | ||
TableInfo: downstreamTI, | ||
WhereHandleCache: sqlmodel.GetWhereHandle(originTi, downstreamTI), |
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 can rename downstreamTI
to downstreamTi
😂
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.
TI = TableInfo
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.
but another one called originTi 😂
// - an UNIQUE index and the data is all NOT NULL. | ||
// For the last case, last used index is swapped to front. | ||
func (h *WhereHandle) getWhereIdxByData(data []interface{}) *model.IndexInfo { | ||
if h == 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.
seems h never equal to 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.
Just to improve robustness because WhereHandle is public
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 log something, should be a bug in most usage.
Signed-off-by: lance6716 <[email protected]>
https://ci.pingcap.net/blue/organizations/jenkins/ut-check/detail/ut-check/5428/pipeline/ @GMHDBJD seems didn't fix the unstable case |
ping @GMHDBJD |
pkg/sqlmodel/where_handle.go
Outdated
} | ||
// use downstream columns to check NOT NULL constraint | ||
if ret.UniqueNotNullIdx == nil && allColsNotNull(idx, target.Columns) { | ||
// TODO: considering cardinality |
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 does this todo mean?
// - an UNIQUE index and the data is all NOT NULL. | ||
// For the last case, last used index is swapped to front. | ||
func (h *WhereHandle) getWhereIdxByData(data []interface{}) *model.IndexInfo { | ||
if h == 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.
maybe log something, should be a bug in most usage.
dm/pkg/schema/tracker.go
Outdated
AbsoluteUKIndexInfo *model.IndexInfo // absolute uk index is a pk/uk(not null) | ||
AvailableUKIndexList []*model.IndexInfo // index list which is all uks | ||
TableInfo *model.TableInfo // tableInfo which comes from parse create statement syntaxtree | ||
WhereHandleCache *sqlmodel.WhereHandle |
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.
the whole struct is cached in tr.dsTracker.tableInfos
which should be called xxxCache
.
prefer remove this suffix here.
Signed-off-by: lance6716 <[email protected]>
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 3a7a66e
|
/run-leak-test |
What problem does this PR solve?
Issue Number: close #4287
What is changed and how it works?
Check List
Tests
Code changes
Release note