Jason Gustafson created KAFKA-7906: -------------------------------------- Summary: Improve failed leader election logging Key: KAFKA-7906 URL: https://issues.apache.org/jira/browse/KAFKA-7906 Project: Kafka Issue Type: Improvement Reporter: Jason Gustafson
We often see annoying log messages like the following in the state change log: {code} [2019-02-05 00:02:51,307] ERROR [Controller id=13 epoch=14] Controller 13 epoch 14 failed to change state for partition topic-3 from OnlinePartition to OnlinePartition (state.change.logger) kafka.common.StateChangeFailedException: Failed to elect leader for partition topic-3 under strategy PreferredReplicaPartitionLeaderElectionStrategy at kafka.controller.PartitionStateMachine$$anonfun$doElectLeaderForPartitions$3.apply(PartitionStateMachine.scala:328) at kafka.controller.PartitionStateMachine$$anonfun$doElectLeaderForPartitions$3.apply(PartitionStateMachine.scala:326) at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59) at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:48) at kafka.controller.PartitionStateMachine.doElectLeaderForPartitions(PartitionStateMachine.scala:326) at kafka.controller.PartitionStateMachine.electLeaderForPartitions(PartitionStateMachine.scala:254) at kafka.controller.PartitionStateMachine.doHandleStateChanges(PartitionStateMachine.scala:175) at kafka.controller.PartitionStateMachine.handleStateChanges(PartitionStateMachine.scala:116) {code} The stack trace is not adding any value and the message doesn't explain why the election failed. You have to read the code to figure it out. It's also curious that you have to look in the state change log for failed leader elections in the first place. It would be more intuitive to put these in the controller log. -- This message was sent by Atlassian JIRA (v7.6.3#76005)