OmniaGM commented on code in PR #15335:
URL: https://github.com/apache/kafka/pull/15335#discussion_r1549552216
##########
core/src/main/scala/kafka/server/metadata/BrokerMetadataPublisher.scala:
##########
@@ -289,13 +289,17 @@ class BrokerMetadataPublisher(
try {
// Start log manager, which will perform (potentially lengthy)
// recovery-from-unclean-shutdown if required.
- logManager.startup(metadataCache.getAllTopics())
-
- // Delete partition directories which we're not supposed to have. We have
- // to do this before starting ReplicaManager, so that the stray replicas
- // don't block creation of new ones with different IDs but the same
names.
- // See KAFKA-14616 for details.
- logManager.deleteStrayKRaftReplicas(brokerId, newImage.topics())
+ logManager.startup(
+ metadataCache.getAllTopics(),
+ isStray = (topicId, partition) => {
+ val tid = topicId.getOrElse {
+ throw new RuntimeException(s"Partition $partition does not have a
topic ID, " +
+ "which is not allowed when running in KRaft mode.")
+ }
+ Option(newImage.topics().getPartition(tid, partition.partition()))
+ .exists(_.replicas.contains(brokerId))
Review Comment:
You are right, the new `isStrayKraftReplica` is finding both cases but I
guess I took Igor suggestion without giving it a second thought
https://github.com/apache/kafka/pull/15335#discussion_r1512748010 will fix this
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]