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 2021/07/12 07:33:58 UTC

[GitHub] [kafka] tombentley commented on a change in pull request #11006: KAFKA-13049: Name the threads used for log recovery

tombentley commented on a change in pull request #11006:
URL: https://github.com/apache/kafka/pull/11006#discussion_r667692668



##########
File path: core/src/main/scala/kafka/log/LogManager.scala
##########
@@ -312,7 +312,15 @@ class LogManager(logDirs: Seq[File],
       val logDirAbsolutePath = dir.getAbsolutePath
       var hadCleanShutdown: Boolean = false
       try {
-        val pool = Executors.newFixedThreadPool(numRecoveryThreadsPerDataDir)
+        val pool = Executors.newFixedThreadPool(numRecoveryThreadsPerDataDir, new ThreadFactory {
+          private val factory = Executors.defaultThreadFactory()
+          private val threadNumber = new AtomicInteger(1)
+          override def newThread(r: Runnable): Thread = {
+            val thread = factory.newThread(r)
+            thread.setName(s"log-recovery(${dir.getAbsolutePath}, ${threadNumber.getAndIncrement()})")

Review comment:
       `logDirAbsolutePath`: Thanks!
   
   better to use dash (-): I don't have a very strong opinion, except dash is more commonly used in a path name than comma, so if the log dir names were like `data`, `data-2`, then it's a bit confusing because the threads could be named like `data-1`, `data-2`, `data-2-1`, `data-2-2` (assuming >=2 threads per log dir), so people might see some problem associated with the thread `data-2` and think that was about the `data-2` directory, when it's really the 2nd thread processing the `data` directory. 




-- 
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-unsubscribe@kafka.apache.org

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