Skip to content

changefeedccl: support top-level compression option for Kafka sinks#164584

Open
varundeepsaini wants to merge 1 commit intocockroachdb:masterfrom
varundeepsaini:changefeedccl-kafka-top-level-compression
Open

changefeedccl: support top-level compression option for Kafka sinks#164584
varundeepsaini wants to merge 1 commit intocockroachdb:masterfrom
varundeepsaini:changefeedccl-kafka-top-level-compression

Conversation

@varundeepsaini
Copy link

@varundeepsaini varundeepsaini commented Feb 28, 2026

Fixes #113495
Previously, the compression changefeed option was incompatible with Kafka
sinks. Users had to configure compression through kafka_sink_config JSON,
which was inconsistent with other sinks (cloud storage, webhook) that
supported the top-level compression option directly.

This PR adds support for the compression option on Kafka sinks,
accepting all Kafka-supported codecs: gzip, snappy, lz4, and zstd.
When both the top-level compression option and kafka_sink_config.Compression
are set, they must match or an error is returned to avoid ambiguous
configuration. The change applies to both the v1 (sarama) and v2 (kgo)
Kafka sink implementations.

Additionally, the compression option validation is changed from a
fixed enum (gzip, zstd) to a free-form string, since valid compression
codecs are sink-dependent (e.g., Kafka supports snappy and lz4 in
addition to gzip and zstd). Each sink now validates the compression
value it receives.

Release note (enterprise change): Kafka changefeeds now accept the
top-level `compression` option (e.g. `WITH compression='gzip'`),
matching the syntax already supported by other sink types.

Signed-off-by: Varun Deep Saini <varun.23bcs10048@ms.sst.scaler.com>
@varundeepsaini varundeepsaini requested a review from a team as a code owner February 28, 2026 08:03
@varundeepsaini varundeepsaini requested review from KeithCh and removed request for a team February 28, 2026 08:03
@trunk-io
Copy link
Contributor

trunk-io bot commented Feb 28, 2026

Merging to master in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

@blathers-crl
Copy link

blathers-crl bot commented Feb 28, 2026

Thank you for contributing to CockroachDB. Please ensure you have followed the guidelines for creating a PR.

My owl senses detect your PR is good for review. Please keep an eye out for any test failures in CI.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@blathers-crl blathers-crl bot added the O-community Originated from the community label Feb 28, 2026
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@cockroachlabs-cla-agent
Copy link

cockroachlabs-cla-agent bot commented Feb 28, 2026

CLA assistant check
All committers have signed the CLA.

@yuzefovich yuzefovich requested a review from aerfrei February 28, 2026 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

O-community Originated from the community

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cdc: Confusing kafka compression option

2 participants