fix: alter topic --replication-factor infinite loop when broker is unavailable#318
Open
fix: alter topic --replication-factor infinite loop when broker is unavailable#318
Conversation
…available When a broker is down, the reassignment loop could run infinitely because: 1. Replicas were assigned to unavailable brokers that could never accept them 2. The polling loop had no timeout This fix: - Filters brokers by connectivity before building replica assignments - Prioritizes removing replicas from unavailable brokers when decreasing RF - Adds a 10-minute timeout to the reassignment polling loop Closes #256
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
alter topic --replication-factorentering an infinite loop when a broker is unavailable (e.g., down or unreachable)broker.Connected()) before building replica assignments, so replicas are only assigned to available brokersChanges
internal/topic/topic-operation.goAlterTopic: Usesbroker.Connected()to filter available brokers. Only available brokers are included inbrokerReplicaCount. Unavailable brokers are warned about viaoutput.Warnf. The replication factor validation now checks against available broker count. The reassignment polling loop now has a 10-minute deadline.getTargetReplicas: When decreasing replication factor, brokers not present inbrokerReplicaCount(i.e., unavailable) are sorted to the end of the replica list so they are removed first.internal/topic/topic-operation_test.go(new)getTargetReplicascovering: normal increase/decrease, decrease with unavailable brokers, multiple unavailable brokers, all unavailable, and not enough brokers error.CHANGELOG.md[Unreleased]Closes #256