[ https://issues.apache.org/jira/browse/KAFKA-6652?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16412377#comment-16412377 ]
ASF GitHub Bot commented on KAFKA-6652: --------------------------------------- gitlw closed pull request #4769: KAFKA-6652: The controller should log failed attempts to transition a replica to OfflineReplica state if there is no leadership info URL: https://github.com/apache/kafka/pull/4769 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/core/src/main/scala/kafka/controller/ReplicaStateMachine.scala b/core/src/main/scala/kafka/controller/ReplicaStateMachine.scala index 85af764b635..a05ee473757 100644 --- a/core/src/main/scala/kafka/controller/ReplicaStateMachine.scala +++ b/core/src/main/scala/kafka/controller/ReplicaStateMachine.scala @@ -202,6 +202,9 @@ class ReplicaStateMachine(config: KafkaConfig, deletePartition = false, (_, _) => ()) } val replicasToRemoveFromIsr = validReplicas.filter(replica => controllerContext.partitionLeadershipInfo.contains(replica.topicPartition)) + validReplicas.filterNot(replica => controllerContext.partitionLeadershipInfo.contains(replica.topicPartition)).foreach { replica => + logFailedStateChange(replica, replicaState(replica), targetState, new IllegalStateException(s"No leadership info found for the replica $replica")) + } val updatedLeaderIsrAndControllerEpochs = removeReplicasFromIsr(replicaId, replicasToRemoveFromIsr.map(_.topicPartition)) updatedLeaderIsrAndControllerEpochs.foreach { case (partition, leaderIsrAndControllerEpoch) => if (!topicDeletionManager.isPartitionToBeDeleted(partition)) { ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > The controller should log failed attempts to transition a replica to > OfflineReplica state if there is no leadership info > ------------------------------------------------------------------------------------------------------------------------ > > Key: KAFKA-6652 > URL: https://issues.apache.org/jira/browse/KAFKA-6652 > Project: Kafka > Issue Type: Improvement > Reporter: Lucas Wang > Assignee: Lucas Wang > Priority: Minor > > In certain conditions, the controller's attempt to transition a replica to > OfflineReplica state could fail because there is no leadership info, e.g. the > condition described in > [KAFKA-6650|https://issues.apache.org/jira/browse/KAFKA-6650]. When that > happens, there should be logs to indicate the failed state transitions. -- This message was sent by Atlassian JIRA (v7.6.3#76005)