junrao commented on code in PR #13408: URL: https://github.com/apache/kafka/pull/13408#discussion_r1149498020
########## metadata/src/main/java/org/apache/kafka/controller/ReplicationControlManager.java: ########## @@ -1159,16 +1171,20 @@ private Errors validateAlterPartitionData( return Errors.NONE; } - private List<IneligibleReplica> ineligibleReplicasForIsr(int[] replicas) { + private List<IneligibleReplica> ineligibleReplicasForIsr(List<BrokerState> brokerStates) { List<IneligibleReplica> ineligibleReplicas = new ArrayList<>(0); - for (Integer replicaId : replicas) { - BrokerRegistration registration = clusterControl.registration(replicaId); + for (BrokerState brokerState : brokerStates) { + int brokerId = brokerState.brokerId(); + BrokerRegistration registration = clusterControl.registration(brokerId); if (registration == null) { - ineligibleReplicas.add(new IneligibleReplica(replicaId, "not registered")); + ineligibleReplicas.add(new IneligibleReplica(brokerId, "not registered")); } else if (registration.inControlledShutdown()) { - ineligibleReplicas.add(new IneligibleReplica(replicaId, "shutting down")); + ineligibleReplicas.add(new IneligibleReplica(brokerId, "shutting down")); } else if (registration.fenced()) { - ineligibleReplicas.add(new IneligibleReplica(replicaId, "fenced")); + ineligibleReplicas.add(new IneligibleReplica(brokerId, "fenced")); + } else if (brokerState.brokerEpoch() != -1 && registration.epoch() != brokerState.brokerEpoch()) { + ineligibleReplicas.add(new IneligibleReplica(brokerId, + "broker epoch mismatch:" + brokerState.brokerEpoch() + " vs " + registration.epoch())); Review Comment: It would be better if we could make it clear what's the requested and the expected epoch. -- 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