divijvaidya commented on code in PR #14136:
URL: https://github.com/apache/kafka/pull/14136#discussion_r1283058109


##########
core/src/main/java/kafka/log/remote/RemoteLogManager.java:
##########
@@ -144,8 +145,9 @@ public class RemoteLogManager implements Closeable {
 
     private final ConcurrentHashMap<TopicIdPartition, RLMTaskWithFuture> 
leaderOrFollowerTasks = new ConcurrentHashMap<>();
 
-    // topic ids that are received on leadership changes, this map is cleared 
on stop partitions
-    private final ConcurrentMap<TopicPartition, Uuid> topicPartitionIds = new 
ConcurrentHashMap<>();
+    // topic ids that are received on leadership changes & on stop partitions 
are stored in this cache
+    private final MetadataCache metaDataCache;

Review Comment:
   nit
   
   s\metaData\metadata
   
   (everywhere)



##########
core/src/main/java/kafka/log/remote/RemoteLogManager.java:
##########
@@ -347,15 +353,16 @@ public void onLeadershipChange(Set<Partition> 
partitionsBecomeLeader,
     public void stopPartitions(TopicPartition topicPartition, boolean delete) {
         if (delete) {
             // Delete from internal datastructures only if it is to be deleted.
-            Uuid topicIdPartition = topicPartitionIds.remove(topicPartition);
-            LOGGER.debug("Removed partition: {} from topicPartitionIds", 
topicIdPartition);
+            Map<String, Uuid> mapping = metaDataCache.topicNamesToIds();
+            Uuid topicIdPartition = mapping.remove(topicPartition.topic());

Review Comment:
   The idea of replacing this cache with Metadata cache is that the existing 
metadata cache will serve as the source of truth. It should already be updated 
to contains the correct topics Id <-> topicPartition mapping irrespective of 
whether tiered storage is turned on or not. TS code should only access this 
cache and not modify it in any way. The modification (adding/removal) should 
already exist is rest of the normal path Kafka code. (If it doesn't then we 
need to fix it).



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