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 add default value type unsupported #3846

Merged
merged 7 commits into from
Dec 13, 2021
Merged

mounter(ticdc): fix mounter add default value type unsupported #3846

merged 7 commits into from
Dec 13, 2021

Conversation

maxshuang
Copy link
Contributor

@maxshuang maxshuang commented Dec 13, 2021

close #3793

What problem does this PR solve?

Fix default value unsupported bug cause by amend feature of tidb, related to issue #3793

Amend feature of TiDB:
As for add column DDL, if a DDL occur between a trx, the trx will not redo but commit the old schema data directly, which will cause TiCDC use new schema to parse old schema data.

What is changed and how it works?

After call "getDefaultOrZeroValue", we need to call "formatColVal" to format data from the tidb type to go supported sql type

Check List

Tests

  • Unit test
  • Integration 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 date not null;

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 mounter default date value not support

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Dec 13, 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/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Dec 13, 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.go Show resolved Hide resolved
cdc/entry/mounter_test.go Outdated Show resolved Hide resolved

func testGetDefaultZeroValue(t *testing.T, colAndRess []columnInfoAndResult) {
for _, colAndRes := range colAndRess {
val, _, _, _ := getDefaultOrZeroValue(&colAndRes.ColInfo)
Copy link
Contributor

Choose a reason for hiding this comment

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

Better to check the other return values

Copy link
Contributor Author

Choose a reason for hiding this comment

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

May need more unit tests also. I will add more in other pr.

cdc/entry/mounter_test.go Outdated Show resolved Hide resolved
@amyangfei amyangfei 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. type/bugfix This PR fixes a bug. labels Dec 13, 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.

LGTM

cdc/entry/mounter.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 13, 2021
@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 Dec 13, 2021
@amyangfei
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: 80f59cb

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Dec 13, 2021
@ti-chi-bot
Copy link
Member

Merge canceled because a new commit is pushed.

@ti-chi-bot ti-chi-bot removed the status/can-merge Indicates a PR has been approved by a committer. label Dec 13, 2021
ti-chi-bot pushed a commit to ti-chi-bot/tiflow that referenced this pull request Dec 13, 2021
@ti-chi-bot
Copy link
Member

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

@overvenus
Copy link
Member

/run-cherry-picker

ti-chi-bot pushed a commit to ti-chi-bot/tiflow that referenced this pull request Dec 13, 2021
@ti-chi-bot
Copy link
Member

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

ti-chi-bot pushed a commit to ti-chi-bot/tiflow that referenced this pull request Dec 13, 2021
@ti-chi-bot
Copy link
Member

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

@ti-chi-bot
Copy link
Member

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

ti-chi-bot pushed a commit to ti-chi-bot/tiflow that referenced this pull request Dec 13, 2021
@ti-chi-bot
Copy link
Member

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

maxshuang pushed a commit that referenced this pull request Dec 16, 2021
maxshuang pushed a commit that referenced this pull request Dec 16, 2021
overvenus pushed a commit that referenced this pull request Dec 21, 2021
zhaoxinyu pushed a commit to zhaoxinyu/ticdc that referenced this pull request Dec 29, 2021
…ap#3846)

* mounter(ticdc): fix mounter add default value type unsupported

close  pingcap#3793

* test(mounter(ticdc)): fix unit test panic for enum

* comment(mounter(ticdc)): add some return value comment for mounter

* test(mounter(ticdc)): fix default value size unmatch error in uts

* mounter(ticdc): change comment

Co-authored-by: Neil Shen <[email protected]>

* test(mounter(ticdc)): close size check temporary

* chore(mounter(ticdc)): fix unused lint

Co-authored-by: Neil Shen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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
Development

Successfully merging this pull request may close these issues.

upgrade from v4.0.15 to v4.0.16, ticdc stoped with CDC:ErrProcessorUnknown
4 participants