-
Notifications
You must be signed in to change notification settings - Fork 3.2k
[KIP-482]: Update CreateTopics API #5217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
🎉 All Contributor License Agreements have been signed. Ready to merge. |
There was a problem hiding this 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.
src/rdkafka_aux.c
Outdated
| if (!*cntp) | ||
| return NULL; | ||
| *cntp = rd_list_cnt(&topicres->configs); |
Copilot
AI
Oct 13, 2025
There was a problem hiding this comment.
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.
| 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; |
| 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; |
Copilot
AI
Oct 13, 2025
There was a problem hiding this comment.
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.
| const int log_decode_errors = LOG_ERR; |
Update CreateTopics API to v5(First flexible version)
Now the CreateTopics response returns topic configs too