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

mounter(ticdc): fix mounter default value panic and data inconsistency #3930

Merged
merged 12 commits into from
Dec 31, 2021
Merged

mounter(ticdc): fix mounter default value panic and data inconsistency #3930

merged 12 commits into from
Dec 31, 2021

Conversation

maxshuang
Copy link
Contributor

close #3929 #3918

What problem does this PR solve?

When meet "amend + add column datetime default '2020-10-10 10:10:10' (DDL)", TiCDC will

  1. panic, as the default value type is not consistent with column type
  2. data inconsistence

What is changed and how it works?

  1. Don't format default value in column meta data
  2. Check default value exist before check not null flag

Check List

Tests

  • Unit test
  • Manual test (add detailed scripts or steps below)
    Start 2 transactions:
  1. Transaction 1:
Create table test_column(id int primary key);
Insert Into test_column values(1);
begin;
Insert Into test_column values(2);
// hold the trx untill Transaction 2 commit DDL
commit;
  • Transaction 2:
alter table test_column add column c0 datetime default "2020-10-10 10:10:10";

Code changes

  • Has exported function/method change
  • Has exported variable/fields change
  • Has interface methods change
  • Has persistent data change

Side effects

  • Possible performance regression
  • Increased code complexity
  • Breaking backward compatibility

Related changes

  • Need to cherry-pick to the release branch
  • Need to update the documentation
  • Need to update key monitor metrics in both TiCDC document and official document

Release note

Fix column default value panic and data inconsistency

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Dec 16, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • amyangfei
  • overvenus

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 release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Dec 16, 2021
@maxshuang maxshuang added area/ticdc Issues or PRs related to TiCDC. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Dec 16, 2021
@codecov-commenter
Copy link

codecov-commenter commented Dec 16, 2021

Codecov Report

Merging #3930 (6425483) into master (3873d39) will decrease coverage by 1.9478%.
The diff coverage is 67.3486%.

