Skip to content

Conversation

@PratRanj07
Copy link
Contributor

Update CreateTopics API to v5(First flexible version)
Now the CreateTopics response returns topic configs too

@PratRanj07 PratRanj07 requested a review from a team as a code owner October 13, 2025 13:54
Copilot AI review requested due to automatic review settings October 13, 2025 13:54
@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 updates the CreateTopics API to version 5 (the first flexible version) per KIP-482, enabling the CreateTopics response to return topic configuration data in addition to basic topic creation results.

  • Updates API version support from v4 to v5 with flexible message format
  • Adds new fields to topic result structure for partition count, replication factor, and configuration entries
  • Implements parsing logic for the enhanced response format with topic configuration data

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/rdkafka_request.h Adds function declaration for reading topic config error codes
src/rdkafka_request.c Implements topic config error code parsing and updates request format to v5 with flexible arrays and tags
src/rdkafka_aux.h Extends topic result structure with new fields for partition count, replication factor, and configs
src/rdkafka_aux.c Implements getter functions for new topic result fields and updates constructor/destructor
src/rdkafka_admin.h Adds declaration for ConfigEntry constructor function
src/rdkafka_admin.c Implements response parsing for v5 format including config entries and updates ConfigEntry visibility
src/rdkafka.h Adds public API functions for accessing new topic result data
tests/test.c Adds test assertions for verifying partition count and replication factor in topic results

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

Comment on lines 68 to 70
if (!*cntp)
return NULL;
*cntp = rd_list_cnt(&topicres->configs);
Copy link

Copilot AI Oct 13, 2025

Choose a reason for hiding this comment

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

The condition checks if *cntp is zero before reading the list count. This logic is backwards - it should check if cntp is NULL to avoid dereferencing a null pointer, then set *cntp to the list count.

Suggested change
if (!*cntp)
return NULL;
*cntp = rd_list_cnt(&topicres->configs);
size_t cnt = rd_list_cnt(&topicres->configs);
if (cntp)
*cntp = cnt;
if (cnt == 0)
return NULL;

Copilot uses AI. Check for mistakes.
int rd_kafka_buf_read_TopicConfigErrorCode(
rd_kafka_buf_t *rkbuf,
rd_kafka_resp_err_t *topic_config_err) {
const int log_decode_errors = LOG_ERR;
Copy link

Copilot AI Oct 13, 2025

Choose a reason for hiding this comment

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

The variable log_decode_errors is declared but never used in this function. It should be removed or used in error handling.

Suggested change
const int log_decode_errors = LOG_ERR;

Copilot uses AI. Check for mistakes.
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.

2 participants