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



##########
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:
       Hmm this is a little tricky. One idea I had would be to check or set the 
ID in the partition object only (not the file) then when the the partitions are 
passed in to `makeLeaders/Followers` and a new log is created, we will have the 
topic ID easily accessible to create the partition.metadata file. It kind of 
changes how we do things. We would either store in partition **_instead of_** 
or **_in addition to_**  Log. Not sure if we also want to change this for the 
ZK code. Thoughts?




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