Flag Coverage Δ
cdc 58.5789% <67.3486%> (+0.3423%) ⬆️
dm 52.2214% <ø> (-3.8132%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

@@               Coverage Diff                @@
##             master      #3930        +/-   ##
================================================
- Coverage   57.0741%   55.1263%   -1.9479%     
================================================
  Files           478        486         +8     
  Lines         56551      59848      +3297     
================================================
+ Hits          32276      32992       +716     
- Misses        20978      23506      +2528     
- Partials       3297       3350        +53     

Copy link
Member

@overvenus overvenus left a comment

Choose a reason for hiding this comment

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

Could you add a unit test?

@ti-chi-bot ti-chi-bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Dec 16, 2021
@maxshuang
Copy link
Contributor Author

Could you add a unit test?

Sure, I will do it later. So I hold the pr.

@ti-chi-bot ti-chi-bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Dec 17, 2021
@maxshuang maxshuang removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 17, 2021
@maxshuang maxshuang added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 20, 2021
@maxshuang
Copy link
Contributor Author

/run-dm-compatibility-test
/run-dm-integration-test
/run-integration-test
/run-kafka-integration-test

@maxshuang
Copy link
Contributor Author

/run-verify

@maxshuang
Copy link
Contributor Author

/run-kafka-integration-test
/run-integration-test
/run-dm-compatibility-test
/run-dm-integration-test

@maxshuang maxshuang removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 20, 2021
Copy link
Member

@overvenus overvenus 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

cdc/entry/mounter_test.go Outdated Show resolved Hide resolved
cdc/entry/mounter_test.go Outdated Show resolved Hide resolved
cdc/entry/mounter_test.go Outdated Show resolved Hide resolved
@maxshuang
Copy link
Contributor Author

/run-kafka-integration-test /tidb=pr/30773
/run-integration-tests /tidb=pr/30773

@maxshuang
Copy link
Contributor Author

/run-dm-compatibility-test
/run-dm-integration-test

cdc/entry/mounter.go Outdated Show resolved Hide resolved
Comment on lines +529 to +539
if d.IsNull() {
log.Error("meet unsupported column type", zap.String("column info", col.String()))
}
Copy link
Contributor

Choose a reason for hiding this comment

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

What will happen in this scenario?

Copy link
Contributor Author

@maxshuang maxshuang Dec 21, 2021

Choose a reason for hiding this comment

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

sink null to the downstream and cause data inconsistency for unsupported data type

@maxshuang
Copy link
Contributor Author

/run-kafka-integration-test /tidb=pr/30773
/run-integration-tests /tidb=pr/30773
/run-dm-compatibility-test
/run-dm-integration-test

Copy link
Member

@overvenus overvenus left a comment

Choose a reason for hiding this comment

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

LGTM

cdc/entry/mounter_test.go Outdated Show resolved Hide resolved
cdc/entry/mounter_test.go Outdated Show resolved Hide resolved
cdc/entry/mounter_test.go Outdated Show resolved Hide resolved
cdc/entry/mounter_test.go Outdated Show resolved Hide resolved
cdc/entry/mounter_test.go Outdated Show resolved Hide resolved
cdc/entry/mounter_test.go Outdated Show resolved Hide resolved
cdc/entry/mounter_test.go Outdated Show resolved Hide resolved
cdc/entry/mounter_test.go Outdated Show resolved Hide resolved
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Dec 21, 2021
@maxshuang maxshuang added needs-cherry-pick-release-4.0 Should cherry pick this PR to release-4.0 branch. needs-cherry-pick-release-5.0 Should cherry pick this PR to release-5.0 branch. needs-cherry-pick-release-5.1 Should cherry pick this PR to release-5.1 branch. needs-cherry-pick-release-5.2 Should cherry pick this PR to release-5.2 branch. needs-cherry-pick-release-5.3 Should cherry pick this PR to release-5.3 branch. and removed needs-cherry-pick-release-5.0 Should cherry pick this PR to release-5.0 branch. needs-cherry-pick-release-5.1 Should cherry pick this PR to release-5.1 branch. needs-cherry-pick-release-5.2 Should cherry pick this PR to release-5.2 branch. needs-cherry-pick-release-5.3 Should cherry pick this PR to release-5.3 branch. labels Jan 24, 2022
ti-chi-bot pushed a commit to ti-chi-bot/tiflow that referenced this pull request Jan 24, 2022
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #4442.

ti-chi-bot pushed a commit to ti-chi-bot/tiflow that referenced this pull request Jan 24, 2022
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #4443.

ti-chi-bot pushed a commit to ti-chi-bot/tiflow that referenced this pull request Jan 24, 2022
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #4444.

ti-chi-bot pushed a commit to ti-chi-bot/tiflow that referenced this pull request Jan 24, 2022
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #4445.

ti-chi-bot pushed a commit to ti-chi-bot/tiflow that referenced this pull request Jan 24, 2022
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request could not be created: failed to create pull request against pingcap/tiflow#release-5.3 from head ti-chi-bot:cherry-pick-3930-to-release-5.3: the GitHub API request returns a 403 error: {"message":"You have exceeded a secondary rate limit and have been temporarily blocked from content creation. Please retry your request again later.","documentation_url":"https://docs.github.com/rest/overview/resources-in-the-rest-api#secondary-rate-limits"}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ticdc Issues or PRs related to TiCDC. needs-cherry-pick-release-4.0 Should cherry pick this PR to release-4.0 branch. needs-cherry-pick-release-5.0 Should cherry pick this PR to release-5.0 branch. needs-cherry-pick-release-5.1 Should cherry pick this PR to release-5.1 branch. needs-cherry-pick-release-5.2 Should cherry pick this PR to release-5.2 branch. needs-cherry-pick-release-5.3 Should cherry pick this PR to release-5.3 branch. 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. status/LGT2 Indicates that a PR has LGTM 2. type/bugfix This PR fixes a bug.
Projects
None yet
5 participants