Skip to content

Conversation

@pranavrth
Copy link
Member

No description provided.

@pranavrth pranavrth requested a review from a team as a code owner November 27, 2025 08:39
Copilot AI review requested due to automatic review settings November 27, 2025 08:39
@confluent-cla-assistant
Copy link

🎉 All Contributor License Agreements have been signed. Ready to merge.
Please push an empty commit if you would like to re-run the checks to verify CLA status for all contributors.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR documents contract changes related to KIP-848's regex subscription handling, specifically the shift from client-side to broker-side regex matching with a different regex engine.

  • Adds documentation for regex subscription behavior changes in the KIP-848 consumer protocol
  • Documents the migration from libc regex engine (client-side) to Google RE2/J engine (broker-side)
  • Provides a concrete example of regex pattern incompatibility between protocols

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


As part of adopting the `consumer` protocol, librdkafka (and derived clients) now rely on the broker’s RE2/J engine for regex-based subscriptions, effectively replacing the previous `libc`-based matching behavior.

Known case which would fail with the new protocol - We have `topic-1` and `topic-2`. If we subscribe with `^topic*` in the `classic` protocol, it works but it won't work in the `consumer` protocol. Use `^topic.*` instead.
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

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

[nitpick] The sentence structure is unclear and could be improved for better readability. Consider rephrasing to: 'A known incompatibility case: Given topics topic-1 and topic-2, the pattern ^topic* works in the classic protocol but fails in the consumer protocol. Use ^topic.* instead.'

Suggested change
Known case which would fail with the new protocol - We have `topic-1` and `topic-2`. If we subscribe with `^topic*` in the `classic` protocol, it works but it won't work in the `consumer` protocol. Use `^topic.*` instead.
A known incompatibility case: Given topics `topic-1` and `topic-2`, the pattern `^topic*` works in the `classic` protocol but fails in the `consumer` protocol. Use `^topic.*` instead.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@emasab emasab left a comment

Choose a reason for hiding this comment

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

Thanks for the clarification I proposed some changes.
There's also a change to the example regex ^topic given using ^topic* is also matching topi and we don't want to add this element that creates confusion about the proposed example change.


As part of adopting the `consumer` protocol, librdkafka (and derived clients) now rely on the broker’s RE2/J engine for regex-based subscriptions, effectively replacing the previous `libc`-based matching behavior.

Known case which would fail with the new protocol - We have `topic-1` and `topic-2`. If we subscribe with `^topic*` in the `classic` protocol, it works but it won't work in the `consumer` protocol. Use `^topic.*` instead.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Known case which would fail with the new protocol - We have `topic-1` and `topic-2`. If we subscribe with `^topic*` in the `classic` protocol, it works but it won't work in the `consumer` protocol. Use `^topic.*` instead.
A known case which would fail with the new protocol: we have topics `topic-1` and `topic-2`. If we subscribe with `^topic` in the `classic` protocol, it's assigned partitions from both topics but no partitions is assigned with the `consumer` protocol. That's because the broker side regex implementation as well as the Java classic protocol one require that regexes match the complete topic while `libc` one finds the pattern into the topic, that could be present as a prefix. To obtain the same result with this example you'd use `^topic.*` instead.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants