satishd commented on code in PR #15077:
URL: https://github.com/apache/kafka/pull/15077#discussion_r1436993064
##########
core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala:
##########
@@ -4020,6 +4031,7 @@ class ReplicaManagerTest {
doneLatch.countDown()
} finally {
replicaManager.shutdown(checkpointHW = false)
+ remoteLogManager.close()
Review Comment:
Can you close/shutdown safely by swallowing any intermediate exceptions
occur as mentioned below?
```
CoreUtils.swallow(replicaManager.shutdown(checkpointHW = false), this)
CoreUtils.swallow(remoteLogManager.close(), this)
```
##########
core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala:
##########
@@ -2704,28 +2710,30 @@ class ReplicaManagerTest {
time = time,
scheduler = time.scheduler,
logManager = logManager,
- quotaManagers = QuotaFactory.instantiate(config, metrics, time, ""),
+ quotaManagers = quotaManager,
metadataCache = MetadataCache.zkMetadataCache(config.brokerId,
config.interBrokerProtocolVersion),
logDirFailureChannel = new LogDirFailureChannel(config.logDirs.size),
alterPartitionManager = alterPartitionManager,
threadNamePrefix = Option(this.getClass.getName))
- logManager.startup(Set.empty[String])
-
- // Create a hosted topic, a hosted topic that will become stray, and a
stray topic
- val validLogs = createHostedLogs("hosted-topic", numLogs = 2,
replicaManager).toSet
- createHostedLogs("hosted-stray", numLogs = 10, replicaManager).toSet
- createStrayLogs(10, logManager)
+ try {
+ logManager.startup(Set.empty[String])
- val allReplicasFromLISR = Set(new TopicPartition("hosted-topic", 0), new
TopicPartition("hosted-topic", 1))
+ // Create a hosted topic, a hosted topic that will become stray, and a
stray topic
+ val validLogs = createHostedLogs("hosted-topic", numLogs = 2,
replicaManager).toSet
+ createHostedLogs("hosted-stray", numLogs = 10, replicaManager).toSet
+ createStrayLogs(10, logManager)
-
replicaManager.updateStrayLogs(replicaManager.findStrayPartitionsFromLeaderAndIsr(allReplicasFromLISR))
+ val allReplicasFromLISR = Set(new TopicPartition("hosted-topic", 0), new
TopicPartition("hosted-topic", 1))
- assertEquals(validLogs, logManager.allLogs.toSet)
- assertEquals(validLogs.size, replicaManager.partitionCount.value)
+
replicaManager.updateStrayLogs(replicaManager.findStrayPartitionsFromLeaderAndIsr(allReplicasFromLISR))
- replicaManager.shutdown()
- logManager.shutdown()
+ assertEquals(validLogs, logManager.allLogs.toSet)
+ assertEquals(validLogs.size, replicaManager.partitionCount.value)
+ } finally {
+ replicaManager.shutdown()
+ logManager.shutdown()
Review Comment:
Can you close both of them safely like below ignoring any intermediate
failures?
```
CoreUtils.swallow(replicaManager.shutdown(checkpointHW = false), this)
CoreUtils.swallow(remoteLogManager.close(), this)
```
##########
core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala:
##########
@@ -4116,6 +4128,7 @@ class ReplicaManagerTest {
latch.countDown()
} finally {
replicaManager.shutdown(checkpointHW = false)
+ remoteLogManager.close()
Review Comment:
Please close safely as mentioned in the earlier comment.
--
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]