Skip to content

Conversation

emasab
Copy link
Contributor

@emasab emasab commented Sep 23, 2025

and none of many topics in the cluster are matching it.

@emasab emasab requested a review from a team as a code owner September 23, 2025 17:52
@Copilot Copilot AI review requested due to automatic review settings September 23, 2025 17:52
@emasab emasab marked this pull request as draft September 23, 2025 17:52
@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 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 addresses a performance regression when subscribing with regex patterns in scenarios where few topics in the cluster match the pattern. The main optimization replaces the inefficient approach of copying all cached topics to a list with direct iteration over the metadata cache, and introduces deduplication to handle multiple cache entries with the same topic name.

  • Replaces topic list creation with direct cache iteration using TAILQ_FOREACH
  • Adds a hash map for deduplication to avoid processing duplicate topic names
  • Introduces early exit logic for already-matched topics to improve efficiency

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

if (matched)
/*
* Just remove it from unmatched.
* Topic was already add to
Copy link

Copilot AI Sep 23, 2025

Choose a reason for hiding this comment

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

Line 1298 contains a grammatical error: 'add' should be 'added'.

Suggested change
* Topic was already add to
* Topic was already added to

Copilot uses AI. Check for mistakes.

continue;
RD_MAP_SET(&map, topic, topic);

mdt = &rkmce->rkmce_mtopic;
Copy link

Copilot AI Sep 23, 2025

Choose a reason for hiding this comment

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

[nitpick] Extra space between 'mdt' and '=' creates inconsistent formatting. Should be single space like other assignments.

Suggested change
mdt = &rkmce->rkmce_mtopic;
mdt = &rkmce->rkmce_mtopic;

Copilot uses AI. Check for mistakes.

@airlock-confluentinc airlock-confluentinc bot force-pushed the dev_fix_performance_regression_matching_regex branch from f34492b to 933adfa Compare September 23, 2025 21:47
@airlock-confluentinc airlock-confluentinc bot force-pushed the dev_fix_performance_regression_matching_regex branch from 933adfa to 2834d65 Compare September 24, 2025 06:48
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.

1 participant