Removing entries from the shuttingdownBrokerIds upon broker startup - #187
Merged
Conversation
Author
|
The failed tests are being resolved at #188 |
ambroff
approved these changes
Jul 25, 2021
ambroff
left a comment
There was a problem hiding this comment.
+1. Thanks for fixing this. That's a good catch, I just had the logic wrong in that filter predicate.
scala> val liveBrokerEpochs = Map(0 -> 5, 1 -> 10)
val liveBrokerEpochs: scala.collection.immutable.Map[Int,Int] = Map(0 -> 5, 1 -> 10)
scala> liveBrokerEpochs(0)
val res0: Int = 5
scala> val shuttingDownBrokerIds = Map(1 -> 9)
val shuttingDownBrokerIds: scala.collection.immutable.Map[Int,Int] = Map(1 -> 9)
scala> shuttingDownBrokerIds.filter(b => liveBrokerEpochs.contains(b._1) && b._2 < liveBrokerEpochs(b._1))
val res1: scala.collection.immutable.Map[Int,Int] = Map(1 -> 9)
scala> shuttingDownBrokerIds.filter(b => liveBrokerEpochs.contains(b._1) && b._2 > liveBrokerEpochs(b._1))
val res2: scala.collection.immutable.Map[Int,Int] = Map()
scala> shuttingDownBrokerIds.filter(b => liveBrokerEpochs.contains(b._1) && b._2 > liveBrokerEpochs(b._1))
val res3: scala.collection.immutable.Map[Int,Int] = Map()
scala> shuttingDownBrokerIds.filter(b => liveBrokerEpochs.contains(b._1) && b._2 > liveBrokerEpochs(b._1))
val res4: scala.collection.immutable.Map[Int,Int] = Map()
gitlw
force-pushed
the
controlled_shutdown_blocked
branch
from
July 26, 2021 15:44
9d68691 to
35da48a
Compare
wyuka
pushed a commit
that referenced
this pull request
Feb 4, 2022
…er startup (#187) TICKET = N/A LI_DESCRIPTION = Removing entries from the shuttingdownBrokerIds upon broker startup EXIT_CRITERIA = N/A
lmr3796
pushed a commit
to lmr3796/kafka
that referenced
this pull request
Feb 9, 2022
…er startup (linkedin#187) TICKET = N/A LI_DESCRIPTION = Removing entries from the shuttingdownBrokerIds upon broker startup EXIT_CRITERIA = N/A
lmr3796
pushed a commit
to lmr3796/kafka
that referenced
this pull request
Mar 25, 2022
…er startup (linkedin#187) TICKET = N/A LI_DESCRIPTION = Removing entries from the shuttingdownBrokerIds upon broker startup EXIT_CRITERIA = N/A
lmr3796
pushed a commit
to lmr3796/kafka
that referenced
this pull request
Jun 2, 2022
… startup (linkedin#187) TICKET = N/A LI_DESCRIPTION = Removing entries from the shuttingdownBrokerIds upon broker startup EXIT_CRITERIA = N/A
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.
Consider a cluster having two brokers (id=0 and id=1) configured with
and a partition having two replicas on these two brokers.
If broker1 goes through the controlled shutdown process and starts up, the current implementation uses the following logic to update the
shuttingdownBrokerIds:which means broker1's previous shutting epoch is still retained in the shuttingDownBrokerIds after it restarts.
Later on, if broker0 needs to restart, the controller uses the
leaderForControlledShutdownmethod to elect a new leader for partitions led by broker0:The
leaderForControlledShutdownwould still treat broker1 as a shutting down broker, and therefore won't be able to transfer the leadership to broker1, despite its readiness to serve as the leader.This PR resolves the problem by changing the update logic of
shuttingDownBrokerIdssuch that the entry of a restarted broker would be removed from it.Committer Checklist (excluded from commit message)