showuon commented on code in PR #14136:
URL: https://github.com/apache/kafka/pull/14136#discussion_r1302927787
##########
core/src/main/java/kafka/log/remote/RemoteLogManager.java:
##########
@@ -285,19 +288,15 @@ public RemoteStorageManager storageManager() {
return remoteLogStorageManager;
}
+ public MetadataCache metadataCache() {
+ return metadataCache;
Review Comment:
Why do we need this? For test only? I think the test doesn't have to use it.
See my comment below.
##########
core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala:
##########
@@ -3624,14 +3624,18 @@ class ReplicaManagerTest {
val remoteLogManagerConfig = new RemoteLogManagerConfig(config)
val mockLog = mock(classOf[UnifiedLog])
val brokerTopicStats = new
BrokerTopicStats(java.util.Optional.of(KafkaConfig.fromProps(props)))
+ val mockMetadataCache = mock(classOf[MetadataCache])
val remoteLogManager = new RemoteLogManager(
remoteLogManagerConfig,
0,
TestUtils.tempRelativeDir("data").getAbsolutePath,
"clusterId",
time,
_ => Optional.of(mockLog),
- brokerTopicStats)
+ brokerTopicStats,
+ mockMetadataCache
+ )
+
when(remoteLogManager.metadataCache().getTopicId(topic)).thenReturn(topicId)
Review Comment:
What's the difference between `mockMetadataCache` and
`remoteLogManager.metadataCache()`? If no difference, could we use the former
one and remove the `remoteLogManager#metadataCache()` method?
##########
core/src/main/java/kafka/log/remote/RemoteLogManager.java:
##########
@@ -378,7 +372,7 @@ public void stopPartitions(Set<TopicPartition>
topicPartitions,
remoteLogMetadataManager.onStopPartitions(topicIdPartitions);
if (delete) {
// NOTE: this#stopPartitions method is called when Replica state
changes to Offline and ReplicaDeletionStarted
- topicPartitions.forEach(topicIdByPartitionMap::remove);
+// topicPartitions.forEach(topicIdByPartitionMap::remove);
Review Comment:
Should we delete this line directly?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]