Skip to content

Conversation

emasab
Copy link
Contributor

@emasab emasab commented May 5, 2025

when brokers were added only through rd_kafka_brokers_add.

@Copilot Copilot AI review requested due to automatic review settings May 5, 2025 14:43
@emasab emasab requested a review from a team as a code owner May 5, 2025 14:43
@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 fixes the re-bootstrap issue when no bootstrap servers are configured by ensuring that brokers added manually via rd_kafka_brokers_add are handled properly. The changes include:

  • Adding a new test (0152-rebootstrap.c) to validate the re-bootstrap sequence without bootstrap servers.
  • Renaming and updating the topic info destroy function from rd_kafka_topic_info_destroy to rd_kafka_topic_info_destroy_free in both header and source files.
  • Adding a brokerlist null-check in the rebootstrap callback in src/rdkafka.c.

Reviewed Changes

Copilot reviewed 7 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/test.c Registers the new rebootstrap test.
tests/0152-rebootstrap.c Implements the test verifying re-bootstrap behavior with manual brokers.
src/rdkafka_topic.h Renames the destroy function to rd_kafka_topic_info_destroy_free.
src/rdkafka_topic.c Updates the destroy function implementation to use the new free function.
src/rdkafka_cgrp.c Updates all list callbacks that free topic info with the new function.
src/rdkafka.c Adds a conditional check on brokerlist before invoking the re-bootstrap logic.
CHANGELOG.md Documents the fix and details regarding the re-bootstrap change.
Files not reviewed (2)
  • tests/CMakeLists.txt: Language not supported
  • win32/tests/tests.vcxproj: Language not supported
Comments suppressed due to low confidence (2)

src/rdkafka_topic.h:293

  • The function has been renamed to rd_kafka_topic_info_destroy_free to better reflect its behavior. Please ensure the corresponding documentation and comments are updated to indicate the new semantics and that all references use the new name.
-void rd_kafka_topic_info_destroy(rd_kafka_topic_info_t *ti);

tests/0152-rebootstrap.c:48

  • [nitpick] The test currently relies on a sleep call to allow time for ALL_BROKERS_DOWN to trigger. Consider adding explicit assertions or verifications to ensure the re-bootstrap logic behaves as expected rather than relying solely on timing.
rd_sleep(1);

Comment on lines +2092 to +2097
if (rk->rk_conf.brokerlist) {
rd_kafka_brokers_add0(
rk,
rk->rk_conf.brokerlist, rd_true
/* resolve canonical bootstrap server
* list names if requested*/);
Copy link
Preview

Copilot AI May 5, 2025

Choose a reason for hiding this comment

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

[nitpick] The added null-check for brokerlist improves safety; however, consider clarifying the expected behavior when the brokerlist is an empty string. A comment or additional guard could help maintain clarity.

Copilot uses AI. Check for mistakes.


int main_0152_rebootstrap_local(int argc, char **argv) {

do_test_rebootstrap_local_no_bootstrap_servers(RD_KAFKA_PRODUCER);
Copy link
Member

Choose a reason for hiding this comment

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

We should add for normal case as well as for empty string case.

Copy link
Contributor Author

@emasab emasab May 16, 2025

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

I was talking about empty bootstrap brokers string case. Lets add it in that PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

@pranavrth
Copy link
Member

Update the PR and we can merge.

emasab added 3 commits May 21, 2025 16:20
given no `boostrap.servers` is present and brokers were added through `rd_kafka_brokers_add`

Closes #5057
@airlock-confluentinc airlock-confluentinc bot force-pushed the dev_fix_reboostrapping_with_no_boostrap_servers branch from 7646f48 to 88e978b Compare May 21, 2025 14:23
@emasab emasab changed the title Fix reboostrapping with no boostrap servers Fix reboostrapping with no bootstrap servers May 21, 2025

int main_0152_rebootstrap_local(int argc, char **argv) {

do_test_rebootstrap_local_no_bootstrap_servers(RD_KAFKA_PRODUCER);
Copy link
Member

Choose a reason for hiding this comment

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

I was talking about empty bootstrap brokers string case. Lets add it in that PR.

@pranavrth
Copy link
Member

LGTM!. Thanks.

@emasab emasab merged commit 826f585 into master May 22, 2025
2 checks passed
@emasab emasab deleted the dev_fix_reboostrapping_with_no_boostrap_servers branch May 22, 2025 11:39
@Copilot Copilot AI mentioned this pull request Jun 11, 2025
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