You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2019/09/03 18:01:26 UTC

[GitHub] [hbase] saintstack commented on a change in pull request #548: HBASE-22930 Set unique name to longCompactions/shortCompactions threads

saintstack commented on a change in pull request #548: HBASE-22930 Set unique name to longCompactions/shortCompactions threads
URL: https://github.com/apache/hbase/pull/548#discussion_r318321645
 
 

 ##########
 File path: hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplit.java
 ##########
 @@ -136,19 +136,22 @@ private void createCompactionExecutors() {
     Preconditions.checkArgument(largeThreads > 0 && smallThreads > 0);
 
     final String n = Thread.currentThread().getName();
-
     StealJobQueue<Runnable> stealJobQueue = new StealJobQueue<Runnable>(COMPARATOR);
-    this.longCompactions = new ThreadPoolExecutor(largeThreads, largeThreads, 60,
-        TimeUnit.SECONDS, stealJobQueue,
-        new ThreadFactoryBuilder()
-            .setNameFormat(n + "-longCompactions-" + System.currentTimeMillis())
-            .setDaemon(true).build());
+
+    AtomicInteger longCompactionThreadCounter = new AtomicInteger(0);
+    this.longCompactions =
+        new ThreadPoolExecutor(largeThreads, largeThreads, 60, TimeUnit.SECONDS, stealJobQueue,
+            new ThreadFactoryBuilder().setNameFormat(n + "-longCompactions-"
+                + longCompactionThreadCounter.getAndIncrement() + "-" + System.currentTimeMillis())
+                .setDaemon(true).build());
 
 Review comment:
   Does this work @pankaj72981 ?  Each time we create a new thread in ThreadPoolExecutor, does the local longCompactionThreadCounter get a #getAndIncrement call so each thread gets an id? If so, do we need the System.currentTimeMillis thing?

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


With regards,
Apache Git Services