mirror of https://github.com/apache/kafka.git
				
				
				
			| Previously in KRaft mode, we could request an unclean leader election for a specific topic using the electLeaders API. This PR adds an additional way to trigger unclean leader election when in KRaft mode via the static controller configuration and various dynamic configurations. In order to support all possible configuration methods, we have to do a multi-step configuration lookup process: 1. check the dynamic topic configuration for the topic. 2. check the dynamic node configuration. 3. check the dynamic cluster configuration. 4. check the controller's static configuration. Fortunately, we already have the logic to do this multi-step lookup in KafkaConfigSchema.java. This PR reuses that logic. It also makes setting a configuration schema in ConfigurationControlManager mandatory. Previously, it was optional for unit tests. Of course, the dynamic configuration can change over time, or the active controller can change to a different one with a different configuration. These changes can make unclean leader elections possible for partitions that they were not previously possible for. In order to address this, I added a periodic background task which scans leaderless partitions to check if they are eligible for an unclean leader election. Finally, this PR adds the UncleanLeaderElectionsPerSec metric. Co-authored-by: Luke Chen showuon@gmail.com Reviewers: Igor Soarez <soarez@apple.com>, Luke Chen <showuon@gmail.com> | ||
|---|---|---|
| .. | ||
| api/src | ||
| src | ||