1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.hadoop.hbase.regionserver;
20
21 import java.io.IOException;
22 import java.io.PrintWriter;
23 import java.io.StringWriter;
24 import java.util.ArrayList;
25 import java.util.Iterator;
26 import java.util.List;
27 import java.util.concurrent.BlockingQueue;
28 import java.util.concurrent.Executors;
29 import java.util.concurrent.RejectedExecutionException;
30 import java.util.concurrent.RejectedExecutionHandler;
31 import java.util.concurrent.ThreadFactory;
32 import java.util.concurrent.ThreadPoolExecutor;
33 import java.util.concurrent.TimeUnit;
34 import java.util.concurrent.atomic.AtomicInteger;
35
36 import org.apache.commons.logging.Log;
37 import org.apache.commons.logging.LogFactory;
38 import org.apache.hadoop.conf.Configuration;
39 import org.apache.hadoop.hbase.RemoteExceptionHandler;
40 import org.apache.hadoop.hbase.classification.InterfaceAudience;
41 import org.apache.hadoop.hbase.conf.ConfigurationManager;
42 import org.apache.hadoop.hbase.conf.PropagatingConfigurationObserver;
43 import org.apache.hadoop.hbase.regionserver.compactions.CompactionContext;
44 import org.apache.hadoop.hbase.regionserver.compactions.CompactionRequest;
45 import org.apache.hadoop.hbase.regionserver.throttle.CompactionThroughputControllerFactory;
46 import org.apache.hadoop.hbase.regionserver.throttle.ThroughputController;
47 import org.apache.hadoop.hbase.security.User;
48 import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
49 import org.apache.hadoop.hbase.util.Pair;
50 import org.apache.hadoop.hbase.util.StealJobQueue;
51 import org.apache.hadoop.util.StringUtils;
52
53 import com.google.common.annotations.VisibleForTesting;
54 import com.google.common.base.Preconditions;
55
56
57
58
59 @InterfaceAudience.Private
60 public class CompactSplitThread implements CompactionRequestor, PropagatingConfigurationObserver {
61 private static final Log LOG = LogFactory.getLog(CompactSplitThread.class);
62
63
64 public final static String LARGE_COMPACTION_THREADS =
65 "hbase.regionserver.thread.compaction.large";
66 public final static int LARGE_COMPACTION_THREADS_DEFAULT = 1;
67
68
69 public final static String SMALL_COMPACTION_THREADS =
70 "hbase.regionserver.thread.compaction.small";
71 public final static int SMALL_COMPACTION_THREADS_DEFAULT = 1;
72
73
74 public final static String SPLIT_THREADS = "hbase.regionserver.thread.split";
75 public final static int SPLIT_THREADS_DEFAULT = 1;
76
77
78 public final static String MERGE_THREADS = "hbase.regionserver.thread.merge";
79 public final static int MERGE_THREADS_DEFAULT = 1;
80
81 public static final String REGION_SERVER_REGION_SPLIT_LIMIT =
82 "hbase.regionserver.regionSplitLimit";
83 public static final int DEFAULT_REGION_SERVER_REGION_SPLIT_LIMIT= 1000;
84
85 private final HRegionServer server;
86 private final Configuration conf;
87
88 private final ThreadPoolExecutor longCompactions;
89 private final ThreadPoolExecutor shortCompactions;
90 private final ThreadPoolExecutor splits;
91 private final ThreadPoolExecutor mergePool;
92
93 private volatile ThroughputController compactionThroughputController;
94
95
96
97
98
99
100 private int regionSplitLimit;
101
102
103 CompactSplitThread(HRegionServer server) {
104 super();
105 this.server = server;
106 this.conf = server.getConfiguration();
107 this.regionSplitLimit = conf.getInt(REGION_SERVER_REGION_SPLIT_LIMIT,
108 DEFAULT_REGION_SERVER_REGION_SPLIT_LIMIT);
109
110 int largeThreads = Math.max(1, conf.getInt(
111 LARGE_COMPACTION_THREADS, LARGE_COMPACTION_THREADS_DEFAULT));
112 int smallThreads = conf.getInt(
113 SMALL_COMPACTION_THREADS, SMALL_COMPACTION_THREADS_DEFAULT);
114
115 int splitThreads = conf.getInt(SPLIT_THREADS, SPLIT_THREADS_DEFAULT);
116
117
118 Preconditions.checkArgument(largeThreads > 0 && smallThreads > 0);
119
120 final String n = Thread.currentThread().getName();
121
122 StealJobQueue<Runnable> stealJobQueue = new StealJobQueue<Runnable>();
123 this.longCompactions = new ThreadPoolExecutor(largeThreads, largeThreads, 60, TimeUnit.SECONDS,
124 stealJobQueue, new ThreadFactory() {
125 AtomicInteger longCompactionThreadCounter = new AtomicInteger(0);
126
127 @Override
128 public Thread newThread(Runnable r) {
129 String name = n + "-longCompactions-" + longCompactionThreadCounter.getAndIncrement();
130 return new Thread(r, name);
131 }
132 });
133 this.longCompactions.setRejectedExecutionHandler(new Rejection());
134 this.longCompactions.prestartAllCoreThreads();
135 this.shortCompactions = new ThreadPoolExecutor(smallThreads, smallThreads, 60, TimeUnit.SECONDS,
136 stealJobQueue.getStealFromQueue(), new ThreadFactory() {
137 AtomicInteger shortCompactionThreadCounter = new AtomicInteger(0);
138
139 @Override
140 public Thread newThread(Runnable r) {
141 String name = n + "-shortCompactions-" + shortCompactionThreadCounter.getAndIncrement();
142 return new Thread(r, name);
143 }
144 });
145 this.shortCompactions
146 .setRejectedExecutionHandler(new Rejection());
147 this.splits = (ThreadPoolExecutor)
148 Executors.newFixedThreadPool(splitThreads, new ThreadFactory() {
149 AtomicInteger splitThreadCounter = new AtomicInteger(0);
150
151 @Override
152 public Thread newThread(Runnable r) {
153 String name = n + "-splits-" + splitThreadCounter.getAndIncrement();
154 return new Thread(r, name);
155 }
156 });
157 int mergeThreads = conf.getInt(MERGE_THREADS, MERGE_THREADS_DEFAULT);
158 this.mergePool = (ThreadPoolExecutor) Executors.newFixedThreadPool(
159 mergeThreads, new ThreadFactory() {
160 @Override
161 public Thread newThread(Runnable r) {
162 String name = n + "-merges-" + System.currentTimeMillis();
163 return new Thread(r, name);
164 }
165 });
166
167
168 this.compactionThroughputController =
169 CompactionThroughputControllerFactory.create(server, conf);
170 }
171
172 @Override
173 public String toString() {
174 return "compaction_queue=("
175 + longCompactions.getQueue().size() + ":"
176 + shortCompactions.getQueue().size() + ")"
177 + ", split_queue=" + splits.getQueue().size()
178 + ", merge_queue=" + mergePool.getQueue().size();
179 }
180
181 public String dumpQueue() {
182 StringBuffer queueLists = new StringBuffer();
183 queueLists.append("Compaction/Split Queue dump:\n");
184 queueLists.append(" LargeCompation Queue:\n");
185 BlockingQueue<Runnable> lq = longCompactions.getQueue();
186 Iterator<Runnable> it = lq.iterator();
187 while (it.hasNext()) {
188 queueLists.append(" " + it.next().toString());
189 queueLists.append("\n");
190 }
191
192 if (shortCompactions != null) {
193 queueLists.append("\n");
194 queueLists.append(" SmallCompation Queue:\n");
195 lq = shortCompactions.getQueue();
196 it = lq.iterator();
197 while (it.hasNext()) {
198 queueLists.append(" " + it.next().toString());
199 queueLists.append("\n");
200 }
201 }
202
203 queueLists.append("\n");
204 queueLists.append(" Split Queue:\n");
205 lq = splits.getQueue();
206 it = lq.iterator();
207 while (it.hasNext()) {
208 queueLists.append(" " + it.next().toString());
209 queueLists.append("\n");
210 }
211
212 queueLists.append("\n");
213 queueLists.append(" Region Merge Queue:\n");
214 lq = mergePool.getQueue();
215 it = lq.iterator();
216 while (it.hasNext()) {
217 queueLists.append(" " + it.next().toString());
218 queueLists.append("\n");
219 }
220
221 return queueLists.toString();
222 }
223
224 public synchronized void requestRegionsMerge(final Region a,
225 final Region b, final boolean forcible, long masterSystemTime, User user) {
226 try {
227 mergePool.execute(new RegionMergeRequest(a, b, this.server, forcible, masterSystemTime,user));
228 if (LOG.isDebugEnabled()) {
229 LOG.debug("Region merge requested for " + a + "," + b + ", forcible="
230 + forcible + ". " + this);
231 }
232 } catch (RejectedExecutionException ree) {
233 LOG.warn("Could not execute merge for " + a + "," + b + ", forcible="
234 + forcible, ree);
235 }
236 }
237
238 public synchronized boolean requestSplit(final Region r) {
239
240 if (shouldSplitRegion() && ((HRegion)r).getCompactPriority() >= Store.PRIORITY_USER) {
241 byte[] midKey = ((HRegion)r).checkSplit();
242 if (midKey != null) {
243 requestSplit(r, midKey);
244 return true;
245 }
246 }
247 return false;
248 }
249
250 public synchronized void requestSplit(final Region r, byte[] midKey) {
251 requestSplit(r, midKey, null);
252 }
253
254
255
256
257 public synchronized void requestSplit(final Region r, byte[] midKey, User user) {
258 if (midKey == null) {
259 LOG.debug("Region " + r.getRegionInfo().getRegionNameAsString() +
260 " not splittable because midkey=null");
261 if (((HRegion)r).shouldForceSplit()) {
262 ((HRegion)r).clearSplit();
263 }
264 return;
265 }
266 try {
267 this.splits.execute(new SplitRequest(r, midKey, this.server, user));
268 if (LOG.isDebugEnabled()) {
269 LOG.debug("Split requested for " + r + ". " + this);
270 }
271 } catch (RejectedExecutionException ree) {
272 LOG.info("Could not execute split for " + r, ree);
273 }
274 }
275
276 @Override
277 public synchronized List<CompactionRequest> requestCompaction(final Region r, final String why)
278 throws IOException {
279 return requestCompaction(r, why, null);
280 }
281
282 @Override
283 public synchronized List<CompactionRequest> requestCompaction(final Region r, final String why,
284 List<Pair<CompactionRequest, Store>> requests) throws IOException {
285 return requestCompaction(r, why, Store.NO_PRIORITY, requests, null);
286 }
287
288 @Override
289 public synchronized CompactionRequest requestCompaction(final Region r, final Store s,
290 final String why, CompactionRequest request) throws IOException {
291 return requestCompaction(r, s, why, Store.NO_PRIORITY, request, null);
292 }
293
294 @Override
295 public synchronized List<CompactionRequest> requestCompaction(final Region r, final String why,
296 int p, List<Pair<CompactionRequest, Store>> requests, User user) throws IOException {
297 return requestCompactionInternal(r, why, p, requests, true, user);
298 }
299
300 private List<CompactionRequest> requestCompactionInternal(final Region r, final String why,
301 int p, List<Pair<CompactionRequest, Store>> requests, boolean selectNow, User user)
302 throws IOException {
303
304 List<CompactionRequest> ret = null;
305 if (requests == null) {
306 ret = selectNow ? new ArrayList<CompactionRequest>(r.getStores().size()) : null;
307 for (Store s : r.getStores()) {
308 CompactionRequest cr = requestCompactionInternal(r, s, why, p, null, selectNow, user);
309 if (selectNow) ret.add(cr);
310 }
311 } else {
312 Preconditions.checkArgument(selectNow);
313 ret = new ArrayList<CompactionRequest>(requests.size());
314 for (Pair<CompactionRequest, Store> pair : requests) {
315 ret.add(requestCompaction(r, pair.getSecond(), why, p, pair.getFirst(), user));
316 }
317 }
318 return ret;
319 }
320
321 @Override
322 public CompactionRequest requestCompaction(final Region r, final Store s,
323 final String why, int priority, CompactionRequest request, User user) throws IOException {
324 return requestCompactionInternal(r, s, why, priority, request, true, user);
325 }
326
327 public synchronized void requestSystemCompaction(
328 final Region r, final String why) throws IOException {
329 requestCompactionInternal(r, why, Store.NO_PRIORITY, null, false, null);
330 }
331
332 public void requestSystemCompaction(
333 final Region r, final Store s, final String why) throws IOException {
334 requestCompactionInternal(r, s, why, Store.NO_PRIORITY, null, false, null);
335 }
336
337
338
339
340
341
342
343
344
345 private synchronized CompactionRequest requestCompactionInternal(final Region r, final Store s,
346 final String why, int priority, CompactionRequest request, boolean selectNow, User user)
347 throws IOException {
348 if (this.server.isStopped()
349 || (r.getTableDesc() != null && !r.getTableDesc().isCompactionEnabled())) {
350 return null;
351 }
352
353 CompactionContext compaction = null;
354 if (selectNow) {
355 compaction = selectCompaction(r, s, priority, request, user);
356 if (compaction == null) return null;
357 }
358
359
360
361 ThreadPoolExecutor pool = (selectNow && s.throttleCompaction(compaction.getRequest().getSize()))
362 ? longCompactions : shortCompactions;
363 pool.execute(new CompactionRunner(s, r, compaction, pool, user));
364 ((HRegion)r).incrementCompactionsQueuedCount();
365 if (LOG.isDebugEnabled()) {
366 String type = (pool == shortCompactions) ? "Small " : "Large ";
367 LOG.debug(type + "Compaction requested: " + (selectNow ? compaction.toString() : "system")
368 + (why != null && !why.isEmpty() ? "; Because: " + why : "") + "; " + this);
369 }
370 return selectNow ? compaction.getRequest() : null;
371 }
372
373 private CompactionContext selectCompaction(final Region r, final Store s,
374 int priority, CompactionRequest request, User user) throws IOException {
375 CompactionContext compaction = s.requestCompaction(priority, request, user);
376 if (compaction == null) {
377 if(LOG.isDebugEnabled() && r.getRegionInfo() != null) {
378 LOG.debug("Not compacting " + r.getRegionInfo().getRegionNameAsString() +
379 " because compaction request was cancelled");
380 }
381 return null;
382 }
383 assert compaction.hasSelection();
384 if (priority != Store.NO_PRIORITY) {
385 compaction.getRequest().setPriority(priority);
386 }
387 return compaction;
388 }
389
390
391
392
393 void interruptIfNecessary() {
394 splits.shutdown();
395 mergePool.shutdown();
396 longCompactions.shutdown();
397 shortCompactions.shutdown();
398 }
399
400 private void waitFor(ThreadPoolExecutor t, String name) {
401 boolean done = false;
402 while (!done) {
403 try {
404 done = t.awaitTermination(60, TimeUnit.SECONDS);
405 LOG.info("Waiting for " + name + " to finish...");
406 if (!done) {
407 t.shutdownNow();
408 }
409 } catch (InterruptedException ie) {
410 LOG.warn("Interrupted waiting for " + name + " to finish...");
411 }
412 }
413 }
414
415 void join() {
416 waitFor(splits, "Split Thread");
417 waitFor(mergePool, "Merge Thread");
418 waitFor(longCompactions, "Large Compaction Thread");
419 waitFor(shortCompactions, "Small Compaction Thread");
420 }
421
422
423
424
425
426
427
428 public int getCompactionQueueSize() {
429 return longCompactions.getQueue().size() + shortCompactions.getQueue().size();
430 }
431
432 public int getLargeCompactionQueueSize() {
433 return longCompactions.getQueue().size();
434 }
435
436
437 public int getSmallCompactionQueueSize() {
438 return shortCompactions.getQueue().size();
439 }
440
441 public int getSplitQueueSize() {
442 return splits.getQueue().size();
443 }
444
445 private boolean shouldSplitRegion() {
446 if(server.getNumberOfOnlineRegions() > 0.9*regionSplitLimit) {
447 LOG.warn("Total number of regions is approaching the upper limit " + regionSplitLimit + ". "
448 + "Please consider taking a look at http://hbase.apache.org/book.html#ops.regionmgt");
449 }
450 return (regionSplitLimit > server.getNumberOfOnlineRegions());
451 }
452
453
454
455
456 public int getRegionSplitLimit() {
457 return this.regionSplitLimit;
458 }
459
460 @edu.umd.cs.findbugs.annotations.SuppressWarnings(value="EQ_COMPARETO_USE_OBJECT_EQUALS",
461 justification="Contrived use of compareTo")
462 private class CompactionRunner implements Runnable, Comparable<CompactionRunner> {
463 private final Store store;
464 private final HRegion region;
465 private CompactionContext compaction;
466 private int queuedPriority;
467 private ThreadPoolExecutor parent;
468 private User user;
469 private long time;
470
471 public CompactionRunner(Store store, Region region,
472 CompactionContext compaction, ThreadPoolExecutor parent, User user) {
473 super();
474 this.store = store;
475 this.region = (HRegion)region;
476 this.compaction = compaction;
477 this.queuedPriority = (this.compaction == null)
478 ? store.getCompactPriority() : compaction.getRequest().getPriority();
479 this.parent = parent;
480 this.user = user;
481 this.time = System.currentTimeMillis();
482 }
483
484 @Override
485 public String toString() {
486 return (this.compaction != null) ? ("Request = " + compaction.getRequest())
487 : ("regionName = " + region.toString() + ", storeName = " + store.toString() +
488 ", priority = " + queuedPriority + ", time = " + time);
489 }
490
491 private void doCompaction(User user) {
492
493 if (this.compaction == null) {
494 int oldPriority = this.queuedPriority;
495 this.queuedPriority = this.store.getCompactPriority();
496 if (this.queuedPriority > oldPriority) {
497
498
499 this.parent.execute(this);
500 return;
501 }
502 try {
503 this.compaction = selectCompaction(this.region, this.store, queuedPriority, null, user);
504 } catch (IOException ex) {
505 LOG.error("Compaction selection failed " + this, ex);
506 server.checkFileSystem();
507 region.decrementCompactionsQueuedCount();
508 return;
509 }
510 if (this.compaction == null) {
511 region.decrementCompactionsQueuedCount();
512 return;
513 }
514
515
516 assert this.compaction.hasSelection();
517 ThreadPoolExecutor pool = store.throttleCompaction(
518 compaction.getRequest().getSize()) ? longCompactions : shortCompactions;
519
520
521
522 if (this.parent == shortCompactions && pool == longCompactions) {
523 this.store.cancelRequestedCompaction(this.compaction);
524 this.compaction = null;
525 this.parent = pool;
526 this.parent.execute(this);
527 return;
528 }
529 }
530
531 assert this.compaction != null;
532
533 this.compaction.getRequest().beforeExecute();
534 try {
535
536
537 long start = EnvironmentEdgeManager.currentTime();
538 boolean completed =
539 region.compact(compaction, store, compactionThroughputController, user);
540 long now = EnvironmentEdgeManager.currentTime();
541 LOG.info(((completed) ? "Completed" : "Aborted") + " compaction: " +
542 this + "; duration=" + StringUtils.formatTimeDiff(now, start));
543 if (completed) {
544
545 if (store.getCompactPriority() <= 0) {
546 requestSystemCompaction(region, store, "Recursive enqueue");
547 } else {
548
549 requestSplit(region);
550 }
551 }
552 } catch (IOException ex) {
553 IOException remoteEx = RemoteExceptionHandler.checkIOException(ex);
554 LOG.error("Compaction failed " + this, remoteEx);
555 if (remoteEx != ex) {
556 LOG.info("Compaction failed at original callstack: " + formatStackTrace(ex));
557 }
558 region.reportCompactionRequestFailure();
559 server.checkFileSystem();
560 } catch (Exception ex) {
561 LOG.error("Compaction failed " + this, ex);
562 region.reportCompactionRequestFailure();
563 server.checkFileSystem();
564 } finally {
565 region.decrementCompactionsQueuedCount();
566 LOG.debug("CompactSplitThread Status: " + CompactSplitThread.this);
567 }
568 this.compaction.getRequest().afterExecute();
569 }
570
571 @Override
572 public void run() {
573 Preconditions.checkNotNull(server);
574 if (server.isStopped()
575 || (region.getTableDesc() != null && !region.getTableDesc().isCompactionEnabled())) {
576 region.decrementCompactionsQueuedCount();
577 return;
578 }
579 doCompaction(user);
580 }
581
582 private String formatStackTrace(Exception ex) {
583 StringWriter sw = new StringWriter();
584 PrintWriter pw = new PrintWriter(sw);
585 ex.printStackTrace(pw);
586 pw.flush();
587 return sw.toString();
588 }
589
590 @Override
591 public int compareTo(CompactionRunner o) {
592
593 int compareVal = queuedPriority - o.queuedPriority;
594 if (compareVal != 0) return compareVal;
595 CompactionContext tc = this.compaction, oc = o.compaction;
596
597 return (tc == null) ? ((oc == null) ? 0 : 1)
598 : ((oc == null) ? -1 : tc.getRequest().compareTo(oc.getRequest()));
599 }
600 }
601
602
603
604
605 private static class Rejection implements RejectedExecutionHandler {
606 @Override
607 public void rejectedExecution(Runnable runnable, ThreadPoolExecutor pool) {
608 if (runnable instanceof CompactionRunner) {
609 CompactionRunner runner = (CompactionRunner)runnable;
610 LOG.debug("Compaction Rejected: " + runner);
611 if (runner.compaction != null) {
612 runner.store.cancelRequestedCompaction(runner.compaction);
613 }
614 }
615 }
616 }
617
618
619
620
621 @Override
622 public void onConfigurationChange(Configuration newConf) {
623
624
625
626
627
628 int largeThreads = Math.max(1, newConf.getInt(
629 LARGE_COMPACTION_THREADS,
630 LARGE_COMPACTION_THREADS_DEFAULT));
631 if (this.longCompactions.getCorePoolSize() != largeThreads) {
632 LOG.info("Changing the value of " + LARGE_COMPACTION_THREADS +
633 " from " + this.longCompactions.getCorePoolSize() + " to " +
634 largeThreads);
635 if(this.longCompactions.getCorePoolSize() < largeThreads) {
636 this.longCompactions.setMaximumPoolSize(largeThreads);
637 this.longCompactions.setCorePoolSize(largeThreads);
638 } else {
639 this.longCompactions.setCorePoolSize(largeThreads);
640 this.longCompactions.setMaximumPoolSize(largeThreads);
641 }
642 }
643
644 int smallThreads = newConf.getInt(SMALL_COMPACTION_THREADS,
645 SMALL_COMPACTION_THREADS_DEFAULT);
646 if (this.shortCompactions.getCorePoolSize() != smallThreads) {
647 LOG.info("Changing the value of " + SMALL_COMPACTION_THREADS +
648 " from " + this.shortCompactions.getCorePoolSize() + " to " +
649 smallThreads);
650 if(this.shortCompactions.getCorePoolSize() < smallThreads) {
651 this.shortCompactions.setMaximumPoolSize(smallThreads);
652 this.shortCompactions.setCorePoolSize(smallThreads);
653 } else {
654 this.shortCompactions.setCorePoolSize(smallThreads);
655 this.shortCompactions.setMaximumPoolSize(smallThreads);
656 }
657 }
658
659 int splitThreads = newConf.getInt(SPLIT_THREADS,
660 SPLIT_THREADS_DEFAULT);
661 if (this.splits.getCorePoolSize() != splitThreads) {
662 LOG.info("Changing the value of " + SPLIT_THREADS +
663 " from " + this.splits.getCorePoolSize() + " to " +
664 splitThreads);
665 if(this.splits.getCorePoolSize() < splitThreads) {
666 this.splits.setMaximumPoolSize(splitThreads);
667 this.splits.setCorePoolSize(splitThreads);
668 } else {
669 this.splits.setCorePoolSize(splitThreads);
670 this.splits.setMaximumPoolSize(splitThreads);
671 }
672 }
673
674 int mergeThreads = newConf.getInt(MERGE_THREADS,
675 MERGE_THREADS_DEFAULT);
676 if (this.mergePool.getCorePoolSize() != mergeThreads) {
677 LOG.info("Changing the value of " + MERGE_THREADS +
678 " from " + this.mergePool.getCorePoolSize() + " to " +
679 mergeThreads);
680 if(this.mergePool.getCorePoolSize() < mergeThreads) {
681 this.mergePool.setMaximumPoolSize(mergeThreads);
682 this.mergePool.setCorePoolSize(mergeThreads);
683 } else {
684 this.mergePool.setCorePoolSize(mergeThreads);
685 this.mergePool.setMaximumPoolSize(mergeThreads);
686 }
687 }
688
689 ThroughputController old = this.compactionThroughputController;
690 if (old != null) {
691 old.stop("configuration change");
692 }
693 this.compactionThroughputController =
694 CompactionThroughputControllerFactory.create(server, newConf);
695
696
697
698 this.conf.reloadConfiguration();
699 }
700
701 protected int getSmallCompactionThreadNum() {
702 return this.shortCompactions.getCorePoolSize();
703 }
704
705 protected int getLargeCompactionThreadNum() {
706 return this.longCompactions.getCorePoolSize();
707 }
708
709 protected int getSplitThreadNum() {
710 return this.splits.getCorePoolSize();
711 }
712
713 protected int getMergeThreadNum() {
714 return this.mergePool.getCorePoolSize();
715 }
716
717
718
719
720 @Override
721 public void registerChildren(ConfigurationManager manager) {
722
723 }
724
725
726
727
728 @Override
729 public void deregisterChildren(ConfigurationManager manager) {
730
731 }
732
733 @VisibleForTesting
734 public ThroughputController getCompactionThroughputController() {
735 return compactionThroughputController;
736 }
737
738 @VisibleForTesting
739
740
741
742
743
744 void shutdownLongCompactions(){
745 this.longCompactions.shutdown();
746 }
747 }