Skip to content

sink: add debezium-avro protocol (#5475) - #5809

Merged
ti-chi-bot[bot] merged 6 commits into
pingcap:release-8.5from
ti-chi-bot:cherry-pick-5475-to-release-8.5
Oct 13, 2026
Merged

ti-chi-bot[bot] merged 6 commits into
pingcap:release-8.5from
ti-chi-bot:cherry-pick-5475-to-release-8.5

Conversation

@ti-chi-bot

Copy link
Copy Markdown
Member

This is an automated cherry-pick of #5475

What problem does this PR solve?

Issue Number: close #5476

What is changed and how it works?

This PR introduces a new Kafka sink protocol: protocol=debezium-avro.

The new protocol is intended for users who need both:

  1. Debezium-compatible change event semantics.
  2. Confluent Avro binary encoding with Schema Registry integration.

Before this change, TiCDC had two separate protocols that each solved only
one side of the requirement:

  • protocol=debezium emits Debezium-style key/value messages, but the
    messages are JSON and the schema is embedded in each message.
  • protocol=avro emits Confluent Avro messages and registers schemas in
    Schema Registry, but the payload is TiCDC's flat row format rather than a
    Debezium Envelope.

protocol=debezium-avro combines these two capabilities. It reuses the
Debezium codec's event model and field extraction logic, and reuses the
existing Avro Schema Registry registration and Confluent wire-format flow.

Users can enable it with a sink URI like:

 cdc cli changefeed create \
  --server=http://127.0.0.1:8300 \
  --changefeed-id=debezium-avro-demo \
  --sink-uri='kafka://127.0.0.1:9092/ticdc-debezium-avro-glue-demo' \
  --config=/path/to/changefeed-glue.toml

Protocol and configuration

This PR adds ProtocolDebeziumAvro to the sink protocol enum and protocol
parser, so protocol=debezium-avro can be used in Kafka sink URIs and
changefeed configs.

The protocol is treated as an Avro-like protocol where needed, including:

  • requiring Schema Registry configuration;
  • preserving Schema Registry fields in changefeed config cleanup;
  • using Kafka Avro-related validation paths;
  • creating the Debezium Avro encoder/decoder from the codec builder;
  • supporting the bundled cdc_kafka_consumer decode path.

For the MVP, Debezium Avro supports Confluent Schema Registry through
schema-registry and AWS Glue Schema Registry.

The protocol also keeps the existing Avro type-mode options where
applicable:

  • avro-decimal-handling-mode
  • avro-bigint-unsigned-handling-mode

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?

Release note

support debezium-avro protocol

Summary by CodeRabbit

Summary

  • New Features
    • Added debezium-avro sink protocol support with Confluent Schema Registry–based encoding/decoding.
    • Extended Avro-like routing, DDL/DML handling, and watermark-related behavior to debezium-avro.
  • Bug Fixes
    • Improved Kafka consumer partition discovery for comma-separated topic lists with retry-based metadata lookup.
    • Retained schema registry settings for Avro-related protocols, including debezium-avro.
  • Tests
    • Expanded unit and integration coverage for debezium-avro, including protocol parsing and schema/encoding behaviors.
  • Chores
    • Updated linter configuration to exclude an additional GoSec finding.

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot ti-chi-bot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm 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. type/cherry-pick-for-release-8.5 This PR is cherry-picked to release-8.5 from a source PR. labels Jul 29, 2026
@ti-chi-bot

Copy link
Copy Markdown
Member Author

@wk989898 This PR has conflicts, I have hold it.
Please resolve them or ask others to resolve them, then comment /unhold to remove the hold label.

@ti-chi-bot

ti-chi-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown

@ti-chi-bot: ## If you want to know how to resolve it, please read the guide in TiDB Dev Guide.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@coderabbitai

coderabbitai Bot commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 35 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1948cce3-0b91-4004-b877-54b54bb7edde
📥 Commits

Reviewing files that changed from the base of the PR and between 36a962a and 8cd23f9.

📒 Files selected for processing (27)
  • .golangci.yml
  • api/v2/changefeed.go
  • cmd/kafka-consumer/writer.go
  • cmd/kafka-consumer/writer_test.go
  • downstreamadapter/sink/helper/helper.go
  • downstreamadapter/sink/kafka/helper.go
  • pkg/config/changefeed.go
  • pkg/config/changefeed_test.go
  • pkg/config/sink.go
  • pkg/config/sink_protocol.go
  • pkg/config/sink_protocol_test.go
  • pkg/sink/codec/builder.go
  • pkg/sink/codec/common/config.go
  • pkg/sink/codec/common/config_test.go
  • pkg/sink/codec/debezium/avro.go
  • pkg/sink/codec/debezium/avro_decoder.go
  • pkg/sink/codec/debezium/avro_test.go
  • pkg/sink/codec/debezium/codec.go
  • pkg/sink/codec/debezium/decoder.go
  • pkg/sink/codec/debezium/encoder.go
  • tests/integration_tests/debezium_avro/conf/diff_config.toml
  • tests/integration_tests/debezium_avro/data/ddl.sql
  • tests/integration_tests/debezium_avro/data/post_ddl_workload.sql
  • tests/integration_tests/debezium_avro/data/prepare.sql
  • tests/integration_tests/debezium_avro/data/workload.sql
  • tests/integration_tests/debezium_avro/run.sh
  • tests/integration_tests/run_light_it_in_ci.sh
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ti-chi-bot ti-chi-bot Bot added cherry-pick-approved Cherry pick PR approved by release team. and removed do-not-merge/cherry-pick-not-approved labels Aug 3, 2026
@ti-chi-bot

Copy link
Copy Markdown
Member Author

Cherry-pick conflicts appear resolved; removing the do-not-merge/hold label.

@ti-chi-bot ti-chi-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 3, 2026
Signed-off-by: wk989898 <nhsmwk@gmail.com>
@wk989898 wk989898 added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 3, 2026
@ti-chi-bot ti-chi-bot Bot added do-not-merge/cherry-pick-not-approved and removed cherry-pick-approved Cherry pick PR approved by release team. labels Aug 3, 2026
@ti-chi-bot ti-chi-bot Bot added cherry-pick-approved Cherry pick PR approved by release team. and removed do-not-merge/cherry-pick-not-approved labels Sep 28, 2026
@wk989898 wk989898 removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 13, 2026
@ti-chi-bot

ti-chi-bot Bot commented Oct 13, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lidezhu, wk989898

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:

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 the approved label Oct 13, 2026
@wk989898

Copy link
Copy Markdown
Collaborator

/retest

1 similar comment
@wk989898

Copy link
Copy Markdown
Collaborator

/retest

@ti-chi-bot
ti-chi-bot Bot merged commit b23ca4d into pingcap:release-8.5 Oct 13, 2026
20 checks passed
wk989898 added a commit to ti-chi-bot/ticdc that referenced this pull request Nov 19, 2026
PR pingcap#5809 already backported pingcap#5475 to release-8.5. The second automated cherry-pick only added unresolved conflict blocks. Restore the release branch content to retain the backport and its follow-up changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved cherry-pick-approved Cherry pick PR approved by release team. lgtm 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. type/cherry-pick-for-release-8.5 This PR is cherry-picked to release-8.5 from a source PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants