mumrah commented on code in PR #14593: URL: https://github.com/apache/kafka/pull/14593#discussion_r1372350163
########## metadata/src/main/java/org/apache/kafka/controller/PartitionChangeBuilder.java: ########## @@ -253,17 +269,30 @@ private ElectionResult electAnyLeader() { return new ElectionResult(NO_LEADER, false); } + private boolean canElectLastKnownLeader() { Review Comment: Thanks, can we make these TRACE since these can be emitted for each partition? Also there are some long lines that need to be broken up ########## metadata/src/main/java/org/apache/kafka/controller/PartitionChangeBuilder.java: ########## @@ -361,11 +410,16 @@ public Optional<ApiMessageAndVersion> build() { maybeUpdateRecordElr(record); - if (record.isr() == null && !targetIsr.isEmpty() && !targetIsr.equals(Replicas.toList(partition.isr))) { + // If ELR is enabled, the ISR is allowed to be empty. + if (record.isr() == null && (!targetIsr.isEmpty() || eligibleLeaderReplicasEnabled) && !targetIsr.equals(Replicas.toList(partition.isr))) { // Set the new ISR if it is different from the current ISR and unclean leader election didn't already set it. + if (targetIsr.isEmpty()) { + log.info("A partition will have an empty ISR. " + this); Review Comment: I think we might want DEBUG here. If we are emptying out the ISR, it's not necessarily a problem that requires user intervention. Since we now allow emptying the ISR when the final replica goes down, we would end up logging this for every partition if someone did a full cluster shutdown. -- 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