-
Notifications
You must be signed in to change notification settings - Fork 286
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/filter(ticdc): ignore ddl in ddl_manager #10518
Conversation
Skipping CI for Draft Pull Request. |
fc9f75d
to
7bc6895
Compare
/test all |
7bc6895
to
05666a5
Compare
/test all |
m.justSentDDL = m.executingDDL | ||
m.executingDDL = nil | ||
m.cleanCache() | ||
skip, cleanMsg, err := m.shouldSkipDDL(m.executingDDL) |
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 do we decide whether to skip this ddl here, but not in where we append ddls into pendingDDLs in "ddlManager.tick"?
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.
Because all ddls must be cached in pengingDDLs until m.checkpointTs == nextDDL.CommitTs
. Otherwise, the changefeed's checkpoint cannot be guaranteed to be correct.
/test all pd=7.6.0 |
cdc/owner/changefeed.go
Outdated
@@ -597,13 +597,13 @@ LOOP2: | |||
} | |||
c.barriers.Update(finishBarrier, c.latestInfo.GetTargetTs()) | |||
|
|||
f, err := filter.NewFilter(c.latestInfo.Config, "") | |||
filter, err := filter.NewFilter(c.latestInfo.Config, "") |
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.
filter
is also the package name, so I renamed it to f
. filter
looks good to me, but report warning by the IDE
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.
Use the package alias pfilter
, PTAL
// In a BDR mode cluster, TiCDC can receive DDLs from all roles of TiDB. | ||
// However, CDC only executes the DDLs from the TiDB that has BDRRolePrimary role. | ||
if m.BDRMode && ddl.BDRRole != string(ast.BDRRolePrimary) { | ||
return true, "changefeed is in BDRMode and the DDL is not executed by Primary Cluster, skip it", 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.
the second returned value looks used to print log, can we just print the log here, instead of return it ?
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.
If redo is enabled, shouldSkipDDL will be called twice, so we use the return value to avoid printing duplicate logs.
e68d852
to
2661127
Compare
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: 3AceShowHand, hongyunyan, sdojjy The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
/retest |
/test all |
/retest |
1 similar comment
/retest |
Codecov Report
Additional details and impacted files
Flags with carried forward coverage won't be shown. Click here to find out more. @@ Coverage Diff @@
## master #10518 +/- ##
================================================
- Coverage 57.4992% 57.4569% -0.0423%
================================================
Files 849 848 -1
Lines 126073 125795 -278
================================================
- Hits 72491 72278 -213
+ Misses 48174 48116 -58
+ Partials 5408 5401 -7 |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
In response to a cherrypick label: new pull request created to branch |
In response to a cherrypick label: new pull request created to branch |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
In response to a cherrypick label: new pull request created to branch |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
What problem does this PR solve?
Issue Number: close #10524
What is changed and how it works?
After this pr, the behavior of TiCDC in ignoring create/delete/truncate/alter DDL scenarios is as follows:
Case 1: After a table or partition is created, TiCDC synchronizes the new physical table.
Case 2: After a table or partition is dropped, TiCDC does not synchronize the deleted physical table.
Case 3: After a table or partition is truncated, TiCDC does not synchronize the deleted physical table, and synchronizes the new physical table.
Case 4: After the Alter table or partition ddl, CDC uses the schma of the new table to parse data.
Check List
Tests
Questions
Will it cause performance regression or break compatibility?
Do you need to update user documentation, design documentation or monitoring documentation?
Release note