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

sink(ticdc): DDL event support for the Debezium protocol #11674

Merged
merged 45 commits into from
Nov 12, 2024

Conversation

wk989898
Copy link
Collaborator

@wk989898 wk989898 commented Oct 21, 2024

What problem does this PR solve?

Issue Number: close #11566

What is changed and how it works?

Debezium provides the SQL CREATE, ALTER, or DROP statement that results in the schema change. https://debezium.io/documentation/reference/2.7/connectors/mysql.html#mysql-schema-change-topic
This PR implements encoding for the DDL event and checkpoint event.

Difference between TiCDC and Debezium:

  • Default length display
    • Debezium output is different when setting the default length. e.g. int length is nil but int(11) length is 11
  • Unsupported data type
    • TiCDC converts DECIMAL to NUMERIC
    • TiCDC converts INTEGER to INT
    • TiCDC converts REAL to FLOAT when setting sql_mode='REAL_AS_FLOAT'
    • TiCDC converts BOOLEAN to TINYINT(1)
  • Generated column
  • TiCDC does not support some DDLs
    • Alter table add/drop foreign key
    • Adding a new column and setting it to the primary key
    • Dropping primary key columns or columns covered by the composite index
  • Debezium does not support some DDLs
    • Alter/Remove TTL
    • Recover table
  • Default value
    • In TiCDC, BLOB, TEXT, GEOMETRY, or JSON column 'binaryRepresentation' can't have a default value
    • BIT defaultValueExpression may not same when the length of the default value is not equal to the column length
  • Incorrect FLOAT data output
  • Incorrect charset name
    • Debezium converts charsetName to "utf8mb4" when column COLLATE is "utf8_unicode_ci" and CHARACTER is null, but TiCDC doesn't
  • Incorrect enum elements
    • Debezium doesn't escape character, but TiCDC does. e.g. ENUM('c,'d', 'g,''h')
  • Incorrect default about TIME
    • TiCDC converts TIME default '1000-00-00 01:00:00.000' to "1000-00-00", but Debezium doesn't
    • Debezium produces the wrong result when the insert value is illegal like "-838:59:59.000000"

Check List

Tests

  • Unit test
  • Integration test

Questions

Will it cause performance regression or break compatibility?
Do you need to update user documentation, design documentation or monitoring documentation?

yes

Release note

DDL event support for the Debezium protocol

@ti-chi-bot ti-chi-bot bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Oct 21, 2024
@wk989898 wk989898 marked this pull request as draft October 22, 2024 10:27
@ti-chi-bot ti-chi-bot bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 22, 2024
@wk989898
Copy link
Collaborator Author

wk989898 commented Nov 4, 2024

/ok-to-test

@ti-chi-bot ti-chi-bot bot added the ok-to-test Indicates a PR is ready to be tested. label Nov 4, 2024
@wk989898 wk989898 marked this pull request as ready for review November 5, 2024 05:21
@ti-chi-bot ti-chi-bot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 5, 2024
@wk989898
Copy link
Collaborator Author

/retest

Copy link
Collaborator

@hongyunyan hongyunyan left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Nov 12, 2024
@ti-chi-bot ti-chi-bot bot added the lgtm label Nov 12, 2024
Copy link
Contributor

ti-chi-bot bot commented Nov 12, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: CharlesCheung96, hongyunyan

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:
  • OWNERS [CharlesCheung96,hongyunyan]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot removed the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Nov 12, 2024
Copy link
Contributor

ti-chi-bot bot commented Nov 12, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-11-12 01:40:00.695659864 +0000 UTC m=+320362.886528856: ☑️ agreed by hongyunyan.
  • 2024-11-12 10:40:09.137144264 +0000 UTC m=+352771.328013260: ☑️ agreed by CharlesCheung96.

@ti-chi-bot ti-chi-bot bot merged commit 0e0b615 into pingcap:master Nov 12, 2024
28 checks passed
@wk989898 wk989898 deleted the debezium branch January 6, 2025 02:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm ok-to-test Indicates a PR is ready to be tested. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support ddl event of debezium protocol
3 participants