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

Stop Kafka Service Before Running Broker Recovery Process #309

Merged
merged 5 commits into from
Nov 26, 2024

Conversation

yisheng-zhou
Copy link
Contributor

This PR introduces logic to attempt stopping the Kafka service on a broker before executing other broker recovery actions. This action triggers leadership failover, allowing other brokers to become leaders of Kafka topic partitions.

@yisheng-zhou yisheng-zhou requested a review from a team as a code owner November 25, 2024 22:45
@yisheng-zhou yisheng-zhou changed the title Enhancements to Broker Recovery Process Stop Kafka Service Before Running Broker Recovery Process Nov 25, 2024
@@ -42,6 +44,7 @@ public class BrokerRecoveryAction extends NodeAction {
private static final int retryIntervalMilliseconds = 1000;

public static final String ATTR_TRY_TO_RESTART_KEY = "try_restart";
public static final String ATTR_STOP_SERVICE_BEFORE_REPLACEMENT = "stop_service_before_replacement";
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need this? We should always do replacements by stopping the broker first, so no need to make it configurable in my opinion.

@@ -126,6 +129,37 @@ public void runAction() {

getResult().appendOut("Start replacing broker");

// Try to gracefully shutdown service before replacing broker.
// This can make sure the broker is not the leader of any partition.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: replace this comment with

// This ensures partition leaderships are moved away from the broker before the replacement process starts.

@yisheng-zhou yisheng-zhou merged commit 869442a into master Nov 26, 2024
1 check passed
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