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



##########
File path: core/src/main/scala/kafka/cluster/Partition.scala
##########
@@ -425,36 +425,35 @@ class Partition(val topicPartition: TopicPartition,
   }
 
   /**
-   * Checks if the topic ID provided in the request is consistent with the 
topic ID in the log.
+   * Checks if the topic ID received is consistent with the topic ID in the 
log.
    * If a valid topic ID is provided, and the log exists but has no ID set, 
set the log ID to be the request ID.
    *
-   * @param requestTopicId the topic ID from the request
-   * @return true if the request topic id is consistent, false otherwise
+   * @param receivedTopicId the topic ID from the LeaderAndIsr request or from 
the metadata records
+   * @return true if the received topic id is consistent, false otherwise
    */
-  def checkOrSetTopicId(requestTopicId: Uuid): Boolean = {
-    // If the request had an invalid topic ID, then we assume that topic IDs 
are not supported.
-    // The topic ID was not inconsistent, so return true.
-    // If the log is empty, then we can not say that topic ID is inconsistent, 
so return true.
-    if (requestTopicId == null || requestTopicId == Uuid.ZERO_UUID)
-      true
-    else {
+  def checkOrSetTopicId(receivedTopicId: Uuid, usingRaft: Boolean): Boolean = {

Review comment:
       I think the path through here makes sense when we're talking about the 
old zk logic in which we may or may not have an existing topicId and we rely on 
the controller to tell us. However, for the quorum controller, we should always 
have the topic ID when we create the `Log` object, so it feels strange to need 
to update it. That makes me think we should be looking at the paths that lead 
to `LogManager.getOrCreateLog`. Does it make sense to pass through topicId at 
that point?




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to