Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Minor refactoring
  • Loading branch information
geek-bit committed Dec 9, 2025
commit 4bfb5c25b5372fbf3c9f17f15e9a7512367d3069
12 changes: 2 additions & 10 deletions core/src/main/scala/kafka/server/ReplicaManager.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2520,7 +2520,6 @@ class ReplicaManager(val config: KafkaConfig,

val listenerName = config.interBrokerListenerName.value
val partitionAndOffsets = new mutable.HashMap[TopicPartition, InitialFetchState]
val partitionsWithoutLeader = new mutable.HashMap[TopicPartition, Option[Int]]

partitionsToStartFetching.foreachEntry { (topicPartition, partition) =>
val nodeOpt = partition.leaderReplicaIdOpt
Expand All @@ -2537,15 +2536,8 @@ class ReplicaManager(val config: KafkaConfig,
initialFetchOffset(log)
))
case None =>
partitionsWithoutLeader.put(topicPartition, partition.leaderReplicaIdOpt)
}
}

// Log partitions whose leader is not alive in the metadata image.
if (partitionsWithoutLeader.nonEmpty) {
partitionsWithoutLeader.foreachEntry { (topicPartition, leaderIdOpt) =>
stateChangeLogger.warn(s"Unable to start fetching $topicPartition " +
s"from leader $leaderIdOpt because it is not alive.")
stateChangeLogger.trace(s"Unable to start fetching $topicPartition " +
s"from leader ${partition.leaderReplicaIdOpt} because it is not alive.")
}
}

Expand Down