hachikuji commented on a change in pull request #11225:
URL: https://github.com/apache/kafka/pull/11225#discussion_r691703790



##########
File path: core/src/main/scala/kafka/server/ReplicaManager.scala
##########
@@ -1436,17 +1438,15 @@ class ReplicaManager(val config: KafkaConfig,
 
           leaderAndIsrRequest.partitionStates.forEach { partitionState =>
             val topicPartition = new TopicPartition(partitionState.topicName, 
partitionState.partitionIndex)
-            /*
-           * If there is offline log directory, a Partition object may have 
been created by getOrCreatePartition()
-           * before getOrCreateReplica() failed to create local replica due to 
KafkaStorageException.
-           * In this case ReplicaManager.allPartitions will map this 
topic-partition to an empty Partition object.
-           * we need to map this topic-partition to OfflinePartition instead.
-           */
+            // If there is offline log directory, a Partition object may have 
been created by getOrCreatePartition()

Review comment:
       nit: If there is _an_ offline log directory?

##########
File path: core/src/main/scala/kafka/server/ReplicaManager.scala
##########
@@ -1436,17 +1438,15 @@ class ReplicaManager(val config: KafkaConfig,
 
           leaderAndIsrRequest.partitionStates.forEach { partitionState =>

Review comment:
       This logic is a bit strange. It sounds like we need are trying to handle 
the case where we fail to create the log after we have already created the 
partition. Would it make more sense to handle this in `getOrCreatePartition` if 
an exception is raised?

##########
File path: core/src/main/scala/kafka/server/ReplicaManager.scala
##########
@@ -1436,17 +1438,15 @@ class ReplicaManager(val config: KafkaConfig,
 
           leaderAndIsrRequest.partitionStates.forEach { partitionState =>
             val topicPartition = new TopicPartition(partitionState.topicName, 
partitionState.partitionIndex)
-            /*
-           * If there is offline log directory, a Partition object may have 
been created by getOrCreatePartition()
-           * before getOrCreateReplica() failed to create local replica due to 
KafkaStorageException.
-           * In this case ReplicaManager.allPartitions will map this 
topic-partition to an empty Partition object.
-           * we need to map this topic-partition to OfflinePartition instead.
-           */
+            // If there is offline log directory, a Partition object may have 
been created by getOrCreatePartition()
+            // before getOrCreateReplica() failed to create local replica due 
to KafkaStorageException.

Review comment:
       Hmm, `getOrCreateReplica` no longer exists. Maybe `createLogIfNotExists` 
is the replacement?




-- 
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


Reply via email to