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

Expose Broker API to step down if not leader #8295

Merged
12 commits merged into from
Dec 1, 2021
Merged

Conversation

lenaschoenburg
Copy link
Member

@lenaschoenburg lenaschoenburg commented Nov 29, 2021

Description

This introduces a new Admin API for the Broker. The only supported request so far is STEP_DOWN_IF_NOT_LEADER.
The handler has access to the Raft partitions by getting the partition manager injected after partitions are started.

The handler is a PartitionListener so it subscribes and unsubscribes to messages when it transitions between leader, follower and inactive. This is optional behavior and could be removed as the stepDownIfNotLeader is a no-op when the broker is not the leader for this partition.

Related issues

closes #8224

Definition of Done

Not all items need to be done depending on the issue and the pull request.

Code changes:

  • The changes are backwards compatibility with previous versions
  • If it fixes a bug then PRs are created to backport the fix to the last two minor versions. You can trigger a backport by assigning labels (e.g. backport stable/0.25) to the PR, in case that fails you need to create backports manually.

Testing:

  • There are unit/integration tests that verify all acceptance criterias of the issue
  • New tests are written to ensure backwards compatibility with further versions
  • The behavior is tested manually
  • The change has been verified by a QA run
  • The impact of the changes is verified by a benchmark

Documentation:

  • The documentation is updated (e.g. BPMN reference, configuration, examples, get-started guides, etc.)
  • New content is added to the release announcement

@lenaschoenburg lenaschoenburg force-pushed the 8224-broker-api-step-down branch 8 times, most recently from 9ed493b to 7ae8e4a Compare November 30, 2021 15:41
@lenaschoenburg lenaschoenburg marked this pull request as ready for review November 30, 2021 16:42
Copy link
Contributor

@deepthidevaki deepthidevaki left a comment

Choose a reason for hiding this comment

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

Looks good 🚀 Just some small comments.

Instead of using a partition listener to subscribe/unsubscribe based on
becoming leader or follower we simply subscribe to admin requests on all
partitions and never unsubscribe.
The admin api handles requests on followers gracefully.
Copy link
Contributor

@deepthidevaki deepthidevaki left a comment

Choose a reason for hiding this comment

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

Unsubscribing the request topics still unsubscribes all instead of specific types. Please fix it. Otherwise all good 👍

Copy link
Contributor

@deepthidevaki deepthidevaki left a comment

Choose a reason for hiding this comment

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

Great! 🚀

@lenaschoenburg
Copy link
Member Author

bors r+

@ghost
Copy link

ghost commented Dec 1, 2021

Build succeeded:

@ghost ghost merged commit b698000 into develop Dec 1, 2021
@ghost ghost deleted the 8224-broker-api-step-down branch December 1, 2021 14:01
This pull request was closed.
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.

Expose Broker API to step down if not expected leader
3 participants