You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2020/12/10 20:35:35 UTC

[GitHub] [kafka] kowshik commented on a change in pull request #9728: MINOR: make sure all dir jobs are completed

kowshik commented on a change in pull request #9728:
URL: https://github.com/apache/kafka/pull/9728#discussion_r540478009



##########
File path: core/src/test/scala/unit/kafka/log/LogManagerTest.scala
##########
@@ -680,4 +680,15 @@ class LogManagerTest {
     time.sleep(logConfig.fileDeleteDelayMs + 1)
     verifyMetrics(1)
   }
+
+  @Test

Review comment:
       This test may not still catch the bug introduced in #9680. 
   We can continue more discussion under this review comment in #9680: https://github.com/apache/kafka/pull/9680/files#r540476157.
   
   We should still get this PR merged though, since it fixes the problem.

##########
File path: core/src/main/scala/kafka/log/LogManager.scala
##########
@@ -478,17 +493,8 @@ class LogManager(logDirs: Seq[File],
     }
 
     try {
-      for ((dir, dirJobs) <- jobs) {
-        val hasErrors = dirJobs.exists  { future =>
-          Try(future.get) match {
-            case Success(_) => false
-            case Failure(e) =>
-              warn(s"There was an error in one of the threads during LogManager shutdown: ${e.getCause}")
-              true
-          }
-        }
-
-        if (!hasErrors) {
+      jobs.forKeyValue { (dir, dirJobs) =>
+        if (allPass(dirJobs)) {

Review comment:
       This refactoring is good.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org