Skip to content
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

KAFKA-18230: handle not controller or not leader error in admin client #18165

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

showuon
Copy link
Contributor

@showuon showuon commented Dec 13, 2024

When admin client starts up, it'll get the metadata of the cluster. And when the admin client sends request directly to the controller (via --bootstrap-controller), it'll send the request to the active controller. But if there is a leadership change in the controller after the metadata request and before the target request sent, the request will fail immediately with NOT_CONTROLLER error or NOT_LEADER_OR_FOLLOWER error. It's because the requests that need metadata log change must need to do on the active controller. Instead of failing immediately, the admin client should catch the error and retry the metadata update to send the request again. Note, in some application, the admin client could exist for a long time to send multiple requests when needed, this case could happen more often.

In this PR, I handled NOT_CONTROLLER and NOT_LEADER_OR_FOLLOWER in the requests that allow talk to controller directly, and the controller will modify the metadata log, or requesting raft update, which must be done by the active controller. The APIs are:

  1. createAcls
  2. deleteAcls
  3. alterConfigs
  4. describeMetadataQuorum
  5. addRaftVoter
  6. removeRaftVoter

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

@github-actions github-actions bot added triage PRs from the community core Kafka Broker clients labels Dec 13, 2024
@mumrah
Copy link
Member

mumrah commented Dec 13, 2024

@showuon #17881 adds a "triage" label to PRs from non-committers. Turns out this also affect committers if their membership visibility in the ASF GitHub org is not public. I added instructions for setting your membership visibility to public https://github.com/apache/kafka/blob/trunk/.github/workflows/README.md#pr-triage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clients core Kafka Broker triage PRs from the community
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants