Skip to content

Commit 0f0a3a2

Browse files
Pankajsaintstack
authored andcommitted
HBASE-22930 Set unique name to longCompactions/shortCompactions threads (#548)
1 parent dfe5280 commit 0f0a3a2

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplit.java

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -136,19 +136,22 @@ private void createCompactionExecutors() {
136136
Preconditions.checkArgument(largeThreads > 0 && smallThreads > 0);
137137

138138
final String n = Thread.currentThread().getName();
139-
140139
StealJobQueue<Runnable> stealJobQueue = new StealJobQueue<Runnable>(COMPARATOR);
141-
this.longCompactions = new ThreadPoolExecutor(largeThreads, largeThreads, 60,
142-
TimeUnit.SECONDS, stealJobQueue,
143-
new ThreadFactoryBuilder()
144-
.setNameFormat(n + "-longCompactions-" + System.currentTimeMillis())
145-
.setDaemon(true).build());
140+
141+
AtomicInteger longCompactionThreadCounter = new AtomicInteger(0);
142+
this.longCompactions =
143+
new ThreadPoolExecutor(largeThreads, largeThreads, 60, TimeUnit.SECONDS, stealJobQueue,
144+
new ThreadFactoryBuilder().setNameFormat(n + "-longCompactions-"
145+
+ longCompactionThreadCounter.getAndIncrement() + "-" + System.currentTimeMillis())
146+
.setDaemon(true).build());
146147
this.longCompactions.setRejectedExecutionHandler(new Rejection());
147148
this.longCompactions.prestartAllCoreThreads();
148-
this.shortCompactions = new ThreadPoolExecutor(smallThreads, smallThreads, 60,
149-
TimeUnit.SECONDS, stealJobQueue.getStealFromQueue(),
150-
new ThreadFactoryBuilder()
151-
.setNameFormat(n + "-shortCompactions-" + System.currentTimeMillis())
149+
150+
AtomicInteger shortCompactionThreadCounter = new AtomicInteger(0);
151+
this.shortCompactions = new ThreadPoolExecutor(smallThreads, smallThreads, 60, TimeUnit.SECONDS,
152+
stealJobQueue.getStealFromQueue(),
153+
new ThreadFactoryBuilder().setNameFormat(n + "-shortCompactions-"
154+
+ shortCompactionThreadCounter.getAndIncrement() + "-" + System.currentTimeMillis())
152155
.setDaemon(true).build());
153156
this.shortCompactions.setRejectedExecutionHandler(new Rejection());
154157
}

0 commit comments

Comments
 (0)