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

Add some retry logic to more admin client functions #2520

Merged
merged 3 commits into from
Jul 25, 2023

Conversation

hindessm
Copy link
Collaborator

Contrary to the discussion here, you can use the retryOnError function when you are returning results by using a closure to capture the results. This PR wraps a few more functions with retry logic.

I stopped before doing any more in part because I was distracted by the inconsistent use of 'Acls', 'ACLs', etc in variables and function names. :-) (Something else for v2 perhaps).

I also wondered about the fact that the retryOnError function currently only checks for isNotControllerError and many of the functions that it wraps also check the error since they need to refresh the controller. Perhaps it would be better to make simpler retryOnError function like:

func (ca *clusterAdmin) retryOnError(fn func() (bool, error)) error {
  ...
  isRetryable, err := fn()
  ...
}

so that the functions can check the error once and return true, err. (Or false, err for all other cases.)

Or perhaps there is a better way? Suggestions welcome.

Copy link
Collaborator

@dnwe dnwe left a comment

Choose a reason for hiding this comment

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

Changes look good to me, but we should probably refresh our memories and re-review which of these requests:

  1. absolutely need to be sent to the controller
  2. can be sent to any broker but are ultimately proxied to the controller (so we may as well send them to the controller directly if it’s trivial to find, but could fallback to anyBroker
  3. can be sent to any broker and are directly answered by any broker

@dnwe
Copy link
Collaborator

dnwe commented Jul 25, 2023

Somewhat relatedly, in kraft mode there is no longer the concept of a dedicated controller node and they try and force you to sending requests across any broker #2521 (comment)

Signed-off-by: Mark Hindess <mark.hindess@gmail.com>
Signed-off-by: Mark Hindess <mark.hindess@gmail.com>
Signed-off-by: Mark Hindess <mark.hindess@gmail.com>
@dnwe
Copy link
Collaborator

dnwe commented Jul 25, 2023

Still, currently the code does fetch the controller so using the existing common retry mechanism makes sense

@dnwe dnwe added the fix label Jul 25, 2023
@dnwe dnwe merged commit e07f521 into IBM:main Jul 25, 2023
13 checks passed
@hindessm hindessm deleted the mrh/admin-retry-logic branch July 25, 2023 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants