hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From git-site-r...@apache.org
Subject [37/51] [partial] hbase-site git commit: Published site at 82d554e3783372cc6b05489452c815b57c06f6cd.
Date Fri, 28 Jul 2017 15:08:06 GMT
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/a2b2dd19/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/CompactSplit.Rejection.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/CompactSplit.Rejection.html b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/CompactSplit.Rejection.html
index 7dabb5e..782b6f3 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/CompactSplit.Rejection.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/CompactSplit.Rejection.html
@@ -352,369 +352,376 @@
 <span class="sourceLineNo">344</span>    ThreadPoolExecutor pool = (selectNow &amp;&amp; s.throttleCompaction(compaction.getRequest().getSize()))<a name="line.344"></a>
 <span class="sourceLineNo">345</span>      ? longCompactions : shortCompactions;<a name="line.345"></a>
 <span class="sourceLineNo">346</span>    pool.execute(new CompactionRunner(s, r, compaction, pool, user));<a name="line.346"></a>
-<span class="sourceLineNo">347</span>    if (LOG.isDebugEnabled()) {<a name="line.347"></a>
-<span class="sourceLineNo">348</span>      String type = (pool == shortCompactions) ? "Small " : "Large ";<a name="line.348"></a>
-<span class="sourceLineNo">349</span>      LOG.debug(type + "Compaction requested: " + (selectNow ? compaction.toString() : "system")<a name="line.349"></a>
-<span class="sourceLineNo">350</span>          + (why != null &amp;&amp; !why.isEmpty() ? "; Because: " + why : "") + "; " + this);<a name="line.350"></a>
-<span class="sourceLineNo">351</span>    }<a name="line.351"></a>
-<span class="sourceLineNo">352</span>    return selectNow ? compaction.getRequest() : null;<a name="line.352"></a>
-<span class="sourceLineNo">353</span>  }<a name="line.353"></a>
-<span class="sourceLineNo">354</span><a name="line.354"></a>
-<span class="sourceLineNo">355</span>  private CompactionContext selectCompaction(final Region r, final Store s,<a name="line.355"></a>
-<span class="sourceLineNo">356</span>      int priority, CompactionRequest request, User user) throws IOException {<a name="line.356"></a>
-<span class="sourceLineNo">357</span>    CompactionContext compaction = s.requestCompaction(priority, request, user);<a name="line.357"></a>
-<span class="sourceLineNo">358</span>    if (compaction == null) {<a name="line.358"></a>
-<span class="sourceLineNo">359</span>      if(LOG.isDebugEnabled() &amp;&amp; r.getRegionInfo() != null) {<a name="line.359"></a>
-<span class="sourceLineNo">360</span>        LOG.debug("Not compacting " + r.getRegionInfo().getRegionNameAsString() +<a name="line.360"></a>
-<span class="sourceLineNo">361</span>            " because compaction request was cancelled");<a name="line.361"></a>
-<span class="sourceLineNo">362</span>      }<a name="line.362"></a>
-<span class="sourceLineNo">363</span>      return null;<a name="line.363"></a>
-<span class="sourceLineNo">364</span>    }<a name="line.364"></a>
-<span class="sourceLineNo">365</span>    assert compaction.hasSelection();<a name="line.365"></a>
-<span class="sourceLineNo">366</span>    if (priority != Store.NO_PRIORITY) {<a name="line.366"></a>
-<span class="sourceLineNo">367</span>      compaction.getRequest().setPriority(priority);<a name="line.367"></a>
-<span class="sourceLineNo">368</span>    }<a name="line.368"></a>
-<span class="sourceLineNo">369</span>    return compaction;<a name="line.369"></a>
-<span class="sourceLineNo">370</span>  }<a name="line.370"></a>
-<span class="sourceLineNo">371</span><a name="line.371"></a>
-<span class="sourceLineNo">372</span>  /**<a name="line.372"></a>
-<span class="sourceLineNo">373</span>   * Only interrupt once it's done with a run through the work loop.<a name="line.373"></a>
-<span class="sourceLineNo">374</span>   */<a name="line.374"></a>
-<span class="sourceLineNo">375</span>  void interruptIfNecessary() {<a name="line.375"></a>
-<span class="sourceLineNo">376</span>    splits.shutdown();<a name="line.376"></a>
-<span class="sourceLineNo">377</span>    longCompactions.shutdown();<a name="line.377"></a>
-<span class="sourceLineNo">378</span>    shortCompactions.shutdown();<a name="line.378"></a>
-<span class="sourceLineNo">379</span>  }<a name="line.379"></a>
-<span class="sourceLineNo">380</span><a name="line.380"></a>
-<span class="sourceLineNo">381</span>  private void waitFor(ThreadPoolExecutor t, String name) {<a name="line.381"></a>
-<span class="sourceLineNo">382</span>    boolean done = false;<a name="line.382"></a>
-<span class="sourceLineNo">383</span>    while (!done) {<a name="line.383"></a>
-<span class="sourceLineNo">384</span>      try {<a name="line.384"></a>
-<span class="sourceLineNo">385</span>        done = t.awaitTermination(60, TimeUnit.SECONDS);<a name="line.385"></a>
-<span class="sourceLineNo">386</span>        LOG.info("Waiting for " + name + " to finish...");<a name="line.386"></a>
-<span class="sourceLineNo">387</span>        if (!done) {<a name="line.387"></a>
-<span class="sourceLineNo">388</span>          t.shutdownNow();<a name="line.388"></a>
-<span class="sourceLineNo">389</span>        }<a name="line.389"></a>
-<span class="sourceLineNo">390</span>      } catch (InterruptedException ie) {<a name="line.390"></a>
-<span class="sourceLineNo">391</span>        LOG.warn("Interrupted waiting for " + name + " to finish...");<a name="line.391"></a>
-<span class="sourceLineNo">392</span>      }<a name="line.392"></a>
-<span class="sourceLineNo">393</span>    }<a name="line.393"></a>
-<span class="sourceLineNo">394</span>  }<a name="line.394"></a>
-<span class="sourceLineNo">395</span><a name="line.395"></a>
-<span class="sourceLineNo">396</span>  void join() {<a name="line.396"></a>
-<span class="sourceLineNo">397</span>    waitFor(splits, "Split Thread");<a name="line.397"></a>
-<span class="sourceLineNo">398</span>    waitFor(longCompactions, "Large Compaction Thread");<a name="line.398"></a>
-<span class="sourceLineNo">399</span>    waitFor(shortCompactions, "Small Compaction Thread");<a name="line.399"></a>
-<span class="sourceLineNo">400</span>  }<a name="line.400"></a>
-<span class="sourceLineNo">401</span><a name="line.401"></a>
-<span class="sourceLineNo">402</span>  /**<a name="line.402"></a>
-<span class="sourceLineNo">403</span>   * Returns the current size of the queue containing regions that are<a name="line.403"></a>
-<span class="sourceLineNo">404</span>   * processed.<a name="line.404"></a>
-<span class="sourceLineNo">405</span>   *<a name="line.405"></a>
-<span class="sourceLineNo">406</span>   * @return The current size of the regions queue.<a name="line.406"></a>
-<span class="sourceLineNo">407</span>   */<a name="line.407"></a>
-<span class="sourceLineNo">408</span>  public int getCompactionQueueSize() {<a name="line.408"></a>
-<span class="sourceLineNo">409</span>    return longCompactions.getQueue().size() + shortCompactions.getQueue().size();<a name="line.409"></a>
-<span class="sourceLineNo">410</span>  }<a name="line.410"></a>
-<span class="sourceLineNo">411</span><a name="line.411"></a>
-<span class="sourceLineNo">412</span>  public int getLargeCompactionQueueSize() {<a name="line.412"></a>
-<span class="sourceLineNo">413</span>    return longCompactions.getQueue().size();<a name="line.413"></a>
-<span class="sourceLineNo">414</span>  }<a name="line.414"></a>
-<span class="sourceLineNo">415</span><a name="line.415"></a>
+<span class="sourceLineNo">347</span>    ((HRegion)r).incrementCompactionsQueuedCount();<a name="line.347"></a>
+<span class="sourceLineNo">348</span>    if (LOG.isDebugEnabled()) {<a name="line.348"></a>
+<span class="sourceLineNo">349</span>      String type = (pool == shortCompactions) ? "Small " : "Large ";<a name="line.349"></a>
+<span class="sourceLineNo">350</span>      LOG.debug(type + "Compaction requested: " + (selectNow ? compaction.toString() : "system")<a name="line.350"></a>
+<span class="sourceLineNo">351</span>          + (why != null &amp;&amp; !why.isEmpty() ? "; Because: " + why : "") + "; " + this);<a name="line.351"></a>
+<span class="sourceLineNo">352</span>    }<a name="line.352"></a>
+<span class="sourceLineNo">353</span>    return selectNow ? compaction.getRequest() : null;<a name="line.353"></a>
+<span class="sourceLineNo">354</span>  }<a name="line.354"></a>
+<span class="sourceLineNo">355</span><a name="line.355"></a>
+<span class="sourceLineNo">356</span>  private CompactionContext selectCompaction(final Region r, final Store s,<a name="line.356"></a>
+<span class="sourceLineNo">357</span>      int priority, CompactionRequest request, User user) throws IOException {<a name="line.357"></a>
+<span class="sourceLineNo">358</span>    CompactionContext compaction = s.requestCompaction(priority, request, user);<a name="line.358"></a>
+<span class="sourceLineNo">359</span>    if (compaction == null) {<a name="line.359"></a>
+<span class="sourceLineNo">360</span>      if(LOG.isDebugEnabled() &amp;&amp; r.getRegionInfo() != null) {<a name="line.360"></a>
+<span class="sourceLineNo">361</span>        LOG.debug("Not compacting " + r.getRegionInfo().getRegionNameAsString() +<a name="line.361"></a>
+<span class="sourceLineNo">362</span>            " because compaction request was cancelled");<a name="line.362"></a>
+<span class="sourceLineNo">363</span>      }<a name="line.363"></a>
+<span class="sourceLineNo">364</span>      return null;<a name="line.364"></a>
+<span class="sourceLineNo">365</span>    }<a name="line.365"></a>
+<span class="sourceLineNo">366</span>    assert compaction.hasSelection();<a name="line.366"></a>
+<span class="sourceLineNo">367</span>    if (priority != Store.NO_PRIORITY) {<a name="line.367"></a>
+<span class="sourceLineNo">368</span>      compaction.getRequest().setPriority(priority);<a name="line.368"></a>
+<span class="sourceLineNo">369</span>    }<a name="line.369"></a>
+<span class="sourceLineNo">370</span>    return compaction;<a name="line.370"></a>
+<span class="sourceLineNo">371</span>  }<a name="line.371"></a>
+<span class="sourceLineNo">372</span><a name="line.372"></a>
+<span class="sourceLineNo">373</span>  /**<a name="line.373"></a>
+<span class="sourceLineNo">374</span>   * Only interrupt once it's done with a run through the work loop.<a name="line.374"></a>
+<span class="sourceLineNo">375</span>   */<a name="line.375"></a>
+<span class="sourceLineNo">376</span>  void interruptIfNecessary() {<a name="line.376"></a>
+<span class="sourceLineNo">377</span>    splits.shutdown();<a name="line.377"></a>
+<span class="sourceLineNo">378</span>    longCompactions.shutdown();<a name="line.378"></a>
+<span class="sourceLineNo">379</span>    shortCompactions.shutdown();<a name="line.379"></a>
+<span class="sourceLineNo">380</span>  }<a name="line.380"></a>
+<span class="sourceLineNo">381</span><a name="line.381"></a>
+<span class="sourceLineNo">382</span>  private void waitFor(ThreadPoolExecutor t, String name) {<a name="line.382"></a>
+<span class="sourceLineNo">383</span>    boolean done = false;<a name="line.383"></a>
+<span class="sourceLineNo">384</span>    while (!done) {<a name="line.384"></a>
+<span class="sourceLineNo">385</span>      try {<a name="line.385"></a>
+<span class="sourceLineNo">386</span>        done = t.awaitTermination(60, TimeUnit.SECONDS);<a name="line.386"></a>
+<span class="sourceLineNo">387</span>        LOG.info("Waiting for " + name + " to finish...");<a name="line.387"></a>
+<span class="sourceLineNo">388</span>        if (!done) {<a name="line.388"></a>
+<span class="sourceLineNo">389</span>          t.shutdownNow();<a name="line.389"></a>
+<span class="sourceLineNo">390</span>        }<a name="line.390"></a>
+<span class="sourceLineNo">391</span>      } catch (InterruptedException ie) {<a name="line.391"></a>
+<span class="sourceLineNo">392</span>        LOG.warn("Interrupted waiting for " + name + " to finish...");<a name="line.392"></a>
+<span class="sourceLineNo">393</span>      }<a name="line.393"></a>
+<span class="sourceLineNo">394</span>    }<a name="line.394"></a>
+<span class="sourceLineNo">395</span>  }<a name="line.395"></a>
+<span class="sourceLineNo">396</span><a name="line.396"></a>
+<span class="sourceLineNo">397</span>  void join() {<a name="line.397"></a>
+<span class="sourceLineNo">398</span>    waitFor(splits, "Split Thread");<a name="line.398"></a>
+<span class="sourceLineNo">399</span>    waitFor(longCompactions, "Large Compaction Thread");<a name="line.399"></a>
+<span class="sourceLineNo">400</span>    waitFor(shortCompactions, "Small Compaction Thread");<a name="line.400"></a>
+<span class="sourceLineNo">401</span>  }<a name="line.401"></a>
+<span class="sourceLineNo">402</span><a name="line.402"></a>
+<span class="sourceLineNo">403</span>  /**<a name="line.403"></a>
+<span class="sourceLineNo">404</span>   * Returns the current size of the queue containing regions that are<a name="line.404"></a>
+<span class="sourceLineNo">405</span>   * processed.<a name="line.405"></a>
+<span class="sourceLineNo">406</span>   *<a name="line.406"></a>
+<span class="sourceLineNo">407</span>   * @return The current size of the regions queue.<a name="line.407"></a>
+<span class="sourceLineNo">408</span>   */<a name="line.408"></a>
+<span class="sourceLineNo">409</span>  public int getCompactionQueueSize() {<a name="line.409"></a>
+<span class="sourceLineNo">410</span>    return longCompactions.getQueue().size() + shortCompactions.getQueue().size();<a name="line.410"></a>
+<span class="sourceLineNo">411</span>  }<a name="line.411"></a>
+<span class="sourceLineNo">412</span><a name="line.412"></a>
+<span class="sourceLineNo">413</span>  public int getLargeCompactionQueueSize() {<a name="line.413"></a>
+<span class="sourceLineNo">414</span>    return longCompactions.getQueue().size();<a name="line.414"></a>
+<span class="sourceLineNo">415</span>  }<a name="line.415"></a>
 <span class="sourceLineNo">416</span><a name="line.416"></a>
-<span class="sourceLineNo">417</span>  public int getSmallCompactionQueueSize() {<a name="line.417"></a>
-<span class="sourceLineNo">418</span>    return shortCompactions.getQueue().size();<a name="line.418"></a>
-<span class="sourceLineNo">419</span>  }<a name="line.419"></a>
-<span class="sourceLineNo">420</span><a name="line.420"></a>
-<span class="sourceLineNo">421</span>  public int getSplitQueueSize() {<a name="line.421"></a>
-<span class="sourceLineNo">422</span>    return splits.getQueue().size();<a name="line.422"></a>
-<span class="sourceLineNo">423</span>  }<a name="line.423"></a>
-<span class="sourceLineNo">424</span><a name="line.424"></a>
-<span class="sourceLineNo">425</span>  private boolean shouldSplitRegion() {<a name="line.425"></a>
-<span class="sourceLineNo">426</span>    if(server.getNumberOfOnlineRegions() &gt; 0.9*regionSplitLimit) {<a name="line.426"></a>
-<span class="sourceLineNo">427</span>      LOG.warn("Total number of regions is approaching the upper limit " + regionSplitLimit + ". "<a name="line.427"></a>
-<span class="sourceLineNo">428</span>          + "Please consider taking a look at http://hbase.apache.org/book.html#ops.regionmgt");<a name="line.428"></a>
-<span class="sourceLineNo">429</span>    }<a name="line.429"></a>
-<span class="sourceLineNo">430</span>    return (regionSplitLimit &gt; server.getNumberOfOnlineRegions());<a name="line.430"></a>
-<span class="sourceLineNo">431</span>  }<a name="line.431"></a>
-<span class="sourceLineNo">432</span><a name="line.432"></a>
-<span class="sourceLineNo">433</span>  /**<a name="line.433"></a>
-<span class="sourceLineNo">434</span>   * @return the regionSplitLimit<a name="line.434"></a>
-<span class="sourceLineNo">435</span>   */<a name="line.435"></a>
-<span class="sourceLineNo">436</span>  public int getRegionSplitLimit() {<a name="line.436"></a>
-<span class="sourceLineNo">437</span>    return this.regionSplitLimit;<a name="line.437"></a>
-<span class="sourceLineNo">438</span>  }<a name="line.438"></a>
-<span class="sourceLineNo">439</span><a name="line.439"></a>
-<span class="sourceLineNo">440</span>  @edu.umd.cs.findbugs.annotations.SuppressWarnings(value="EQ_COMPARETO_USE_OBJECT_EQUALS",<a name="line.440"></a>
-<span class="sourceLineNo">441</span>      justification="Contrived use of compareTo")<a name="line.441"></a>
-<span class="sourceLineNo">442</span>  private class CompactionRunner implements Runnable, Comparable&lt;CompactionRunner&gt; {<a name="line.442"></a>
-<span class="sourceLineNo">443</span>    private final Store store;<a name="line.443"></a>
-<span class="sourceLineNo">444</span>    private final HRegion region;<a name="line.444"></a>
-<span class="sourceLineNo">445</span>    private CompactionContext compaction;<a name="line.445"></a>
-<span class="sourceLineNo">446</span>    private int queuedPriority;<a name="line.446"></a>
-<span class="sourceLineNo">447</span>    private ThreadPoolExecutor parent;<a name="line.447"></a>
-<span class="sourceLineNo">448</span>    private User user;<a name="line.448"></a>
-<span class="sourceLineNo">449</span>    private long time;<a name="line.449"></a>
-<span class="sourceLineNo">450</span><a name="line.450"></a>
-<span class="sourceLineNo">451</span>    public CompactionRunner(Store store, Region region,<a name="line.451"></a>
-<span class="sourceLineNo">452</span>        CompactionContext compaction, ThreadPoolExecutor parent, User user) {<a name="line.452"></a>
-<span class="sourceLineNo">453</span>      super();<a name="line.453"></a>
-<span class="sourceLineNo">454</span>      this.store = store;<a name="line.454"></a>
-<span class="sourceLineNo">455</span>      this.region = (HRegion)region;<a name="line.455"></a>
-<span class="sourceLineNo">456</span>      this.compaction = compaction;<a name="line.456"></a>
-<span class="sourceLineNo">457</span>      this.queuedPriority = (this.compaction == null)<a name="line.457"></a>
-<span class="sourceLineNo">458</span>          ? store.getCompactPriority() : compaction.getRequest().getPriority();<a name="line.458"></a>
-<span class="sourceLineNo">459</span>      this.parent = parent;<a name="line.459"></a>
-<span class="sourceLineNo">460</span>      this.user = user;<a name="line.460"></a>
-<span class="sourceLineNo">461</span>      this.time =  System.currentTimeMillis();<a name="line.461"></a>
-<span class="sourceLineNo">462</span>    }<a name="line.462"></a>
-<span class="sourceLineNo">463</span><a name="line.463"></a>
-<span class="sourceLineNo">464</span>    @Override<a name="line.464"></a>
-<span class="sourceLineNo">465</span>    public String toString() {<a name="line.465"></a>
-<span class="sourceLineNo">466</span>      return (this.compaction != null) ? ("Request = " + compaction.getRequest())<a name="line.466"></a>
-<span class="sourceLineNo">467</span>          : ("regionName = " + region.toString() + ", storeName = " + store.toString() +<a name="line.467"></a>
-<span class="sourceLineNo">468</span>             ", priority = " + queuedPriority + ", time = " + time);<a name="line.468"></a>
-<span class="sourceLineNo">469</span>    }<a name="line.469"></a>
-<span class="sourceLineNo">470</span><a name="line.470"></a>
-<span class="sourceLineNo">471</span>    private void doCompaction(User user) {<a name="line.471"></a>
-<span class="sourceLineNo">472</span>      // Common case - system compaction without a file selection. Select now.<a name="line.472"></a>
-<span class="sourceLineNo">473</span>      if (this.compaction == null) {<a name="line.473"></a>
-<span class="sourceLineNo">474</span>        int oldPriority = this.queuedPriority;<a name="line.474"></a>
-<span class="sourceLineNo">475</span>        this.queuedPriority = this.store.getCompactPriority();<a name="line.475"></a>
-<span class="sourceLineNo">476</span>        if (this.queuedPriority &gt; oldPriority) {<a name="line.476"></a>
-<span class="sourceLineNo">477</span>          // Store priority decreased while we were in queue (due to some other compaction?),<a name="line.477"></a>
-<span class="sourceLineNo">478</span>          // requeue with new priority to avoid blocking potential higher priorities.<a name="line.478"></a>
-<span class="sourceLineNo">479</span>          this.parent.execute(this);<a name="line.479"></a>
-<span class="sourceLineNo">480</span>          return;<a name="line.480"></a>
-<span class="sourceLineNo">481</span>        }<a name="line.481"></a>
-<span class="sourceLineNo">482</span>        try {<a name="line.482"></a>
-<span class="sourceLineNo">483</span>          this.compaction = selectCompaction(this.region, this.store, queuedPriority, null, user);<a name="line.483"></a>
-<span class="sourceLineNo">484</span>        } catch (IOException ex) {<a name="line.484"></a>
-<span class="sourceLineNo">485</span>          LOG.error("Compaction selection failed " + this, ex);<a name="line.485"></a>
-<span class="sourceLineNo">486</span>          server.checkFileSystem();<a name="line.486"></a>
-<span class="sourceLineNo">487</span>          return;<a name="line.487"></a>
-<span class="sourceLineNo">488</span>        }<a name="line.488"></a>
-<span class="sourceLineNo">489</span>        if (this.compaction == null) return; // nothing to do<a name="line.489"></a>
-<span class="sourceLineNo">490</span>        // Now see if we are in correct pool for the size; if not, go to the correct one.<a name="line.490"></a>
-<span class="sourceLineNo">491</span>        // We might end up waiting for a while, so cancel the selection.<a name="line.491"></a>
-<span class="sourceLineNo">492</span>        assert this.compaction.hasSelection();<a name="line.492"></a>
-<span class="sourceLineNo">493</span>        ThreadPoolExecutor pool = store.throttleCompaction(<a name="line.493"></a>
-<span class="sourceLineNo">494</span>            compaction.getRequest().getSize()) ? longCompactions : shortCompactions;<a name="line.494"></a>
-<span class="sourceLineNo">495</span><a name="line.495"></a>
-<span class="sourceLineNo">496</span>        // Long compaction pool can process small job<a name="line.496"></a>
-<span class="sourceLineNo">497</span>        // Short compaction pool should not process large job<a name="line.497"></a>
-<span class="sourceLineNo">498</span>        if (this.parent == shortCompactions &amp;&amp; pool == longCompactions) {<a name="line.498"></a>
-<span class="sourceLineNo">499</span>          this.store.cancelRequestedCompaction(this.compaction);<a name="line.499"></a>
-<span class="sourceLineNo">500</span>          this.compaction = null;<a name="line.500"></a>
-<span class="sourceLineNo">501</span>          this.parent = pool;<a name="line.501"></a>
-<span class="sourceLineNo">502</span>          this.parent.execute(this);<a name="line.502"></a>
-<span class="sourceLineNo">503</span>          return;<a name="line.503"></a>
-<span class="sourceLineNo">504</span>        }<a name="line.504"></a>
-<span class="sourceLineNo">505</span>      }<a name="line.505"></a>
-<span class="sourceLineNo">506</span>      // Finally we can compact something.<a name="line.506"></a>
-<span class="sourceLineNo">507</span>      assert this.compaction != null;<a name="line.507"></a>
-<span class="sourceLineNo">508</span><a name="line.508"></a>
-<span class="sourceLineNo">509</span>      this.compaction.getRequest().beforeExecute();<a name="line.509"></a>
-<span class="sourceLineNo">510</span>      try {<a name="line.510"></a>
-<span class="sourceLineNo">511</span>        // Note: please don't put single-compaction logic here;<a name="line.511"></a>
-<span class="sourceLineNo">512</span>        //       put it into region/store/etc. This is CST logic.<a name="line.512"></a>
-<span class="sourceLineNo">513</span>        long start = EnvironmentEdgeManager.currentTime();<a name="line.513"></a>
-<span class="sourceLineNo">514</span>        boolean completed =<a name="line.514"></a>
-<span class="sourceLineNo">515</span>            region.compact(compaction, store, compactionThroughputController, user);<a name="line.515"></a>
-<span class="sourceLineNo">516</span>        long now = EnvironmentEdgeManager.currentTime();<a name="line.516"></a>
-<span class="sourceLineNo">517</span>        LOG.info(((completed) ? "Completed" : "Aborted") + " compaction: " +<a name="line.517"></a>
-<span class="sourceLineNo">518</span>              this + "; duration=" + StringUtils.formatTimeDiff(now, start));<a name="line.518"></a>
-<span class="sourceLineNo">519</span>        if (completed) {<a name="line.519"></a>
-<span class="sourceLineNo">520</span>          // degenerate case: blocked regions require recursive enqueues<a name="line.520"></a>
-<span class="sourceLineNo">521</span>          if (store.getCompactPriority() &lt;= 0) {<a name="line.521"></a>
-<span class="sourceLineNo">522</span>            requestSystemCompaction(region, store, "Recursive enqueue");<a name="line.522"></a>
-<span class="sourceLineNo">523</span>          } else {<a name="line.523"></a>
-<span class="sourceLineNo">524</span>            // see if the compaction has caused us to exceed max region size<a name="line.524"></a>
-<span class="sourceLineNo">525</span>            requestSplit(region);<a name="line.525"></a>
-<span class="sourceLineNo">526</span>          }<a name="line.526"></a>
-<span class="sourceLineNo">527</span>        }<a name="line.527"></a>
-<span class="sourceLineNo">528</span>      } catch (IOException ex) {<a name="line.528"></a>
-<span class="sourceLineNo">529</span>        IOException remoteEx =<a name="line.529"></a>
-<span class="sourceLineNo">530</span>            ex instanceof RemoteException ? ((RemoteException) ex).unwrapRemoteException() : ex;<a name="line.530"></a>
-<span class="sourceLineNo">531</span>        LOG.error("Compaction failed " + this, remoteEx);<a name="line.531"></a>
-<span class="sourceLineNo">532</span>        if (remoteEx != ex) {<a name="line.532"></a>
-<span class="sourceLineNo">533</span>          LOG.info("Compaction failed at original callstack: " + formatStackTrace(ex));<a name="line.533"></a>
-<span class="sourceLineNo">534</span>        }<a name="line.534"></a>
-<span class="sourceLineNo">535</span>        region.reportCompactionRequestFailure();<a name="line.535"></a>
-<span class="sourceLineNo">536</span>        server.checkFileSystem();<a name="line.536"></a>
-<span class="sourceLineNo">537</span>      } catch (Exception ex) {<a name="line.537"></a>
-<span class="sourceLineNo">538</span>        LOG.error("Compaction failed " + this, ex);<a name="line.538"></a>
-<span class="sourceLineNo">539</span>        region.reportCompactionRequestFailure();<a name="line.539"></a>
-<span class="sourceLineNo">540</span>        server.checkFileSystem();<a name="line.540"></a>
-<span class="sourceLineNo">541</span>      } finally {<a name="line.541"></a>
-<span class="sourceLineNo">542</span>        LOG.debug("CompactSplitThread Status: " + CompactSplit.this);<a name="line.542"></a>
-<span class="sourceLineNo">543</span>      }<a name="line.543"></a>
-<span class="sourceLineNo">544</span>      this.compaction.getRequest().afterExecute();<a name="line.544"></a>
-<span class="sourceLineNo">545</span>    }<a name="line.545"></a>
-<span class="sourceLineNo">546</span><a name="line.546"></a>
-<span class="sourceLineNo">547</span>    @Override<a name="line.547"></a>
-<span class="sourceLineNo">548</span>    public void run() {<a name="line.548"></a>
-<span class="sourceLineNo">549</span>      Preconditions.checkNotNull(server);<a name="line.549"></a>
-<span class="sourceLineNo">550</span>      if (server.isStopped()<a name="line.550"></a>
-<span class="sourceLineNo">551</span>          || (region.getTableDescriptor() != null &amp;&amp; !region.getTableDescriptor().isCompactionEnabled())) {<a name="line.551"></a>
-<span class="sourceLineNo">552</span>        return;<a name="line.552"></a>
-<span class="sourceLineNo">553</span>      }<a name="line.553"></a>
-<span class="sourceLineNo">554</span>      doCompaction(user);<a name="line.554"></a>
-<span class="sourceLineNo">555</span>    }<a name="line.555"></a>
-<span class="sourceLineNo">556</span><a name="line.556"></a>
-<span class="sourceLineNo">557</span>    private String formatStackTrace(Exception ex) {<a name="line.557"></a>
-<span class="sourceLineNo">558</span>      StringWriter sw = new StringWriter();<a name="line.558"></a>
-<span class="sourceLineNo">559</span>      PrintWriter pw = new PrintWriter(sw);<a name="line.559"></a>
-<span class="sourceLineNo">560</span>      ex.printStackTrace(pw);<a name="line.560"></a>
-<span class="sourceLineNo">561</span>      pw.flush();<a name="line.561"></a>
-<span class="sourceLineNo">562</span>      return sw.toString();<a name="line.562"></a>
-<span class="sourceLineNo">563</span>    }<a name="line.563"></a>
-<span class="sourceLineNo">564</span><a name="line.564"></a>
-<span class="sourceLineNo">565</span>    @Override<a name="line.565"></a>
-<span class="sourceLineNo">566</span>    public int compareTo(CompactionRunner o) {<a name="line.566"></a>
-<span class="sourceLineNo">567</span>      // Only compare the underlying request (if any), for queue sorting purposes.<a name="line.567"></a>
-<span class="sourceLineNo">568</span>      int compareVal = queuedPriority - o.queuedPriority; // compare priority<a name="line.568"></a>
-<span class="sourceLineNo">569</span>      if (compareVal != 0) return compareVal;<a name="line.569"></a>
-<span class="sourceLineNo">570</span>      CompactionContext tc = this.compaction, oc = o.compaction;<a name="line.570"></a>
-<span class="sourceLineNo">571</span>      // Sort pre-selected (user?) compactions before system ones with equal priority.<a name="line.571"></a>
-<span class="sourceLineNo">572</span>      return (tc == null) ? ((oc == null) ? 0 : 1)<a name="line.572"></a>
-<span class="sourceLineNo">573</span>          : ((oc == null) ? -1 : tc.getRequest().compareTo(oc.getRequest()));<a name="line.573"></a>
-<span class="sourceLineNo">574</span>    }<a name="line.574"></a>
-<span class="sourceLineNo">575</span>  }<a name="line.575"></a>
-<span class="sourceLineNo">576</span><a name="line.576"></a>
-<span class="sourceLineNo">577</span>  /**<a name="line.577"></a>
-<span class="sourceLineNo">578</span>   * Cleanup class to use when rejecting a compaction request from the queue.<a name="line.578"></a>
-<span class="sourceLineNo">579</span>   */<a name="line.579"></a>
-<span class="sourceLineNo">580</span>  private static class Rejection implements RejectedExecutionHandler {<a name="line.580"></a>
-<span class="sourceLineNo">581</span>    @Override<a name="line.581"></a>
-<span class="sourceLineNo">582</span>    public void rejectedExecution(Runnable runnable, ThreadPoolExecutor pool) {<a name="line.582"></a>
-<span class="sourceLineNo">583</span>      if (runnable instanceof CompactionRunner) {<a name="line.583"></a>
-<span class="sourceLineNo">584</span>        CompactionRunner runner = (CompactionRunner)runnable;<a name="line.584"></a>
-<span class="sourceLineNo">585</span>        LOG.debug("Compaction Rejected: " + runner);<a name="line.585"></a>
-<span class="sourceLineNo">586</span>        runner.store.cancelRequestedCompaction(runner.compaction);<a name="line.586"></a>
-<span class="sourceLineNo">587</span>      }<a name="line.587"></a>
-<span class="sourceLineNo">588</span>    }<a name="line.588"></a>
-<span class="sourceLineNo">589</span>  }<a name="line.589"></a>
-<span class="sourceLineNo">590</span><a name="line.590"></a>
-<span class="sourceLineNo">591</span>  /**<a name="line.591"></a>
-<span class="sourceLineNo">592</span>   * {@inheritDoc}<a name="line.592"></a>
-<span class="sourceLineNo">593</span>   */<a name="line.593"></a>
-<span class="sourceLineNo">594</span>  @Override<a name="line.594"></a>
-<span class="sourceLineNo">595</span>  public void onConfigurationChange(Configuration newConf) {<a name="line.595"></a>
-<span class="sourceLineNo">596</span>    // Check if number of large / small compaction threads has changed, and then<a name="line.596"></a>
-<span class="sourceLineNo">597</span>    // adjust the core pool size of the thread pools, by using the<a name="line.597"></a>
-<span class="sourceLineNo">598</span>    // setCorePoolSize() method. According to the javadocs, it is safe to<a name="line.598"></a>
-<span class="sourceLineNo">599</span>    // change the core pool size on-the-fly. We need to reset the maximum<a name="line.599"></a>
-<span class="sourceLineNo">600</span>    // pool size, as well.<a name="line.600"></a>
-<span class="sourceLineNo">601</span>    int largeThreads = Math.max(1, newConf.getInt(<a name="line.601"></a>
-<span class="sourceLineNo">602</span>            LARGE_COMPACTION_THREADS,<a name="line.602"></a>
-<span class="sourceLineNo">603</span>            LARGE_COMPACTION_THREADS_DEFAULT));<a name="line.603"></a>
-<span class="sourceLineNo">604</span>    if (this.longCompactions.getCorePoolSize() != largeThreads) {<a name="line.604"></a>
-<span class="sourceLineNo">605</span>      LOG.info("Changing the value of " + LARGE_COMPACTION_THREADS +<a name="line.605"></a>
-<span class="sourceLineNo">606</span>              " from " + this.longCompactions.getCorePoolSize() + " to " +<a name="line.606"></a>
-<span class="sourceLineNo">607</span>              largeThreads);<a name="line.607"></a>
-<span class="sourceLineNo">608</span>      if(this.longCompactions.getCorePoolSize() &lt; largeThreads) {<a name="line.608"></a>
-<span class="sourceLineNo">609</span>        this.longCompactions.setMaximumPoolSize(largeThreads);<a name="line.609"></a>
-<span class="sourceLineNo">610</span>        this.longCompactions.setCorePoolSize(largeThreads);<a name="line.610"></a>
-<span class="sourceLineNo">611</span>      } else {<a name="line.611"></a>
-<span class="sourceLineNo">612</span>        this.longCompactions.setCorePoolSize(largeThreads);<a name="line.612"></a>
-<span class="sourceLineNo">613</span>        this.longCompactions.setMaximumPoolSize(largeThreads);<a name="line.613"></a>
-<span class="sourceLineNo">614</span>      }<a name="line.614"></a>
-<span class="sourceLineNo">615</span>    }<a name="line.615"></a>
-<span class="sourceLineNo">616</span><a name="line.616"></a>
-<span class="sourceLineNo">617</span>    int smallThreads = newConf.getInt(SMALL_COMPACTION_THREADS,<a name="line.617"></a>
-<span class="sourceLineNo">618</span>            SMALL_COMPACTION_THREADS_DEFAULT);<a name="line.618"></a>
-<span class="sourceLineNo">619</span>    if (this.shortCompactions.getCorePoolSize() != smallThreads) {<a name="line.619"></a>
-<span class="sourceLineNo">620</span>      LOG.info("Changing the value of " + SMALL_COMPACTION_THREADS +<a name="line.620"></a>
-<span class="sourceLineNo">621</span>                " from " + this.shortCompactions.getCorePoolSize() + " to " +<a name="line.621"></a>
-<span class="sourceLineNo">622</span>                smallThreads);<a name="line.622"></a>
-<span class="sourceLineNo">623</span>      if(this.shortCompactions.getCorePoolSize() &lt; smallThreads) {<a name="line.623"></a>
-<span class="sourceLineNo">624</span>        this.shortCompactions.setMaximumPoolSize(smallThreads);<a name="line.624"></a>
-<span class="sourceLineNo">625</span>        this.shortCompactions.setCorePoolSize(smallThreads);<a name="line.625"></a>
-<span class="sourceLineNo">626</span>      } else {<a name="line.626"></a>
-<span class="sourceLineNo">627</span>        this.shortCompactions.setCorePoolSize(smallThreads);<a name="line.627"></a>
-<span class="sourceLineNo">628</span>        this.shortCompactions.setMaximumPoolSize(smallThreads);<a name="line.628"></a>
-<span class="sourceLineNo">629</span>      }<a name="line.629"></a>
-<span class="sourceLineNo">630</span>    }<a name="line.630"></a>
-<span class="sourceLineNo">631</span><a name="line.631"></a>
-<span class="sourceLineNo">632</span>    int splitThreads = newConf.getInt(SPLIT_THREADS,<a name="line.632"></a>
-<span class="sourceLineNo">633</span>            SPLIT_THREADS_DEFAULT);<a name="line.633"></a>
-<span class="sourceLineNo">634</span>    if (this.splits.getCorePoolSize() != splitThreads) {<a name="line.634"></a>
-<span class="sourceLineNo">635</span>      LOG.info("Changing the value of " + SPLIT_THREADS +<a name="line.635"></a>
-<span class="sourceLineNo">636</span>                " from " + this.splits.getCorePoolSize() + " to " +<a name="line.636"></a>
-<span class="sourceLineNo">637</span>                splitThreads);<a name="line.637"></a>
-<span class="sourceLineNo">638</span>      if(this.splits.getCorePoolSize() &lt; splitThreads) {<a name="line.638"></a>
-<span class="sourceLineNo">639</span>        this.splits.setMaximumPoolSize(splitThreads);<a name="line.639"></a>
-<span class="sourceLineNo">640</span>        this.splits.setCorePoolSize(splitThreads);<a name="line.640"></a>
-<span class="sourceLineNo">641</span>      } else {<a name="line.641"></a>
-<span class="sourceLineNo">642</span>        this.splits.setCorePoolSize(splitThreads);<a name="line.642"></a>
-<span class="sourceLineNo">643</span>        this.splits.setMaximumPoolSize(splitThreads);<a name="line.643"></a>
-<span class="sourceLineNo">644</span>      }<a name="line.644"></a>
-<span class="sourceLineNo">645</span>    }<a name="line.645"></a>
-<span class="sourceLineNo">646</span><a name="line.646"></a>
-<span class="sourceLineNo">647</span>    ThroughputController old = this.compactionThroughputController;<a name="line.647"></a>
-<span class="sourceLineNo">648</span>    if (old != null) {<a name="line.648"></a>
-<span class="sourceLineNo">649</span>      old.stop("configuration change");<a name="line.649"></a>
-<span class="sourceLineNo">650</span>    }<a name="line.650"></a>
-<span class="sourceLineNo">651</span>    this.compactionThroughputController =<a name="line.651"></a>
-<span class="sourceLineNo">652</span>        CompactionThroughputControllerFactory.create(server, newConf);<a name="line.652"></a>
+<span class="sourceLineNo">417</span><a name="line.417"></a>
+<span class="sourceLineNo">418</span>  public int getSmallCompactionQueueSize() {<a name="line.418"></a>
+<span class="sourceLineNo">419</span>    return shortCompactions.getQueue().size();<a name="line.419"></a>
+<span class="sourceLineNo">420</span>  }<a name="line.420"></a>
+<span class="sourceLineNo">421</span><a name="line.421"></a>
+<span class="sourceLineNo">422</span>  public int getSplitQueueSize() {<a name="line.422"></a>
+<span class="sourceLineNo">423</span>    return splits.getQueue().size();<a name="line.423"></a>
+<span class="sourceLineNo">424</span>  }<a name="line.424"></a>
+<span class="sourceLineNo">425</span><a name="line.425"></a>
+<span class="sourceLineNo">426</span>  private boolean shouldSplitRegion() {<a name="line.426"></a>
+<span class="sourceLineNo">427</span>    if(server.getNumberOfOnlineRegions() &gt; 0.9*regionSplitLimit) {<a name="line.427"></a>
+<span class="sourceLineNo">428</span>      LOG.warn("Total number of regions is approaching the upper limit " + regionSplitLimit + ". "<a name="line.428"></a>
+<span class="sourceLineNo">429</span>          + "Please consider taking a look at http://hbase.apache.org/book.html#ops.regionmgt");<a name="line.429"></a>
+<span class="sourceLineNo">430</span>    }<a name="line.430"></a>
+<span class="sourceLineNo">431</span>    return (regionSplitLimit &gt; server.getNumberOfOnlineRegions());<a name="line.431"></a>
+<span class="sourceLineNo">432</span>  }<a name="line.432"></a>
+<span class="sourceLineNo">433</span><a name="line.433"></a>
+<span class="sourceLineNo">434</span>  /**<a name="line.434"></a>
+<span class="sourceLineNo">435</span>   * @return the regionSplitLimit<a name="line.435"></a>
+<span class="sourceLineNo">436</span>   */<a name="line.436"></a>
+<span class="sourceLineNo">437</span>  public int getRegionSplitLimit() {<a name="line.437"></a>
+<span class="sourceLineNo">438</span>    return this.regionSplitLimit;<a name="line.438"></a>
+<span class="sourceLineNo">439</span>  }<a name="line.439"></a>
+<span class="sourceLineNo">440</span><a name="line.440"></a>
+<span class="sourceLineNo">441</span>  @edu.umd.cs.findbugs.annotations.SuppressWarnings(value="EQ_COMPARETO_USE_OBJECT_EQUALS",<a name="line.441"></a>
+<span class="sourceLineNo">442</span>      justification="Contrived use of compareTo")<a name="line.442"></a>
+<span class="sourceLineNo">443</span>  private class CompactionRunner implements Runnable, Comparable&lt;CompactionRunner&gt; {<a name="line.443"></a>
+<span class="sourceLineNo">444</span>    private final Store store;<a name="line.444"></a>
+<span class="sourceLineNo">445</span>    private final HRegion region;<a name="line.445"></a>
+<span class="sourceLineNo">446</span>    private CompactionContext compaction;<a name="line.446"></a>
+<span class="sourceLineNo">447</span>    private int queuedPriority;<a name="line.447"></a>
+<span class="sourceLineNo">448</span>    private ThreadPoolExecutor parent;<a name="line.448"></a>
+<span class="sourceLineNo">449</span>    private User user;<a name="line.449"></a>
+<span class="sourceLineNo">450</span>    private long time;<a name="line.450"></a>
+<span class="sourceLineNo">451</span><a name="line.451"></a>
+<span class="sourceLineNo">452</span>    public CompactionRunner(Store store, Region region,<a name="line.452"></a>
+<span class="sourceLineNo">453</span>        CompactionContext compaction, ThreadPoolExecutor parent, User user) {<a name="line.453"></a>
+<span class="sourceLineNo">454</span>      super();<a name="line.454"></a>
+<span class="sourceLineNo">455</span>      this.store = store;<a name="line.455"></a>
+<span class="sourceLineNo">456</span>      this.region = (HRegion)region;<a name="line.456"></a>
+<span class="sourceLineNo">457</span>      this.compaction = compaction;<a name="line.457"></a>
+<span class="sourceLineNo">458</span>      this.queuedPriority = (this.compaction == null)<a name="line.458"></a>
+<span class="sourceLineNo">459</span>          ? store.getCompactPriority() : compaction.getRequest().getPriority();<a name="line.459"></a>
+<span class="sourceLineNo">460</span>      this.parent = parent;<a name="line.460"></a>
+<span class="sourceLineNo">461</span>      this.user = user;<a name="line.461"></a>
+<span class="sourceLineNo">462</span>      this.time =  System.currentTimeMillis();<a name="line.462"></a>
+<span class="sourceLineNo">463</span>    }<a name="line.463"></a>
+<span class="sourceLineNo">464</span><a name="line.464"></a>
+<span class="sourceLineNo">465</span>    @Override<a name="line.465"></a>
+<span class="sourceLineNo">466</span>    public String toString() {<a name="line.466"></a>
+<span class="sourceLineNo">467</span>      return (this.compaction != null) ? ("Request = " + compaction.getRequest())<a name="line.467"></a>
+<span class="sourceLineNo">468</span>          : ("regionName = " + region.toString() + ", storeName = " + store.toString() +<a name="line.468"></a>
+<span class="sourceLineNo">469</span>             ", priority = " + queuedPriority + ", time = " + time);<a name="line.469"></a>
+<span class="sourceLineNo">470</span>    }<a name="line.470"></a>
+<span class="sourceLineNo">471</span><a name="line.471"></a>
+<span class="sourceLineNo">472</span>    private void doCompaction(User user) {<a name="line.472"></a>
+<span class="sourceLineNo">473</span>      // Common case - system compaction without a file selection. Select now.<a name="line.473"></a>
+<span class="sourceLineNo">474</span>      if (this.compaction == null) {<a name="line.474"></a>
+<span class="sourceLineNo">475</span>        int oldPriority = this.queuedPriority;<a name="line.475"></a>
+<span class="sourceLineNo">476</span>        this.queuedPriority = this.store.getCompactPriority();<a name="line.476"></a>
+<span class="sourceLineNo">477</span>        if (this.queuedPriority &gt; oldPriority) {<a name="line.477"></a>
+<span class="sourceLineNo">478</span>          // Store priority decreased while we were in queue (due to some other compaction?),<a name="line.478"></a>
+<span class="sourceLineNo">479</span>          // requeue with new priority to avoid blocking potential higher priorities.<a name="line.479"></a>
+<span class="sourceLineNo">480</span>          this.parent.execute(this);<a name="line.480"></a>
+<span class="sourceLineNo">481</span>          return;<a name="line.481"></a>
+<span class="sourceLineNo">482</span>        }<a name="line.482"></a>
+<span class="sourceLineNo">483</span>        try {<a name="line.483"></a>
+<span class="sourceLineNo">484</span>          this.compaction = selectCompaction(this.region, this.store, queuedPriority, null, user);<a name="line.484"></a>
+<span class="sourceLineNo">485</span>        } catch (IOException ex) {<a name="line.485"></a>
+<span class="sourceLineNo">486</span>          LOG.error("Compaction selection failed " + this, ex);<a name="line.486"></a>
+<span class="sourceLineNo">487</span>          server.checkFileSystem();<a name="line.487"></a>
+<span class="sourceLineNo">488</span>          region.decrementCompactionsQueuedCount();<a name="line.488"></a>
+<span class="sourceLineNo">489</span>          return;<a name="line.489"></a>
+<span class="sourceLineNo">490</span>        }<a name="line.490"></a>
+<span class="sourceLineNo">491</span>        if (this.compaction == null) {<a name="line.491"></a>
+<span class="sourceLineNo">492</span>          region.decrementCompactionsQueuedCount();<a name="line.492"></a>
+<span class="sourceLineNo">493</span>          return; // nothing to do<a name="line.493"></a>
+<span class="sourceLineNo">494</span>        }<a name="line.494"></a>
+<span class="sourceLineNo">495</span>        // Now see if we are in correct pool for the size; if not, go to the correct one.<a name="line.495"></a>
+<span class="sourceLineNo">496</span>        // We might end up waiting for a while, so cancel the selection.<a name="line.496"></a>
+<span class="sourceLineNo">497</span>        assert this.compaction.hasSelection();<a name="line.497"></a>
+<span class="sourceLineNo">498</span>        ThreadPoolExecutor pool = store.throttleCompaction(<a name="line.498"></a>
+<span class="sourceLineNo">499</span>            compaction.getRequest().getSize()) ? longCompactions : shortCompactions;<a name="line.499"></a>
+<span class="sourceLineNo">500</span><a name="line.500"></a>
+<span class="sourceLineNo">501</span>        // Long compaction pool can process small job<a name="line.501"></a>
+<span class="sourceLineNo">502</span>        // Short compaction pool should not process large job<a name="line.502"></a>
+<span class="sourceLineNo">503</span>        if (this.parent == shortCompactions &amp;&amp; pool == longCompactions) {<a name="line.503"></a>
+<span class="sourceLineNo">504</span>          this.store.cancelRequestedCompaction(this.compaction);<a name="line.504"></a>
+<span class="sourceLineNo">505</span>          this.compaction = null;<a name="line.505"></a>
+<span class="sourceLineNo">506</span>          this.parent = pool;<a name="line.506"></a>
+<span class="sourceLineNo">507</span>          this.parent.execute(this);<a name="line.507"></a>
+<span class="sourceLineNo">508</span>          return;<a name="line.508"></a>
+<span class="sourceLineNo">509</span>        }<a name="line.509"></a>
+<span class="sourceLineNo">510</span>      }<a name="line.510"></a>
+<span class="sourceLineNo">511</span>      // Finally we can compact something.<a name="line.511"></a>
+<span class="sourceLineNo">512</span>      assert this.compaction != null;<a name="line.512"></a>
+<span class="sourceLineNo">513</span><a name="line.513"></a>
+<span class="sourceLineNo">514</span>      this.compaction.getRequest().beforeExecute();<a name="line.514"></a>
+<span class="sourceLineNo">515</span>      try {<a name="line.515"></a>
+<span class="sourceLineNo">516</span>        // Note: please don't put single-compaction logic here;<a name="line.516"></a>
+<span class="sourceLineNo">517</span>        //       put it into region/store/etc. This is CST logic.<a name="line.517"></a>
+<span class="sourceLineNo">518</span>        long start = EnvironmentEdgeManager.currentTime();<a name="line.518"></a>
+<span class="sourceLineNo">519</span>        boolean completed =<a name="line.519"></a>
+<span class="sourceLineNo">520</span>            region.compact(compaction, store, compactionThroughputController, user);<a name="line.520"></a>
+<span class="sourceLineNo">521</span>        long now = EnvironmentEdgeManager.currentTime();<a name="line.521"></a>
+<span class="sourceLineNo">522</span>        LOG.info(((completed) ? "Completed" : "Aborted") + " compaction: " +<a name="line.522"></a>
+<span class="sourceLineNo">523</span>              this + "; duration=" + StringUtils.formatTimeDiff(now, start));<a name="line.523"></a>
+<span class="sourceLineNo">524</span>        if (completed) {<a name="line.524"></a>
+<span class="sourceLineNo">525</span>          // degenerate case: blocked regions require recursive enqueues<a name="line.525"></a>
+<span class="sourceLineNo">526</span>          if (store.getCompactPriority() &lt;= 0) {<a name="line.526"></a>
+<span class="sourceLineNo">527</span>            requestSystemCompaction(region, store, "Recursive enqueue");<a name="line.527"></a>
+<span class="sourceLineNo">528</span>          } else {<a name="line.528"></a>
+<span class="sourceLineNo">529</span>            // see if the compaction has caused us to exceed max region size<a name="line.529"></a>
+<span class="sourceLineNo">530</span>            requestSplit(region);<a name="line.530"></a>
+<span class="sourceLineNo">531</span>          }<a name="line.531"></a>
+<span class="sourceLineNo">532</span>        }<a name="line.532"></a>
+<span class="sourceLineNo">533</span>      } catch (IOException ex) {<a name="line.533"></a>
+<span class="sourceLineNo">534</span>        IOException remoteEx =<a name="line.534"></a>
+<span class="sourceLineNo">535</span>            ex instanceof RemoteException ? ((RemoteException) ex).unwrapRemoteException() : ex;<a name="line.535"></a>
+<span class="sourceLineNo">536</span>        LOG.error("Compaction failed " + this, remoteEx);<a name="line.536"></a>
+<span class="sourceLineNo">537</span>        if (remoteEx != ex) {<a name="line.537"></a>
+<span class="sourceLineNo">538</span>          LOG.info("Compaction failed at original callstack: " + formatStackTrace(ex));<a name="line.538"></a>
+<span class="sourceLineNo">539</span>        }<a name="line.539"></a>
+<span class="sourceLineNo">540</span>        region.reportCompactionRequestFailure();<a name="line.540"></a>
+<span class="sourceLineNo">541</span>        server.checkFileSystem();<a name="line.541"></a>
+<span class="sourceLineNo">542</span>      } catch (Exception ex) {<a name="line.542"></a>
+<span class="sourceLineNo">543</span>        LOG.error("Compaction failed " + this, ex);<a name="line.543"></a>
+<span class="sourceLineNo">544</span>        region.reportCompactionRequestFailure();<a name="line.544"></a>
+<span class="sourceLineNo">545</span>        server.checkFileSystem();<a name="line.545"></a>
+<span class="sourceLineNo">546</span>      } finally {<a name="line.546"></a>
+<span class="sourceLineNo">547</span>        region.decrementCompactionsQueuedCount();<a name="line.547"></a>
+<span class="sourceLineNo">548</span>        LOG.debug("CompactSplitThread Status: " + CompactSplit.this);<a name="line.548"></a>
+<span class="sourceLineNo">549</span>      }<a name="line.549"></a>
+<span class="sourceLineNo">550</span>      this.compaction.getRequest().afterExecute();<a name="line.550"></a>
+<span class="sourceLineNo">551</span>    }<a name="line.551"></a>
+<span class="sourceLineNo">552</span><a name="line.552"></a>
+<span class="sourceLineNo">553</span>    @Override<a name="line.553"></a>
+<span class="sourceLineNo">554</span>    public void run() {<a name="line.554"></a>
+<span class="sourceLineNo">555</span>      Preconditions.checkNotNull(server);<a name="line.555"></a>
+<span class="sourceLineNo">556</span>      if (server.isStopped()<a name="line.556"></a>
+<span class="sourceLineNo">557</span>          || (region.getTableDescriptor() != null &amp;&amp; !region.getTableDescriptor().isCompactionEnabled())) {<a name="line.557"></a>
+<span class="sourceLineNo">558</span>        region.decrementCompactionsQueuedCount();<a name="line.558"></a>
+<span class="sourceLineNo">559</span>        return;<a name="line.559"></a>
+<span class="sourceLineNo">560</span>      }<a name="line.560"></a>
+<span class="sourceLineNo">561</span>      doCompaction(user);<a name="line.561"></a>
+<span class="sourceLineNo">562</span>    }<a name="line.562"></a>
+<span class="sourceLineNo">563</span><a name="line.563"></a>
+<span class="sourceLineNo">564</span>    private String formatStackTrace(Exception ex) {<a name="line.564"></a>
+<span class="sourceLineNo">565</span>      StringWriter sw = new StringWriter();<a name="line.565"></a>
+<span class="sourceLineNo">566</span>      PrintWriter pw = new PrintWriter(sw);<a name="line.566"></a>
+<span class="sourceLineNo">567</span>      ex.printStackTrace(pw);<a name="line.567"></a>
+<span class="sourceLineNo">568</span>      pw.flush();<a name="line.568"></a>
+<span class="sourceLineNo">569</span>      return sw.toString();<a name="line.569"></a>
+<span class="sourceLineNo">570</span>    }<a name="line.570"></a>
+<span class="sourceLineNo">571</span><a name="line.571"></a>
+<span class="sourceLineNo">572</span>    @Override<a name="line.572"></a>
+<span class="sourceLineNo">573</span>    public int compareTo(CompactionRunner o) {<a name="line.573"></a>
+<span class="sourceLineNo">574</span>      // Only compare the underlying request (if any), for queue sorting purposes.<a name="line.574"></a>
+<span class="sourceLineNo">575</span>      int compareVal = queuedPriority - o.queuedPriority; // compare priority<a name="line.575"></a>
+<span class="sourceLineNo">576</span>      if (compareVal != 0) return compareVal;<a name="line.576"></a>
+<span class="sourceLineNo">577</span>      CompactionContext tc = this.compaction, oc = o.compaction;<a name="line.577"></a>
+<span class="sourceLineNo">578</span>      // Sort pre-selected (user?) compactions before system ones with equal priority.<a name="line.578"></a>
+<span class="sourceLineNo">579</span>      return (tc == null) ? ((oc == null) ? 0 : 1)<a name="line.579"></a>
+<span class="sourceLineNo">580</span>          : ((oc == null) ? -1 : tc.getRequest().compareTo(oc.getRequest()));<a name="line.580"></a>
+<span class="sourceLineNo">581</span>    }<a name="line.581"></a>
+<span class="sourceLineNo">582</span>  }<a name="line.582"></a>
+<span class="sourceLineNo">583</span><a name="line.583"></a>
+<span class="sourceLineNo">584</span>  /**<a name="line.584"></a>
+<span class="sourceLineNo">585</span>   * Cleanup class to use when rejecting a compaction request from the queue.<a name="line.585"></a>
+<span class="sourceLineNo">586</span>   */<a name="line.586"></a>
+<span class="sourceLineNo">587</span>  private static class Rejection implements RejectedExecutionHandler {<a name="line.587"></a>
+<span class="sourceLineNo">588</span>    @Override<a name="line.588"></a>
+<span class="sourceLineNo">589</span>    public void rejectedExecution(Runnable runnable, ThreadPoolExecutor pool) {<a name="line.589"></a>
+<span class="sourceLineNo">590</span>      if (runnable instanceof CompactionRunner) {<a name="line.590"></a>
+<span class="sourceLineNo">591</span>        CompactionRunner runner = (CompactionRunner)runnable;<a name="line.591"></a>
+<span class="sourceLineNo">592</span>        LOG.debug("Compaction Rejected: " + runner);<a name="line.592"></a>
+<span class="sourceLineNo">593</span>        runner.store.cancelRequestedCompaction(runner.compaction);<a name="line.593"></a>
+<span class="sourceLineNo">594</span>      }<a name="line.594"></a>
+<span class="sourceLineNo">595</span>    }<a name="line.595"></a>
+<span class="sourceLineNo">596</span>  }<a name="line.596"></a>
+<span class="sourceLineNo">597</span><a name="line.597"></a>
+<span class="sourceLineNo">598</span>  /**<a name="line.598"></a>
+<span class="sourceLineNo">599</span>   * {@inheritDoc}<a name="line.599"></a>
+<span class="sourceLineNo">600</span>   */<a name="line.600"></a>
+<span class="sourceLineNo">601</span>  @Override<a name="line.601"></a>
+<span class="sourceLineNo">602</span>  public void onConfigurationChange(Configuration newConf) {<a name="line.602"></a>
+<span class="sourceLineNo">603</span>    // Check if number of large / small compaction threads has changed, and then<a name="line.603"></a>
+<span class="sourceLineNo">604</span>    // adjust the core pool size of the thread pools, by using the<a name="line.604"></a>
+<span class="sourceLineNo">605</span>    // setCorePoolSize() method. According to the javadocs, it is safe to<a name="line.605"></a>
+<span class="sourceLineNo">606</span>    // change the core pool size on-the-fly. We need to reset the maximum<a name="line.606"></a>
+<span class="sourceLineNo">607</span>    // pool size, as well.<a name="line.607"></a>
+<span class="sourceLineNo">608</span>    int largeThreads = Math.max(1, newConf.getInt(<a name="line.608"></a>
+<span class="sourceLineNo">609</span>            LARGE_COMPACTION_THREADS,<a name="line.609"></a>
+<span class="sourceLineNo">610</span>            LARGE_COMPACTION_THREADS_DEFAULT));<a name="line.610"></a>
+<span class="sourceLineNo">611</span>    if (this.longCompactions.getCorePoolSize() != largeThreads) {<a name="line.611"></a>
+<span class="sourceLineNo">612</span>      LOG.info("Changing the value of " + LARGE_COMPACTION_THREADS +<a name="line.612"></a>
+<span class="sourceLineNo">613</span>              " from " + this.longCompactions.getCorePoolSize() + " to " +<a name="line.613"></a>
+<span class="sourceLineNo">614</span>              largeThreads);<a name="line.614"></a>
+<span class="sourceLineNo">615</span>      if(this.longCompactions.getCorePoolSize() &lt; largeThreads) {<a name="line.615"></a>
+<span class="sourceLineNo">616</span>        this.longCompactions.setMaximumPoolSize(largeThreads);<a name="line.616"></a>
+<span class="sourceLineNo">617</span>        this.longCompactions.setCorePoolSize(largeThreads);<a name="line.617"></a>
+<span class="sourceLineNo">618</span>      } else {<a name="line.618"></a>
+<span class="sourceLineNo">619</span>        this.longCompactions.setCorePoolSize(largeThreads);<a name="line.619"></a>
+<span class="sourceLineNo">620</span>        this.longCompactions.setMaximumPoolSize(largeThreads);<a name="line.620"></a>
+<span class="sourceLineNo">621</span>      }<a name="line.621"></a>
+<span class="sourceLineNo">622</span>    }<a name="line.622"></a>
+<span class="sourceLineNo">623</span><a name="line.623"></a>
+<span class="sourceLineNo">624</span>    int smallThreads = newConf.getInt(SMALL_COMPACTION_THREADS,<a name="line.624"></a>
+<span class="sourceLineNo">625</span>            SMALL_COMPACTION_THREADS_DEFAULT);<a name="line.625"></a>
+<span class="sourceLineNo">626</span>    if (this.shortCompactions.getCorePoolSize() != smallThreads) {<a name="line.626"></a>
+<span class="sourceLineNo">627</span>      LOG.info("Changing the value of " + SMALL_COMPACTION_THREADS +<a name="line.627"></a>
+<span class="sourceLineNo">628</span>                " from " + this.shortCompactions.getCorePoolSize() + " to " +<a name="line.628"></a>
+<span class="sourceLineNo">629</span>                smallThreads);<a name="line.629"></a>
+<span class="sourceLineNo">630</span>      if(this.shortCompactions.getCorePoolSize() &lt; smallThreads) {<a name="line.630"></a>
+<span class="sourceLineNo">631</span>        this.shortCompactions.setMaximumPoolSize(smallThreads);<a name="line.631"></a>
+<span class="sourceLineNo">632</span>        this.shortCompactions.setCorePoolSize(smallThreads);<a name="line.632"></a>
+<span class="sourceLineNo">633</span>      } else {<a name="line.633"></a>
+<span class="sourceLineNo">634</span>        this.shortCompactions.setCorePoolSize(smallThreads);<a name="line.634"></a>
+<span class="sourceLineNo">635</span>        this.shortCompactions.setMaximumPoolSize(smallThreads);<a name="line.635"></a>
+<span class="sourceLineNo">636</span>      }<a name="line.636"></a>
+<span class="sourceLineNo">637</span>    }<a name="line.637"></a>
+<span class="sourceLineNo">638</span><a name="line.638"></a>
+<span class="sourceLineNo">639</span>    int splitThreads = newConf.getInt(SPLIT_THREADS,<a name="line.639"></a>
+<span class="sourceLineNo">640</span>            SPLIT_THREADS_DEFAULT);<a name="line.640"></a>
+<span class="sourceLineNo">641</span>    if (this.splits.getCorePoolSize() != splitThreads) {<a name="line.641"></a>
+<span class="sourceLineNo">642</span>      LOG.info("Changing the value of " + SPLIT_THREADS +<a name="line.642"></a>
+<span class="sourceLineNo">643</span>                " from " + this.splits.getCorePoolSize() + " to " +<a name="line.643"></a>
+<span class="sourceLineNo">644</span>                splitThreads);<a name="line.644"></a>
+<span class="sourceLineNo">645</span>      if(this.splits.getCorePoolSize() &lt; splitThreads) {<a name="line.645"></a>
+<span class="sourceLineNo">646</span>        this.splits.setMaximumPoolSize(splitThreads);<a name="line.646"></a>
+<span class="sourceLineNo">647</span>        this.splits.setCorePoolSize(splitThreads);<a name="line.647"></a>
+<span class="sourceLineNo">648</span>      } else {<a name="line.648"></a>
+<span class="sourceLineNo">649</span>        this.splits.setCorePoolSize(splitThreads);<a name="line.649"></a>
+<span class="sourceLineNo">650</span>        this.splits.setMaximumPoolSize(splitThreads);<a name="line.650"></a>
+<span class="sourceLineNo">651</span>      }<a name="line.651"></a>
+<span class="sourceLineNo">652</span>    }<a name="line.652"></a>
 <span class="sourceLineNo">653</span><a name="line.653"></a>
-<span class="sourceLineNo">654</span>    // We change this atomically here instead of reloading the config in order that upstream<a name="line.654"></a>
-<span class="sourceLineNo">655</span>    // would be the only one with the flexibility to reload the config.<a name="line.655"></a>
-<span class="sourceLineNo">656</span>    this.conf.reloadConfiguration();<a name="line.656"></a>
-<span class="sourceLineNo">657</span>  }<a name="line.657"></a>
-<span class="sourceLineNo">658</span><a name="line.658"></a>
-<span class="sourceLineNo">659</span>  protected int getSmallCompactionThreadNum() {<a name="line.659"></a>
-<span class="sourceLineNo">660</span>    return this.shortCompactions.getCorePoolSize();<a name="line.660"></a>
-<span class="sourceLineNo">661</span>  }<a name="line.661"></a>
-<span class="sourceLineNo">662</span><a name="line.662"></a>
-<span class="sourceLineNo">663</span>  protected int getLargeCompactionThreadNum() {<a name="line.663"></a>
-<span class="sourceLineNo">664</span>    return this.longCompactions.getCorePoolSize();<a name="line.664"></a>
-<span class="sourceLineNo">665</span>  }<a name="line.665"></a>
-<span class="sourceLineNo">666</span><a name="line.666"></a>
-<span class="sourceLineNo">667</span>  protected int getSplitThreadNum() {<a name="line.667"></a>
-<span class="sourceLineNo">668</span>    return this.splits.getCorePoolSize();<a name="line.668"></a>
-<span class="sourceLineNo">669</span>  }<a name="line.669"></a>
-<span class="sourceLineNo">670</span><a name="line.670"></a>
-<span class="sourceLineNo">671</span>  /**<a name="line.671"></a>
-<span class="sourceLineNo">672</span>   * {@inheritDoc}<a name="line.672"></a>
-<span class="sourceLineNo">673</span>   */<a name="line.673"></a>
-<span class="sourceLineNo">674</span>  @Override<a name="line.674"></a>
-<span class="sourceLineNo">675</span>  public void registerChildren(ConfigurationManager manager) {<a name="line.675"></a>
-<span class="sourceLineNo">676</span>    // No children to register.<a name="line.676"></a>
-<span class="sourceLineNo">677</span>  }<a name="line.677"></a>
-<span class="sourceLineNo">678</span><a name="line.678"></a>
-<span class="sourceLineNo">679</span>  /**<a name="line.679"></a>
-<span class="sourceLineNo">680</span>   * {@inheritDoc}<a name="line.680"></a>
-<span class="sourceLineNo">681</span>   */<a name="line.681"></a>
-<span class="sourceLineNo">682</span>  @Override<a name="line.682"></a>
-<span class="sourceLineNo">683</span>  public void deregisterChildren(ConfigurationManager manager) {<a name="line.683"></a>
-<span class="sourceLineNo">684</span>    // No children to register<a name="line.684"></a>
-<span class="sourceLineNo">685</span>  }<a name="line.685"></a>
-<span class="sourceLineNo">686</span><a name="line.686"></a>
-<span class="sourceLineNo">687</span>  @VisibleForTesting<a name="line.687"></a>
-<span class="sourceLineNo">688</span>  public ThroughputController getCompactionThroughputController() {<a name="line.688"></a>
-<span class="sourceLineNo">689</span>    return compactionThroughputController;<a name="line.689"></a>
-<span class="sourceLineNo">690</span>  }<a name="line.690"></a>
-<span class="sourceLineNo">691</span><a name="line.691"></a>
-<span class="sourceLineNo">692</span>  @VisibleForTesting<a name="line.692"></a>
-<span class="sourceLineNo">693</span>  /**<a name="line.693"></a>
-<span class="sourceLineNo">694</span>   * Shutdown the long compaction thread pool.<a name="line.694"></a>
-<span class="sourceLineNo">695</span>   * Should only be used in unit test to prevent long compaction thread pool from stealing job<a name="line.695"></a>
-<span class="sourceLineNo">696</span>   * from short compaction queue<a name="line.696"></a>
-<span class="sourceLineNo">697</span>   */<a name="line.697"></a>
-<span class="sourceLineNo">698</span>  void shutdownLongCompactions(){<a name="line.698"></a>
-<span class="sourceLineNo">699</span>    this.longCompactions.shutdown();<a name="line.699"></a>
-<span class="sourceLineNo">700</span>  }<a name="line.700"></a>
-<span class="sourceLineNo">701</span><a name="line.701"></a>
-<span class="sourceLineNo">702</span>  public void clearLongCompactionsQueue() {<a name="line.702"></a>
-<span class="sourceLineNo">703</span>    longCompactions.getQueue().clear();<a name="line.703"></a>
-<span class="sourceLineNo">704</span>  }<a name="line.704"></a>
-<span class="sourceLineNo">705</span><a name="line.705"></a>
-<span class="sourceLineNo">706</span>  public void clearShortCompactionsQueue() {<a name="line.706"></a>
-<span class="sourceLineNo">707</span>    shortCompactions.getQueue().clear();<a name="line.707"></a>
-<span class="sourceLineNo">708</span>  }<a name="line.708"></a>
-<span class="sourceLineNo">709</span>}<a name="line.709"></a>
+<span class="sourceLineNo">654</span>    ThroughputController old = this.compactionThroughputController;<a name="line.654"></a>
+<span class="sourceLineNo">655</span>    if (old != null) {<a name="line.655"></a>
+<span class="sourceLineNo">656</span>      old.stop("configuration change");<a name="line.656"></a>
+<span class="sourceLineNo">657</span>    }<a name="line.657"></a>
+<span class="sourceLineNo">658</span>    this.compactionThroughputController =<a name="line.658"></a>
+<span class="sourceLineNo">659</span>        CompactionThroughputControllerFactory.create(server, newConf);<a name="line.659"></a>
+<span class="sourceLineNo">660</span><a name="line.660"></a>
+<span class="sourceLineNo">661</span>    // We change this atomically here instead of reloading the config in order that upstream<a name="line.661"></a>
+<span class="sourceLineNo">662</span>    // would be the only one with the flexibility to reload the config.<a name="line.662"></a>
+<span class="sourceLineNo">663</span>    this.conf.reloadConfiguration();<a name="line.663"></a>
+<span class="sourceLineNo">664</span>  }<a name="line.664"></a>
+<span class="sourceLineNo">665</span><a name="line.665"></a>
+<span class="sourceLineNo">666</span>  protected int getSmallCompactionThreadNum() {<a name="line.666"></a>
+<span class="sourceLineNo">667</span>    return this.shortCompactions.getCorePoolSize();<a name="line.667"></a>
+<span class="sourceLineNo">668</span>  }<a name="line.668"></a>
+<span class="sourceLineNo">669</span><a name="line.669"></a>
+<span class="sourceLineNo">670</span>  protected int getLargeCompactionThreadNum() {<a name="line.670"></a>
+<span class="sourceLineNo">671</span>    return this.longCompactions.getCorePoolSize();<a name="line.671"></a>
+<span class="sourceLineNo">672</span>  }<a name="line.672"></a>
+<span class="sourceLineNo">673</span><a name="line.673"></a>
+<span class="sourceLineNo">674</span>  protected int getSplitThreadNum() {<a name="line.674"></a>
+<span class="sourceLineNo">675</span>    return this.splits.getCorePoolSize();<a name="line.675"></a>
+<span class="sourceLineNo">676</span>  }<a name="line.676"></a>
+<span class="sourceLineNo">677</span><a name="line.677"></a>
+<span class="sourceLineNo">678</span>  /**<a name="line.678"></a>
+<span class="sourceLineNo">679</span>   * {@inheritDoc}<a name="line.679"></a>
+<span class="sourceLineNo">680</span>   */<a name="line.680"></a>
+<span class="sourceLineNo">681</span>  @Override<a name="line.681"></a>
+<span class="sourceLineNo">682</span>  public void registerChildren(ConfigurationManager manager) {<a name="line.682"></a>
+<span class="sourceLineNo">683</span>    // No children to register.<a name="line.683"></a>
+<span class="sourceLineNo">684</span>  }<a name="line.684"></a>
+<span class="sourceLineNo">685</span><a name="line.685"></a>
+<span class="sourceLineNo">686</span>  /**<a name="line.686"></a>
+<span class="sourceLineNo">687</span>   * {@inheritDoc}<a name="line.687"></a>
+<span class="sourceLineNo">688</span>   */<a name="line.688"></a>
+<span class="sourceLineNo">689</span>  @Override<a name="line.689"></a>
+<span class="sourceLineNo">690</span>  public void deregisterChildren(ConfigurationManager manager) {<a name="line.690"></a>
+<span class="sourceLineNo">691</span>    // No children to register<a name="line.691"></a>
+<span class="sourceLineNo">692</span>  }<a name="line.692"></a>
+<span class="sourceLineNo">693</span><a name="line.693"></a>
+<span class="sourceLineNo">694</span>  @VisibleForTesting<a name="line.694"></a>
+<span class="sourceLineNo">695</span>  public ThroughputController getCompactionThroughputController() {<a name="line.695"></a>
+<span class="sourceLineNo">696</span>    return compactionThroughputController;<a name="line.696"></a>
+<span class="sourceLineNo">697</span>  }<a name="line.697"></a>
+<span class="sourceLineNo">698</span><a name="line.698"></a>
+<span class="sourceLineNo">699</span>  @VisibleForTesting<a name="line.699"></a>
+<span class="sourceLineNo">700</span>  /**<a name="line.700"></a>
+<span class="sourceLineNo">701</span>   * Shutdown the long compaction thread pool.<a name="line.701"></a>
+<span class="sourceLineNo">702</span>   * Should only be used in unit test to prevent long compaction thread pool from stealing job<a name="line.702"></a>
+<span class="sourceLineNo">703</span>   * from short compaction queue<a name="line.703"></a>
+<span class="sourceLineNo">704</span>   */<a name="line.704"></a>
+<span class="sourceLineNo">705</span>  void shutdownLongCompactions(){<a name="line.705"></a>
+<span class="sourceLineNo">706</span>    this.longCompactions.shutdown();<a name="line.706"></a>
+<span class="sourceLineNo">707</span>  }<a name="line.707"></a>
+<span class="sourceLineNo">708</span><a name="line.708"></a>
+<span class="sourceLineNo">709</span>  public void clearLongCompactionsQueue() {<a name="line.709"></a>
+<span class="sourceLineNo">710</span>    longCompactions.getQueue().clear();<a name="line.710"></a>
+<span class="sourceLineNo">711</span>  }<a name="line.711"></a>
+<span class="sourceLineNo">712</span><a name="line.712"></a>
+<span class="sourceLineNo">713</span>  public void clearShortCompactionsQueue() {<a name="line.713"></a>
+<span class="sourceLineNo">714</span>    shortCompactions.getQueue().clear();<a name="line.714"></a>
+<span class="sourceLineNo">715</span>  }<a name="line.715"></a>
+<span class="sourceLineNo">716</span>}<a name="line.716"></a>
 
 
 


Mime
View raw message