Skip to content

kafka-consumer(ticdc): tolerate replayed resolved and DDL events#12596

Merged
ti-chi-bot[bot] merged 3 commits into
pingcap:masterfrom
wlwilliamx:fix/consumer-deal-duplicate-msg
Apr 24, 2026
Merged

kafka-consumer(ticdc): tolerate replayed resolved and DDL events#12596
ti-chi-bot[bot] merged 3 commits into
pingcap:masterfrom
wlwilliamx:fix/consumer-deal-duplicate-msg

Conversation

@wlwilliamx
Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: close #12595

What is changed and how it works?

  • treat replayed resolved/checkpoint fallback in cmd/kafka-consumer as duplicate delivery instead of a fatal error
  • deduplicate replayed DDL events by logical DDL identity instead of pointer identity
  • add regression tests covering replayed resolved/checkpoint handling and equivalent versus split DDL events

Check List

Tests

  • Unit test
  • Manual test

Questions

Will it cause performance regression or break compatibility?

No. This only makes the standalone Kafka consumer tolerate duplicate MQ delivery in line with TiCDC's at-least-once behavior.

Do you need to update user documentation, design documentation or monitoring documentation?

No.

Release note

Fix `cdc_kafka_consumer` to tolerate replayed resolved/checkpoint and equivalent DDL messages under duplicate MQ delivery.

@ti-chi-bot
Copy link
Copy Markdown
Contributor

ti-chi-bot Bot commented Apr 8, 2026

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ti-chi-bot ti-chi-bot Bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 8, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request improves the Kafka consumer's resilience to replayed events by relaxing watermark fallback checks and introducing logical DDL deduplication. A critical feedback point highlights that the current deduplication logic for split DDLs (e.g., from RENAME TABLES) is insufficient when replaying sequences, as it only compares against the single most recent event. The reviewer suggests using CommitTs and Seq ordering to correctly identify and ignore replayed DDLs.

Comment thread cmd/kafka-consumer/writer.go Outdated
@wlwilliamx wlwilliamx marked this pull request as ready for review April 8, 2026 10:36
@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 Apr 8, 2026
@wlwilliamx
Copy link
Copy Markdown
Contributor Author

/retest

@wlwilliamx
Copy link
Copy Markdown
Contributor Author

/retest

3 similar comments
@wlwilliamx
Copy link
Copy Markdown
Contributor Author

/retest

@wlwilliamx
Copy link
Copy Markdown
Contributor Author

/retest

@wlwilliamx
Copy link
Copy Markdown
Contributor Author

/retest

@ti-chi-bot ti-chi-bot Bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Apr 13, 2026
@wlwilliamx
Copy link
Copy Markdown
Contributor Author

/test pull-cdc-integration-storage-test

@ti-chi-bot
Copy link
Copy Markdown
Contributor

ti-chi-bot Bot commented Apr 14, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 3AceShowHand, lidezhu

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [3AceShowHand,lidezhu]

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 added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Apr 14, 2026
@ti-chi-bot
Copy link
Copy Markdown
Contributor

ti-chi-bot Bot commented Apr 14, 2026

[LGTM Timeline notifier]

Timeline:

  • 2026-04-13 09:08:14.123555123 +0000 UTC m=+1379299.328915170: ☑️ agreed by lidezhu.
  • 2026-04-14 03:50:35.02735839 +0000 UTC m=+1446640.232718457: ☑️ agreed by 3AceShowHand.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (master@ba2be49). Learn more about missing BASE report.
⚠️ Report is 7 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
Components Coverage Δ
cdc 57.9375% <ø> (?)
dm 49.1761% <ø> (?)
engine 50.7392% <ø> (?)
Flag Coverage Δ
cdc 57.9375% <ø> (?)
unit 53.7381% <ø> (?)

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

@@             Coverage Diff             @@
##             master     #12596   +/-   ##
===========================================
  Coverage          ?   53.7381%           
===========================================
  Files             ?       1011           
  Lines             ?     141168           
  Branches          ?          0           
===========================================
  Hits              ?      75861           
  Misses            ?      59568           
  Partials          ?       5739           
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@wlwilliamx
Copy link
Copy Markdown
Contributor Author

/retest

4 similar comments
@wlwilliamx
Copy link
Copy Markdown
Contributor Author

/retest

@wlwilliamx
Copy link
Copy Markdown
Contributor Author

/retest

@wlwilliamx
Copy link
Copy Markdown
Contributor Author

/retest

@wlwilliamx
Copy link
Copy Markdown
Contributor Author

/retest

@ti-chi-bot ti-chi-bot Bot merged commit 431c2af into pingcap:master Apr 24, 2026
29 checks passed
@wlwilliamx wlwilliamx added needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. labels Apr 24, 2026
@ti-chi-bot
Copy link
Copy Markdown
Member

In response to a cherrypick label: new pull request created to branch release-7.5: #12619.

@ti-chi-bot
Copy link
Copy Markdown
Member

In response to a cherrypick label: new pull request created to branch release-8.5: #12620.
But this PR has conflicts, please resolve them!

@ti-chi-bot
Copy link
Copy Markdown
Member

In response to a cherrypick label: new pull request created to branch release-8.1: #12621.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved lgtm needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cmd/kafka-consumer does not tolerate replayed resolved and DDL messages

4 participants