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


##########
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:
   Do you mean this:
   ```
   Set<TopicIdPartition> pendingActionsPartitions = stopPartitions.stream()
                   .filter(sp -> (sp.stopRemoteLogMetadataManager() || 
sp.deleteLocalLog()) && topicIdByPartitionMap.containsKey(sp.topicPartition()))
                   .map(sp -> new 
TopicIdPartition(topicIdByPartitionMap.get(sp.topicPartition()), 
sp.topicPartition()))
                   .collect(Collectors.toSet());
   
   if (!pendingActionsPartitions.isEmpty()) {
     pendingActionsPartitions.forEach(tpId -> 
topicIdByPartitionMap.remove(tpId.topicPartition()));
     remoteLogMetadataManager.onStopPartitions(pendingActionsPartitions)'
   }
   ```
   
   I'm not sure if it's correct. when `sp.stopRemoteLogMetadataManager` is 
true, the `sp.deleteLocalLog()` could be false because we set 
`remote.copy.disabled=true` only. In this case, we can't remote 
`topicIdByPartitionMap`, right?



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