kamalcph commented on code in PR #16653:
URL: https://github.com/apache/kafka/pull/16653#discussion_r1699548170


##########
core/src/main/java/kafka/log/remote/RemoteLogManager.java:
##########
@@ -507,17 +525,25 @@ public void stopPartitions(Set<StopPartition> 
stopPartitions,
                 LOGGER.error("Error while stopping the partition: {}", 
stopPartition, ex);
             }
         }
-        // Note `deleteLocalLog` will always be true when `deleteRemoteLog` is 
true but not the other way around.
         Set<TopicIdPartition> deleteLocalPartitions = stopPartitions.stream()
                 .filter(sp -> sp.deleteLocalLog() && 
topicIdByPartitionMap.containsKey(sp.topicPartition()))
                 .map(sp -> new 
TopicIdPartition(topicIdByPartitionMap.get(sp.topicPartition()), 
sp.topicPartition()))
                 .collect(Collectors.toSet());
+
         if (!deleteLocalPartitions.isEmpty()) {
-            // NOTE: In ZK mode, this#stopPartitions method is called when 
Replica state changes to Offline and
-            // ReplicaDeletionStarted
-            remoteLogMetadataManager.onStopPartitions(deleteLocalPartitions);
             deleteLocalPartitions.forEach(tpId -> 
topicIdByPartitionMap.remove(tpId.topicPartition()));
         }
+
+        // NOTE: In ZK mode, this#stopPartitions method is called when Replica 
state changes to Offline and
+        // ReplicaDeletionStarted
+        Set<TopicIdPartition> stopRLMMPartitions = stopPartitions.stream()

Review Comment:
   When `sp.stopRemoteLogMetadataManager` is true, then either 
`sp.deleteLocalLog` (or) `sp.deleteRemoteLog` will always be true:
   
   1. We stop RLMM when we disable the remote logs in the leader 
(deleteRemoteLog = true and deleteLocalLog=false)
   2. We stop RLMM when we disable the remote logs in the follower 
(deleteRemoteLog = false and deleteLocalLog = false)
   3. We stop RLMM when the replica moves from one broker to another 
(deleteRemoteLog = false and deleteLocalLog = true)
   
   In all the above cases, we want to stop the RLMM resources and remove the 
respective entries from `topicIdByPartitionMap` for those partitions when 
stopRLMM is set to true.
   
   > when sp.stopRemoteLogMetadataManager is true, the sp.deleteLocalLog() 
could be false because we set remote.copy.disabled=true only. 
   
   
   When stopRLMM is set to true, then we don't care about 
`remote.copy.disabled` since stopping RLMM components make the remote log 
segments inaccessible.



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