Repository navigation
[KIP 482]: Upgrade ACL APis to Version 2(First flexible version) - #5081
Conversation
|
🎉 All Contributor License Agreements have been signed. Ready to merge. |
There was a problem hiding this comment.
Pull Request Overview
Updates ACL Admin APIs (CreateAcls, DescribeAcls, DeleteAcls) to use version 2 flexible requests per KIP 482, including tag handling and updated protocol version support.
- Bump supported API version min from 1 to 2 and switch to
rd_kafka_buf_new_flexver_request - Replace fixed-length writes (
write_i32,write_str) with flexible versions (write_arraycnt,write_kstr) and handle empty tags - Add skipping of response tags in admin response parsing and update protocol versions in documentation
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/rdkafka_request.c | Use flexible-version request builder, update write calls, handle tags, bump API version checks |
| src/rdkafka_admin.c | Skip tags in response parsing for v2 ACL APIs |
| INTRODUCTION.md | Increment documented flexible-version fields for ACL API versions |
Comments suppressed due to low confidence (1)
src/rdkafka_request.c:5805
- The API version argument is hardcoded to
1; this should use the actualApiVersionvariable when constructing the flexible request.
rkbuf = rd_kafka_buf_new_flexver_request(rkb, RD_KAFKAP_DescribeAcls, 1,
|
|
||
| rd_kafka_buf_write_i8(rkbuf, new_acl->restype); | ||
|
|
||
| rd_kafka_buf_write_str(rkbuf, new_acl->name, -1); |
There was a problem hiding this comment.
rd_kafka_buf_write_str takes care of COMPACT_STRING as well. Same with below.
d7b9d1b to
f025417
Compare
| if (rd_kafka_buf_ApiVersion(reply) >= 2) { | ||
| rd_kafka_buf_skip_tags(reply); | ||
| } |
There was a problem hiding this comment.
Move this above with other buf parsing i.e. before if (error_code) {
|
|
||
| if (rd_kafka_buf_ApiVersion(reply) >= 2) { | ||
| rd_kafka_buf_skip_tags(reply); | ||
| } |
| if (ApiVersion >= 2) { | ||
| rd_kafka_buf_write_tags_empty(rkbuf); | ||
| } |
There was a problem hiding this comment.
No need to check version for rd_kafka_buf_write_tags_empty. It already checks whether the request is flexver or not.
| if (ApiVersion >= 2) { | ||
| rd_kafka_buf_write_tags_empty(rkbuf); | ||
| } |
There was a problem hiding this comment.
Since we are working in KIP-482, we should use rd_kafka_buf_write_tags_empty in rd_kafka_buf_finalize instead of below. Can be done in another PR as well.
if (rkbuf->rkbuf_flags & RD_KAFKA_OP_F_FLEXVER) {
/* Empty struct tags */
rd_kafka_buf_write_i8(rkbuf, 0);
}
There was a problem hiding this comment.
Added it in the same PR itself
| if (rd_kafka_buf_ApiVersion(reply) >= 2) { | ||
| rd_kafka_buf_skip_tags(reply); | ||
| } |
There was a problem hiding this comment.
No need for if condition for rd_kafka_buf_skip_tags. It breaks if the buf is not flexver. Do the same below as well.
f025417 to
502c354
Compare
Emanuele Sabellico (emasab)
left a comment
There was a problem hiding this comment.
Thanks Pratyush Ranjan (@PratRanj07) ! Just a minor thing
| rd_kafka_buf_skip_tags(reply); | ||
|
|
There was a problem hiding this comment.
Same here: this isn't needed in the top level structure response parsing, please remove it for the three RPCs
| rd_kafka_buf_skip_tags(reply); |
There was a problem hiding this comment.
Please remove this last rd_kafka_buf_skip_tags from rd_kafka_DescribeAclsResponse_parse and rd_kafka_DeleteAclsResponse_parse as well.
502c354 to
54b51d9
Compare
2427016 to
20191b6
Compare
Emanuele Sabellico (emasab)
left a comment
There was a problem hiding this comment.
LGTM. Thanks Pratyush!
This PR intends to upgrade ACL Apis to v2(first flexible version) in accordance with KIP 482.