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



##########
File path: 
clients/src/main/java/org/apache/kafka/clients/FetchSessionHandler.java
##########
@@ -73,6 +77,22 @@ public FetchSessionHandler(LogContext logContext, int node) {
     private LinkedHashMap<TopicPartition, PartitionData> sessionPartitions =
         new LinkedHashMap<>(0);
 
+    /**
+     * All of the topic ids mapped to topic names for topics which exist in 
the fetch request session.
+     */
+    private Map<String, Uuid> sessionTopicIds = new HashMap<>(0);
+
+    /**
+     * All of the topic names mapped to topic ids for topics which exist in 
the fetch request session.
+     */
+    private Map<Uuid, String> sessionTopicNames = new HashMap<>(0);
+
+    public Map<Uuid, String> sessionTopicNames() {
+        return sessionTopicNames;
+    }
+
+    private boolean canUseTopicIds = false;

Review comment:
       I think the main reason we keep the state in the session for using topic 
IDs is that some requests may not contain any new/updated partitions and we 
need to know which version to send. We don't want to close the session and 
simply send the version that was sent last time. I do think this code is quite 
confusing as is, so I think I can simply a lot of it.

##########
File path: core/src/main/scala/kafka/server/FetchSession.scala
##########
@@ -70,6 +71,7 @@ object FetchSession {
   * localLogStartOffset is the log start offset of the partition on this 
broker.
   */
 class CachedPartition(val topic: String,
+                      val topicId: Uuid,

Review comment:
       Ah, I found another use -- we lookup partitions toForget using the 
hashCode. Right now, toForget is a list of topic partitions and we don't 
directly use the ID provided in the request. We could look up the topic ID from 
the topic ID map and use it (we could also remove from the session map if we do 
remove the topic)




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