forked from apache/kafka
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[LI-HOTFIX] [Delayed Election PR - Part 2] Create delayed elections i…
…n Kafka controller when corrupted brokers start up (#428) TICKET = LIKAFKA-47837 EXIT_CRITERIA = This PR has strong dependency on Zookeeper, and the logic to register a new corrupted broker with the controller will need to change once we migrate to KRaft mode. LI_DESCRIPTION = As part of the power outage resiliency work, we want to make sure that when there are multiple corrupted brokers coming up, and there is an offline partition belonging on those brokers, the controller elects the broker with the highest offset. To achieve this, we must allow Kafka Controller to call ListOffsets on any broker, so that it can compare the results and elect the broker with the highest offset to be the leader. As of today Kafka Controller can only make requests that are of type ControlRequest. We add the capability to call ListOffsets here. When a corrupted broker is detected, the controller begins delayed election tasks with a specified timeout for all partitions on it that are offline. It then follows up by sending a ListOffsets request to the broker. When the responses come in from the ListOffsets, they are stored in-memory. The controller waits until either the timeout for the election task has expired, or when the controller has received offsets from all brokers for a partition, whichever happens earlier. At this time, the controller chooses the broker with the highest broker epoch (and if there are multiple brokers with the same epoch, the one with the highest offset) as the leader for that partition. Added integration test for delayed election scenario. Also tested this on an actual cluster using Kafka server.
- Loading branch information
Showing
12 changed files
with
1,038 additions
and
59 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.