CalvinConfluent commented on code in PR #19590:
URL: https://github.com/apache/kafka/pull/19590#discussion_r2078159134


##########
metadata/src/main/java/org/apache/kafka/metadata/PartitionRegistration.java:
##########
@@ -165,12 +164,8 @@ public PartitionRegistration build() {
     public final int leaderEpoch;
     public final int partitionEpoch;
 
-    public static boolean electionWasClean(int newLeader, int[] isr, int[] 
elr) {
-        return newLeader == NO_LEADER || Replicas.contains(isr, newLeader) || 
Replicas.contains(elr, newLeader);
-    }
-
-    public static boolean electionFromElr(int newLeader, int[] elr) {
-        return Replicas.contains(elr, newLeader);
+    public static boolean electionWasUnclean(byte prevLeaderRecoveryState, 
byte nextLeaderRecoveryState) {
+        return prevLeaderRecoveryState == 
LeaderRecoveryState.RECOVERED.value() && nextLeaderRecoveryState == 
LeaderRecoveryState.RECOVERING.value();

Review Comment:
   Yeah, you are right. If the next state is still Recovering, it is another 
unclean leader election. Updated



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to