hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mi...@apache.org
Subject [03/52] [partial] hbase-site git commit: Published site at 950d547dae684155020edb879a343bee1bf18e97.
Date Mon, 29 Aug 2016 15:32:53 GMT
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/45a663dd/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/HRegionServer.CompactionChecker.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/HRegionServer.CompactionChecker.html b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/HRegionServer.CompactionChecker.html
index 4d08f6f..34bc830 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/HRegionServer.CompactionChecker.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/HRegionServer.CompactionChecker.html
@@ -1471,2010 +1471,2015 @@
 <span class="sourceLineNo">1463</span>        this, this.regionServerAccounting);<a name="line.1463"></a>
 <span class="sourceLineNo">1464</span>    if (this.hMemManager != null) {<a name="line.1464"></a>
 <span class="sourceLineNo">1465</span>      this.hMemManager.start(getChoreService());<a name="line.1465"></a>
-<span class="sourceLineNo">1466</span>    }<a name="line.1466"></a>
-<span class="sourceLineNo">1467</span>  }<a name="line.1467"></a>
-<span class="sourceLineNo">1468</span><a name="line.1468"></a>
-<span class="sourceLineNo">1469</span>  private void createMyEphemeralNode() throws KeeperException, IOException {<a name="line.1469"></a>
-<span class="sourceLineNo">1470</span>    RegionServerInfo.Builder rsInfo = RegionServerInfo.newBuilder();<a name="line.1470"></a>
-<span class="sourceLineNo">1471</span>    rsInfo.setInfoPort(infoServer != null ? infoServer.getPort() : -1);<a name="line.1471"></a>
-<span class="sourceLineNo">1472</span>    rsInfo.setVersionInfo(ProtobufUtil.getVersionInfo());<a name="line.1472"></a>
-<span class="sourceLineNo">1473</span>    byte[] data = ProtobufUtil.prependPBMagic(rsInfo.build().toByteArray());<a name="line.1473"></a>
-<span class="sourceLineNo">1474</span>    ZKUtil.createEphemeralNodeAndWatch(this.zooKeeper,<a name="line.1474"></a>
-<span class="sourceLineNo">1475</span>      getMyEphemeralNodePath(), data);<a name="line.1475"></a>
-<span class="sourceLineNo">1476</span>  }<a name="line.1476"></a>
-<span class="sourceLineNo">1477</span><a name="line.1477"></a>
-<span class="sourceLineNo">1478</span>  private void deleteMyEphemeralNode() throws KeeperException {<a name="line.1478"></a>
-<span class="sourceLineNo">1479</span>    ZKUtil.deleteNode(this.zooKeeper, getMyEphemeralNodePath());<a name="line.1479"></a>
-<span class="sourceLineNo">1480</span>  }<a name="line.1480"></a>
-<span class="sourceLineNo">1481</span><a name="line.1481"></a>
-<span class="sourceLineNo">1482</span>  @Override<a name="line.1482"></a>
-<span class="sourceLineNo">1483</span>  public RegionServerAccounting getRegionServerAccounting() {<a name="line.1483"></a>
-<span class="sourceLineNo">1484</span>    return regionServerAccounting;<a name="line.1484"></a>
+<span class="sourceLineNo">1466</span>      MemStoreChunkPool chunkPool = MemStoreChunkPool.getPool(this.conf);<a name="line.1466"></a>
+<span class="sourceLineNo">1467</span>      if (chunkPool != null) {<a name="line.1467"></a>
+<span class="sourceLineNo">1468</span>        // Register it as HeapMemoryTuneObserver<a name="line.1468"></a>
+<span class="sourceLineNo">1469</span>        this.hMemManager.registerTuneObserver(chunkPool);<a name="line.1469"></a>
+<span class="sourceLineNo">1470</span>      }<a name="line.1470"></a>
+<span class="sourceLineNo">1471</span>    }<a name="line.1471"></a>
+<span class="sourceLineNo">1472</span>  }<a name="line.1472"></a>
+<span class="sourceLineNo">1473</span><a name="line.1473"></a>
+<span class="sourceLineNo">1474</span>  private void createMyEphemeralNode() throws KeeperException, IOException {<a name="line.1474"></a>
+<span class="sourceLineNo">1475</span>    RegionServerInfo.Builder rsInfo = RegionServerInfo.newBuilder();<a name="line.1475"></a>
+<span class="sourceLineNo">1476</span>    rsInfo.setInfoPort(infoServer != null ? infoServer.getPort() : -1);<a name="line.1476"></a>
+<span class="sourceLineNo">1477</span>    rsInfo.setVersionInfo(ProtobufUtil.getVersionInfo());<a name="line.1477"></a>
+<span class="sourceLineNo">1478</span>    byte[] data = ProtobufUtil.prependPBMagic(rsInfo.build().toByteArray());<a name="line.1478"></a>
+<span class="sourceLineNo">1479</span>    ZKUtil.createEphemeralNodeAndWatch(this.zooKeeper,<a name="line.1479"></a>
+<span class="sourceLineNo">1480</span>      getMyEphemeralNodePath(), data);<a name="line.1480"></a>
+<span class="sourceLineNo">1481</span>  }<a name="line.1481"></a>
+<span class="sourceLineNo">1482</span><a name="line.1482"></a>
+<span class="sourceLineNo">1483</span>  private void deleteMyEphemeralNode() throws KeeperException {<a name="line.1483"></a>
+<span class="sourceLineNo">1484</span>    ZKUtil.deleteNode(this.zooKeeper, getMyEphemeralNodePath());<a name="line.1484"></a>
 <span class="sourceLineNo">1485</span>  }<a name="line.1485"></a>
 <span class="sourceLineNo">1486</span><a name="line.1486"></a>
 <span class="sourceLineNo">1487</span>  @Override<a name="line.1487"></a>
-<span class="sourceLineNo">1488</span>  public TableLockManager getTableLockManager() {<a name="line.1488"></a>
-<span class="sourceLineNo">1489</span>    return tableLockManager;<a name="line.1489"></a>
+<span class="sourceLineNo">1488</span>  public RegionServerAccounting getRegionServerAccounting() {<a name="line.1488"></a>
+<span class="sourceLineNo">1489</span>    return regionServerAccounting;<a name="line.1489"></a>
 <span class="sourceLineNo">1490</span>  }<a name="line.1490"></a>
 <span class="sourceLineNo">1491</span><a name="line.1491"></a>
-<span class="sourceLineNo">1492</span>  /*<a name="line.1492"></a>
-<span class="sourceLineNo">1493</span>   * @param r Region to get RegionLoad for.<a name="line.1493"></a>
-<span class="sourceLineNo">1494</span>   * @param regionLoadBldr the RegionLoad.Builder, can be null<a name="line.1494"></a>
-<span class="sourceLineNo">1495</span>   * @param regionSpecifier the RegionSpecifier.Builder, can be null<a name="line.1495"></a>
-<span class="sourceLineNo">1496</span>   * @return RegionLoad instance.<a name="line.1496"></a>
-<span class="sourceLineNo">1497</span>   *<a name="line.1497"></a>
-<span class="sourceLineNo">1498</span>   * @throws IOException<a name="line.1498"></a>
-<span class="sourceLineNo">1499</span>   */<a name="line.1499"></a>
-<span class="sourceLineNo">1500</span>  private RegionLoad createRegionLoad(final Region r, RegionLoad.Builder regionLoadBldr,<a name="line.1500"></a>
-<span class="sourceLineNo">1501</span>      RegionSpecifier.Builder regionSpecifier) throws IOException {<a name="line.1501"></a>
-<span class="sourceLineNo">1502</span>    byte[] name = r.getRegionInfo().getRegionName();<a name="line.1502"></a>
-<span class="sourceLineNo">1503</span>    int stores = 0;<a name="line.1503"></a>
-<span class="sourceLineNo">1504</span>    int storefiles = 0;<a name="line.1504"></a>
-<span class="sourceLineNo">1505</span>    int storeUncompressedSizeMB = 0;<a name="line.1505"></a>
-<span class="sourceLineNo">1506</span>    int storefileSizeMB = 0;<a name="line.1506"></a>
-<span class="sourceLineNo">1507</span>    int memstoreSizeMB = (int) (r.getMemstoreSize() / 1024 / 1024);<a name="line.1507"></a>
-<span class="sourceLineNo">1508</span>    int storefileIndexSizeMB = 0;<a name="line.1508"></a>
-<span class="sourceLineNo">1509</span>    int rootIndexSizeKB = 0;<a name="line.1509"></a>
-<span class="sourceLineNo">1510</span>    int totalStaticIndexSizeKB = 0;<a name="line.1510"></a>
-<span class="sourceLineNo">1511</span>    int totalStaticBloomSizeKB = 0;<a name="line.1511"></a>
-<span class="sourceLineNo">1512</span>    long totalCompactingKVs = 0;<a name="line.1512"></a>
-<span class="sourceLineNo">1513</span>    long currentCompactedKVs = 0;<a name="line.1513"></a>
-<span class="sourceLineNo">1514</span>    List&lt;Store&gt; storeList = r.getStores();<a name="line.1514"></a>
-<span class="sourceLineNo">1515</span>    stores += storeList.size();<a name="line.1515"></a>
-<span class="sourceLineNo">1516</span>    for (Store store : storeList) {<a name="line.1516"></a>
-<span class="sourceLineNo">1517</span>      storefiles += store.getStorefilesCount();<a name="line.1517"></a>
-<span class="sourceLineNo">1518</span>      storeUncompressedSizeMB += (int) (store.getStoreSizeUncompressed() / 1024 / 1024);<a name="line.1518"></a>
-<span class="sourceLineNo">1519</span>      storefileSizeMB += (int) (store.getStorefilesSize() / 1024 / 1024);<a name="line.1519"></a>
-<span class="sourceLineNo">1520</span>      storefileIndexSizeMB += (int) (store.getStorefilesIndexSize() / 1024 / 1024);<a name="line.1520"></a>
-<span class="sourceLineNo">1521</span>      CompactionProgress progress = store.getCompactionProgress();<a name="line.1521"></a>
-<span class="sourceLineNo">1522</span>      if (progress != null) {<a name="line.1522"></a>
-<span class="sourceLineNo">1523</span>        totalCompactingKVs += progress.totalCompactingKVs;<a name="line.1523"></a>
-<span class="sourceLineNo">1524</span>        currentCompactedKVs += progress.currentCompactedKVs;<a name="line.1524"></a>
-<span class="sourceLineNo">1525</span>      }<a name="line.1525"></a>
-<span class="sourceLineNo">1526</span>      rootIndexSizeKB += (int) (store.getStorefilesIndexSize() / 1024);<a name="line.1526"></a>
-<span class="sourceLineNo">1527</span>      totalStaticIndexSizeKB += (int) (store.getTotalStaticIndexSize() / 1024);<a name="line.1527"></a>
-<span class="sourceLineNo">1528</span>      totalStaticBloomSizeKB += (int) (store.getTotalStaticBloomSize() / 1024);<a name="line.1528"></a>
-<span class="sourceLineNo">1529</span>    }<a name="line.1529"></a>
-<span class="sourceLineNo">1530</span><a name="line.1530"></a>
-<span class="sourceLineNo">1531</span>    float dataLocality =<a name="line.1531"></a>
-<span class="sourceLineNo">1532</span>        r.getHDFSBlocksDistribution().getBlockLocalityIndex(serverName.getHostname());<a name="line.1532"></a>
-<span class="sourceLineNo">1533</span>    if (regionLoadBldr == null) {<a name="line.1533"></a>
-<span class="sourceLineNo">1534</span>      regionLoadBldr = RegionLoad.newBuilder();<a name="line.1534"></a>
-<span class="sourceLineNo">1535</span>    }<a name="line.1535"></a>
-<span class="sourceLineNo">1536</span>    if (regionSpecifier == null) {<a name="line.1536"></a>
-<span class="sourceLineNo">1537</span>      regionSpecifier = RegionSpecifier.newBuilder();<a name="line.1537"></a>
-<span class="sourceLineNo">1538</span>    }<a name="line.1538"></a>
-<span class="sourceLineNo">1539</span>    regionSpecifier.setType(RegionSpecifierType.REGION_NAME);<a name="line.1539"></a>
-<span class="sourceLineNo">1540</span>    regionSpecifier.setValue(ByteStringer.wrap(name));<a name="line.1540"></a>
-<span class="sourceLineNo">1541</span>    regionLoadBldr.setRegionSpecifier(regionSpecifier.build())<a name="line.1541"></a>
-<span class="sourceLineNo">1542</span>      .setStores(stores)<a name="line.1542"></a>
-<span class="sourceLineNo">1543</span>      .setStorefiles(storefiles)<a name="line.1543"></a>
-<span class="sourceLineNo">1544</span>      .setStoreUncompressedSizeMB(storeUncompressedSizeMB)<a name="line.1544"></a>
-<span class="sourceLineNo">1545</span>      .setStorefileSizeMB(storefileSizeMB)<a name="line.1545"></a>
-<span class="sourceLineNo">1546</span>      .setMemstoreSizeMB(memstoreSizeMB)<a name="line.1546"></a>
-<span class="sourceLineNo">1547</span>      .setStorefileIndexSizeMB(storefileIndexSizeMB)<a name="line.1547"></a>
-<span class="sourceLineNo">1548</span>      .setRootIndexSizeKB(rootIndexSizeKB)<a name="line.1548"></a>
-<span class="sourceLineNo">1549</span>      .setTotalStaticIndexSizeKB(totalStaticIndexSizeKB)<a name="line.1549"></a>
-<span class="sourceLineNo">1550</span>      .setTotalStaticBloomSizeKB(totalStaticBloomSizeKB)<a name="line.1550"></a>
-<span class="sourceLineNo">1551</span>      .setReadRequestsCount(r.getReadRequestsCount())<a name="line.1551"></a>
-<span class="sourceLineNo">1552</span>      .setFilteredReadRequestsCount(r.getFilteredReadRequestsCount())<a name="line.1552"></a>
-<span class="sourceLineNo">1553</span>      .setWriteRequestsCount(r.getWriteRequestsCount())<a name="line.1553"></a>
-<span class="sourceLineNo">1554</span>      .setTotalCompactingKVs(totalCompactingKVs)<a name="line.1554"></a>
-<span class="sourceLineNo">1555</span>      .setCurrentCompactedKVs(currentCompactedKVs)<a name="line.1555"></a>
-<span class="sourceLineNo">1556</span>      .setDataLocality(dataLocality)<a name="line.1556"></a>
-<span class="sourceLineNo">1557</span>      .setLastMajorCompactionTs(r.getOldestHfileTs(true));<a name="line.1557"></a>
-<span class="sourceLineNo">1558</span>    ((HRegion)r).setCompleteSequenceId(regionLoadBldr);<a name="line.1558"></a>
-<span class="sourceLineNo">1559</span><a name="line.1559"></a>
-<span class="sourceLineNo">1560</span>    return regionLoadBldr.build();<a name="line.1560"></a>
-<span class="sourceLineNo">1561</span>  }<a name="line.1561"></a>
-<span class="sourceLineNo">1562</span><a name="line.1562"></a>
-<span class="sourceLineNo">1563</span>  /**<a name="line.1563"></a>
-<span class="sourceLineNo">1564</span>   * @param encodedRegionName<a name="line.1564"></a>
-<span class="sourceLineNo">1565</span>   * @return An instance of RegionLoad.<a name="line.1565"></a>
-<span class="sourceLineNo">1566</span>   */<a name="line.1566"></a>
-<span class="sourceLineNo">1567</span>  public RegionLoad createRegionLoad(final String encodedRegionName) throws IOException {<a name="line.1567"></a>
-<span class="sourceLineNo">1568</span>    Region r = onlineRegions.get(encodedRegionName);<a name="line.1568"></a>
-<span class="sourceLineNo">1569</span>    return r != null ? createRegionLoad(r, null, null) : null;<a name="line.1569"></a>
-<span class="sourceLineNo">1570</span>  }<a name="line.1570"></a>
-<span class="sourceLineNo">1571</span><a name="line.1571"></a>
-<span class="sourceLineNo">1572</span>  /*<a name="line.1572"></a>
-<span class="sourceLineNo">1573</span>   * Inner class that runs on a long period checking if regions need compaction.<a name="line.1573"></a>
-<span class="sourceLineNo">1574</span>   */<a name="line.1574"></a>
-<span class="sourceLineNo">1575</span>  private static class CompactionChecker extends ScheduledChore {<a name="line.1575"></a>
-<span class="sourceLineNo">1576</span>    private final HRegionServer instance;<a name="line.1576"></a>
-<span class="sourceLineNo">1577</span>    private final int majorCompactPriority;<a name="line.1577"></a>
-<span class="sourceLineNo">1578</span>    private final static int DEFAULT_PRIORITY = Integer.MAX_VALUE;<a name="line.1578"></a>
-<span class="sourceLineNo">1579</span>    private long iteration = 0;<a name="line.1579"></a>
-<span class="sourceLineNo">1580</span><a name="line.1580"></a>
-<span class="sourceLineNo">1581</span>    CompactionChecker(final HRegionServer h, final int sleepTime,<a name="line.1581"></a>
-<span class="sourceLineNo">1582</span>        final Stoppable stopper) {<a name="line.1582"></a>
-<span class="sourceLineNo">1583</span>      super("CompactionChecker", stopper, sleepTime);<a name="line.1583"></a>
-<span class="sourceLineNo">1584</span>      this.instance = h;<a name="line.1584"></a>
-<span class="sourceLineNo">1585</span>      LOG.info(this.getName() + " runs every " + StringUtils.formatTime(sleepTime));<a name="line.1585"></a>
-<span class="sourceLineNo">1586</span><a name="line.1586"></a>
-<span class="sourceLineNo">1587</span>      /* MajorCompactPriority is configurable.<a name="line.1587"></a>
-<span class="sourceLineNo">1588</span>       * If not set, the compaction will use default priority.<a name="line.1588"></a>
-<span class="sourceLineNo">1589</span>       */<a name="line.1589"></a>
-<span class="sourceLineNo">1590</span>      this.majorCompactPriority = this.instance.conf.<a name="line.1590"></a>
-<span class="sourceLineNo">1591</span>        getInt("hbase.regionserver.compactionChecker.majorCompactPriority",<a name="line.1591"></a>
-<span class="sourceLineNo">1592</span>        DEFAULT_PRIORITY);<a name="line.1592"></a>
-<span class="sourceLineNo">1593</span>    }<a name="line.1593"></a>
-<span class="sourceLineNo">1594</span><a name="line.1594"></a>
-<span class="sourceLineNo">1595</span>    @Override<a name="line.1595"></a>
-<span class="sourceLineNo">1596</span>    protected void chore() {<a name="line.1596"></a>
-<span class="sourceLineNo">1597</span>      for (Region r : this.instance.onlineRegions.values()) {<a name="line.1597"></a>
-<span class="sourceLineNo">1598</span>        if (r == null)<a name="line.1598"></a>
-<span class="sourceLineNo">1599</span>          continue;<a name="line.1599"></a>
-<span class="sourceLineNo">1600</span>        for (Store s : r.getStores()) {<a name="line.1600"></a>
-<span class="sourceLineNo">1601</span>          try {<a name="line.1601"></a>
-<span class="sourceLineNo">1602</span>            long multiplier = s.getCompactionCheckMultiplier();<a name="line.1602"></a>
-<span class="sourceLineNo">1603</span>            assert multiplier &gt; 0;<a name="line.1603"></a>
-<span class="sourceLineNo">1604</span>            if (iteration % multiplier != 0) continue;<a name="line.1604"></a>
-<span class="sourceLineNo">1605</span>            if (s.needsCompaction()) {<a name="line.1605"></a>
-<span class="sourceLineNo">1606</span>              // Queue a compaction. Will recognize if major is needed.<a name="line.1606"></a>
-<span class="sourceLineNo">1607</span>              this.instance.compactSplitThread.requestSystemCompaction(r, s, getName()<a name="line.1607"></a>
-<span class="sourceLineNo">1608</span>                  + " requests compaction");<a name="line.1608"></a>
-<span class="sourceLineNo">1609</span>            } else if (s.isMajorCompaction()) {<a name="line.1609"></a>
-<span class="sourceLineNo">1610</span>              if (majorCompactPriority == DEFAULT_PRIORITY<a name="line.1610"></a>
-<span class="sourceLineNo">1611</span>                  || majorCompactPriority &gt; ((HRegion)r).getCompactPriority()) {<a name="line.1611"></a>
-<span class="sourceLineNo">1612</span>                this.instance.compactSplitThread.requestCompaction(r, s, getName()<a name="line.1612"></a>
-<span class="sourceLineNo">1613</span>                    + " requests major compaction; use default priority", null);<a name="line.1613"></a>
-<span class="sourceLineNo">1614</span>              } else {<a name="line.1614"></a>
-<span class="sourceLineNo">1615</span>                this.instance.compactSplitThread.requestCompaction(r, s, getName()<a name="line.1615"></a>
-<span class="sourceLineNo">1616</span>                    + " requests major compaction; use configured priority",<a name="line.1616"></a>
-<span class="sourceLineNo">1617</span>                  this.majorCompactPriority, null, null);<a name="line.1617"></a>
-<span class="sourceLineNo">1618</span>              }<a name="line.1618"></a>
-<span class="sourceLineNo">1619</span>            }<a name="line.1619"></a>
-<span class="sourceLineNo">1620</span>          } catch (IOException e) {<a name="line.1620"></a>
-<span class="sourceLineNo">1621</span>            LOG.warn("Failed major compaction check on " + r, e);<a name="line.1621"></a>
-<span class="sourceLineNo">1622</span>          }<a name="line.1622"></a>
-<span class="sourceLineNo">1623</span>        }<a name="line.1623"></a>
-<span class="sourceLineNo">1624</span>      }<a name="line.1624"></a>
-<span class="sourceLineNo">1625</span>      iteration = (iteration == Long.MAX_VALUE) ? 0 : (iteration + 1);<a name="line.1625"></a>
-<span class="sourceLineNo">1626</span>    }<a name="line.1626"></a>
-<span class="sourceLineNo">1627</span>  }<a name="line.1627"></a>
-<span class="sourceLineNo">1628</span><a name="line.1628"></a>
-<span class="sourceLineNo">1629</span>  static class PeriodicMemstoreFlusher extends ScheduledChore {<a name="line.1629"></a>
-<span class="sourceLineNo">1630</span>    final HRegionServer server;<a name="line.1630"></a>
-<span class="sourceLineNo">1631</span>    final static int RANGE_OF_DELAY = 5 * 60 * 1000; // 5 min in milliseconds<a name="line.1631"></a>
-<span class="sourceLineNo">1632</span>    final static int MIN_DELAY_TIME = 0; // millisec<a name="line.1632"></a>
-<span class="sourceLineNo">1633</span>    public PeriodicMemstoreFlusher(int cacheFlushInterval, final HRegionServer server) {<a name="line.1633"></a>
-<span class="sourceLineNo">1634</span>      super(server.getServerName() + "-MemstoreFlusherChore", server, cacheFlushInterval);<a name="line.1634"></a>
-<span class="sourceLineNo">1635</span>      this.server = server;<a name="line.1635"></a>
-<span class="sourceLineNo">1636</span>    }<a name="line.1636"></a>
-<span class="sourceLineNo">1637</span><a name="line.1637"></a>
-<span class="sourceLineNo">1638</span>    @Override<a name="line.1638"></a>
-<span class="sourceLineNo">1639</span>    protected void chore() {<a name="line.1639"></a>
-<span class="sourceLineNo">1640</span>      final StringBuffer whyFlush = new StringBuffer();<a name="line.1640"></a>
-<span class="sourceLineNo">1641</span>      for (Region r : this.server.onlineRegions.values()) {<a name="line.1641"></a>
-<span class="sourceLineNo">1642</span>        if (r == null) continue;<a name="line.1642"></a>
-<span class="sourceLineNo">1643</span>        if (((HRegion)r).shouldFlush(whyFlush)) {<a name="line.1643"></a>
-<span class="sourceLineNo">1644</span>          FlushRequester requester = server.getFlushRequester();<a name="line.1644"></a>
-<span class="sourceLineNo">1645</span>          if (requester != null) {<a name="line.1645"></a>
-<span class="sourceLineNo">1646</span>            long randomDelay = RandomUtils.nextInt(RANGE_OF_DELAY) + MIN_DELAY_TIME;<a name="line.1646"></a>
-<span class="sourceLineNo">1647</span>            LOG.info(getName() + " requesting flush of " +<a name="line.1647"></a>
-<span class="sourceLineNo">1648</span>              r.getRegionInfo().getRegionNameAsString() + " because " +<a name="line.1648"></a>
-<span class="sourceLineNo">1649</span>              whyFlush.toString() +<a name="line.1649"></a>
-<span class="sourceLineNo">1650</span>              " after random delay " + randomDelay + "ms");<a name="line.1650"></a>
-<span class="sourceLineNo">1651</span>            //Throttle the flushes by putting a delay. If we don't throttle, and there<a name="line.1651"></a>
-<span class="sourceLineNo">1652</span>            //is a balanced write-load on the regions in a table, we might end up<a name="line.1652"></a>
-<span class="sourceLineNo">1653</span>            //overwhelming the filesystem with too many flushes at once.<a name="line.1653"></a>
-<span class="sourceLineNo">1654</span>            requester.requestDelayedFlush(r, randomDelay, false);<a name="line.1654"></a>
-<span class="sourceLineNo">1655</span>          }<a name="line.1655"></a>
-<span class="sourceLineNo">1656</span>        }<a name="line.1656"></a>
-<span class="sourceLineNo">1657</span>      }<a name="line.1657"></a>
-<span class="sourceLineNo">1658</span>    }<a name="line.1658"></a>
-<span class="sourceLineNo">1659</span>  }<a name="line.1659"></a>
-<span class="sourceLineNo">1660</span><a name="line.1660"></a>
-<span class="sourceLineNo">1661</span>  /**<a name="line.1661"></a>
-<span class="sourceLineNo">1662</span>   * Report the status of the server. A server is online once all the startup is<a name="line.1662"></a>
-<span class="sourceLineNo">1663</span>   * completed (setting up filesystem, starting service threads, etc.). This<a name="line.1663"></a>
-<span class="sourceLineNo">1664</span>   * method is designed mostly to be useful in tests.<a name="line.1664"></a>
-<span class="sourceLineNo">1665</span>   *<a name="line.1665"></a>
-<span class="sourceLineNo">1666</span>   * @return true if online, false if not.<a name="line.1666"></a>
-<span class="sourceLineNo">1667</span>   */<a name="line.1667"></a>
-<span class="sourceLineNo">1668</span>  public boolean isOnline() {<a name="line.1668"></a>
-<span class="sourceLineNo">1669</span>    return online.get();<a name="line.1669"></a>
-<span class="sourceLineNo">1670</span>  }<a name="line.1670"></a>
-<span class="sourceLineNo">1671</span><a name="line.1671"></a>
-<span class="sourceLineNo">1672</span>  /**<a name="line.1672"></a>
-<span class="sourceLineNo">1673</span>   * Setup WAL log and replication if enabled.<a name="line.1673"></a>
-<span class="sourceLineNo">1674</span>   * Replication setup is done in here because it wants to be hooked up to WAL.<a name="line.1674"></a>
-<span class="sourceLineNo">1675</span>   * @return A WAL instance.<a name="line.1675"></a>
-<span class="sourceLineNo">1676</span>   * @throws IOException<a name="line.1676"></a>
-<span class="sourceLineNo">1677</span>   */<a name="line.1677"></a>
-<span class="sourceLineNo">1678</span>  private WALFactory setupWALAndReplication() throws IOException {<a name="line.1678"></a>
-<span class="sourceLineNo">1679</span>    // TODO Replication make assumptions here based on the default filesystem impl<a name="line.1679"></a>
-<span class="sourceLineNo">1680</span>    final Path oldLogDir = new Path(rootDir, HConstants.HREGION_OLDLOGDIR_NAME);<a name="line.1680"></a>
-<span class="sourceLineNo">1681</span>    final String logName = AbstractFSWALProvider.getWALDirectoryName(this.serverName.toString());<a name="line.1681"></a>
-<span class="sourceLineNo">1682</span><a name="line.1682"></a>
-<span class="sourceLineNo">1683</span>    Path logdir = new Path(rootDir, logName);<a name="line.1683"></a>
-<span class="sourceLineNo">1684</span>    if (LOG.isDebugEnabled()) LOG.debug("logdir=" + logdir);<a name="line.1684"></a>
-<span class="sourceLineNo">1685</span>    if (this.fs.exists(logdir)) {<a name="line.1685"></a>
-<span class="sourceLineNo">1686</span>      throw new RegionServerRunningException("Region server has already " +<a name="line.1686"></a>
-<span class="sourceLineNo">1687</span>        "created directory at " + this.serverName.toString());<a name="line.1687"></a>
-<span class="sourceLineNo">1688</span>    }<a name="line.1688"></a>
-<span class="sourceLineNo">1689</span><a name="line.1689"></a>
-<span class="sourceLineNo">1690</span>    // Instantiate replication manager if replication enabled.  Pass it the<a name="line.1690"></a>
-<span class="sourceLineNo">1691</span>    // log directories.<a name="line.1691"></a>
-<span class="sourceLineNo">1692</span>    createNewReplicationInstance(conf, this, this.fs, logdir, oldLogDir);<a name="line.1692"></a>
-<span class="sourceLineNo">1693</span><a name="line.1693"></a>
-<span class="sourceLineNo">1694</span>    // listeners the wal factory will add to wals it creates.<a name="line.1694"></a>
-<span class="sourceLineNo">1695</span>    final List&lt;WALActionsListener&gt; listeners = new ArrayList&lt;WALActionsListener&gt;();<a name="line.1695"></a>
-<span class="sourceLineNo">1696</span>    listeners.add(new MetricsWAL());<a name="line.1696"></a>
-<span class="sourceLineNo">1697</span>    if (this.replicationSourceHandler != null &amp;&amp;<a name="line.1697"></a>
-<span class="sourceLineNo">1698</span>        this.replicationSourceHandler.getWALActionsListener() != null) {<a name="line.1698"></a>
-<span class="sourceLineNo">1699</span>      // Replication handler is an implementation of WALActionsListener.<a name="line.1699"></a>
-<span class="sourceLineNo">1700</span>      listeners.add(this.replicationSourceHandler.getWALActionsListener());<a name="line.1700"></a>
-<span class="sourceLineNo">1701</span>    }<a name="line.1701"></a>
-<span class="sourceLineNo">1702</span><a name="line.1702"></a>
-<span class="sourceLineNo">1703</span>    return new WALFactory(conf, listeners, serverName.toString());<a name="line.1703"></a>
-<span class="sourceLineNo">1704</span>  }<a name="line.1704"></a>
-<span class="sourceLineNo">1705</span><a name="line.1705"></a>
-<span class="sourceLineNo">1706</span>  /**<a name="line.1706"></a>
-<span class="sourceLineNo">1707</span>   * We initialize the roller for the wal that handles meta lazily<a name="line.1707"></a>
-<span class="sourceLineNo">1708</span>   * since we don't know if this regionserver will handle it. All calls to<a name="line.1708"></a>
-<span class="sourceLineNo">1709</span>   * this method return a reference to the that same roller. As newly referenced<a name="line.1709"></a>
-<span class="sourceLineNo">1710</span>   * meta regions are brought online, they will be offered to the roller for maintenance.<a name="line.1710"></a>
-<span class="sourceLineNo">1711</span>   * As a part of that registration process, the roller will add itself as a<a name="line.1711"></a>
-<span class="sourceLineNo">1712</span>   * listener on the wal.<a name="line.1712"></a>
-<span class="sourceLineNo">1713</span>   */<a name="line.1713"></a>
-<span class="sourceLineNo">1714</span>  protected LogRoller ensureMetaWALRoller() {<a name="line.1714"></a>
-<span class="sourceLineNo">1715</span>    // Using a tmp log roller to ensure metaLogRoller is alive once it is not<a name="line.1715"></a>
-<span class="sourceLineNo">1716</span>    // null<a name="line.1716"></a>
-<span class="sourceLineNo">1717</span>    LogRoller roller = metawalRoller.get();<a name="line.1717"></a>
-<span class="sourceLineNo">1718</span>    if (null == roller) {<a name="line.1718"></a>
-<span class="sourceLineNo">1719</span>      LogRoller tmpLogRoller = new LogRoller(this, this);<a name="line.1719"></a>
-<span class="sourceLineNo">1720</span>      String n = Thread.currentThread().getName();<a name="line.1720"></a>
-<span class="sourceLineNo">1721</span>      Threads.setDaemonThreadRunning(tmpLogRoller.getThread(),<a name="line.1721"></a>
-<span class="sourceLineNo">1722</span>          n + "-MetaLogRoller", uncaughtExceptionHandler);<a name="line.1722"></a>
-<span class="sourceLineNo">1723</span>      if (metawalRoller.compareAndSet(null, tmpLogRoller)) {<a name="line.1723"></a>
-<span class="sourceLineNo">1724</span>        roller = tmpLogRoller;<a name="line.1724"></a>
-<span class="sourceLineNo">1725</span>      } else {<a name="line.1725"></a>
-<span class="sourceLineNo">1726</span>        // Another thread won starting the roller<a name="line.1726"></a>
-<span class="sourceLineNo">1727</span>        Threads.shutdown(tmpLogRoller.getThread());<a name="line.1727"></a>
-<span class="sourceLineNo">1728</span>        roller = metawalRoller.get();<a name="line.1728"></a>
-<span class="sourceLineNo">1729</span>      }<a name="line.1729"></a>
-<span class="sourceLineNo">1730</span>    }<a name="line.1730"></a>
-<span class="sourceLineNo">1731</span>    return roller;<a name="line.1731"></a>
-<span class="sourceLineNo">1732</span>  }<a name="line.1732"></a>
-<span class="sourceLineNo">1733</span><a name="line.1733"></a>
-<span class="sourceLineNo">1734</span>  public MetricsRegionServer getRegionServerMetrics() {<a name="line.1734"></a>
-<span class="sourceLineNo">1735</span>    return this.metricsRegionServer;<a name="line.1735"></a>
-<span class="sourceLineNo">1736</span>  }<a name="line.1736"></a>
-<span class="sourceLineNo">1737</span><a name="line.1737"></a>
-<span class="sourceLineNo">1738</span>  /**<a name="line.1738"></a>
-<span class="sourceLineNo">1739</span>   * @return Master address tracker instance.<a name="line.1739"></a>
-<span class="sourceLineNo">1740</span>   */<a name="line.1740"></a>
-<span class="sourceLineNo">1741</span>  public MasterAddressTracker getMasterAddressTracker() {<a name="line.1741"></a>
-<span class="sourceLineNo">1742</span>    return this.masterAddressTracker;<a name="line.1742"></a>
-<span class="sourceLineNo">1743</span>  }<a name="line.1743"></a>
-<span class="sourceLineNo">1744</span><a name="line.1744"></a>
-<span class="sourceLineNo">1745</span>  /*<a name="line.1745"></a>
-<span class="sourceLineNo">1746</span>   * Start maintenance Threads, Server, Worker and lease checker threads.<a name="line.1746"></a>
-<span class="sourceLineNo">1747</span>   * Install an UncaughtExceptionHandler that calls abort of RegionServer if we<a name="line.1747"></a>
-<span class="sourceLineNo">1748</span>   * get an unhandled exception. We cannot set the handler on all threads.<a name="line.1748"></a>
-<span class="sourceLineNo">1749</span>   * Server's internal Listener thread is off limits. For Server, if an OOME, it<a name="line.1749"></a>
-<span class="sourceLineNo">1750</span>   * waits a while then retries. Meantime, a flush or a compaction that tries to<a name="line.1750"></a>
-<span class="sourceLineNo">1751</span>   * run should trigger same critical condition and the shutdown will run. On<a name="line.1751"></a>
-<span class="sourceLineNo">1752</span>   * its way out, this server will shut down Server. Leases are sort of<a name="line.1752"></a>
-<span class="sourceLineNo">1753</span>   * inbetween. It has an internal thread that while it inherits from Chore, it<a name="line.1753"></a>
-<span class="sourceLineNo">1754</span>   * keeps its own internal stop mechanism so needs to be stopped by this<a name="line.1754"></a>
-<span class="sourceLineNo">1755</span>   * hosting server. Worker logs the exception and exits.<a name="line.1755"></a>
-<span class="sourceLineNo">1756</span>   */<a name="line.1756"></a>
-<span class="sourceLineNo">1757</span>  private void startServiceThreads() throws IOException {<a name="line.1757"></a>
-<span class="sourceLineNo">1758</span>    // Start executor services<a name="line.1758"></a>
-<span class="sourceLineNo">1759</span>    this.service.startExecutorService(ExecutorType.RS_OPEN_REGION,<a name="line.1759"></a>
-<span class="sourceLineNo">1760</span>      conf.getInt("hbase.regionserver.executor.openregion.threads", 3));<a name="line.1760"></a>
-<span class="sourceLineNo">1761</span>    this.service.startExecutorService(ExecutorType.RS_OPEN_META,<a name="line.1761"></a>
-<span class="sourceLineNo">1762</span>      conf.getInt("hbase.regionserver.executor.openmeta.threads", 1));<a name="line.1762"></a>
-<span class="sourceLineNo">1763</span>    this.service.startExecutorService(ExecutorType.RS_OPEN_PRIORITY_REGION,<a name="line.1763"></a>
-<span class="sourceLineNo">1764</span>      conf.getInt("hbase.regionserver.executor.openpriorityregion.threads", 3));<a name="line.1764"></a>
-<span class="sourceLineNo">1765</span>    this.service.startExecutorService(ExecutorType.RS_CLOSE_REGION,<a name="line.1765"></a>
-<span class="sourceLineNo">1766</span>      conf.getInt("hbase.regionserver.executor.closeregion.threads", 3));<a name="line.1766"></a>
-<span class="sourceLineNo">1767</span>    this.service.startExecutorService(ExecutorType.RS_CLOSE_META,<a name="line.1767"></a>
-<span class="sourceLineNo">1768</span>      conf.getInt("hbase.regionserver.executor.closemeta.threads", 1));<a name="line.1768"></a>
-<span class="sourceLineNo">1769</span>    if (conf.getBoolean(StoreScanner.STORESCANNER_PARALLEL_SEEK_ENABLE, false)) {<a name="line.1769"></a>
-<span class="sourceLineNo">1770</span>      this.service.startExecutorService(ExecutorType.RS_PARALLEL_SEEK,<a name="line.1770"></a>
-<span class="sourceLineNo">1771</span>        conf.getInt("hbase.storescanner.parallel.seek.threads", 10));<a name="line.1771"></a>
-<span class="sourceLineNo">1772</span>    }<a name="line.1772"></a>
-<span class="sourceLineNo">1773</span>    this.service.startExecutorService(ExecutorType.RS_LOG_REPLAY_OPS, conf.getInt(<a name="line.1773"></a>
-<span class="sourceLineNo">1774</span>       "hbase.regionserver.wal.max.splitters", SplitLogWorkerCoordination.DEFAULT_MAX_SPLITTERS));<a name="line.1774"></a>
-<span class="sourceLineNo">1775</span>    // Start the threads for compacted files discharger<a name="line.1775"></a>
-<span class="sourceLineNo">1776</span>    this.service.startExecutorService(ExecutorType.RS_COMPACTED_FILES_DISCHARGER,<a name="line.1776"></a>
-<span class="sourceLineNo">1777</span>      conf.getInt(CompactionConfiguration.HBASE_HFILE_COMPACTION_DISCHARGER_THREAD_COUNT, 10));<a name="line.1777"></a>
-<span class="sourceLineNo">1778</span>    if (ServerRegionReplicaUtil.isRegionReplicaWaitForPrimaryFlushEnabled(conf)) {<a name="line.1778"></a>
-<span class="sourceLineNo">1779</span>      this.service.startExecutorService(ExecutorType.RS_REGION_REPLICA_FLUSH_OPS,<a name="line.1779"></a>
-<span class="sourceLineNo">1780</span>        conf.getInt("hbase.regionserver.region.replica.flusher.threads",<a name="line.1780"></a>
-<span class="sourceLineNo">1781</span>          conf.getInt("hbase.regionserver.executor.openregion.threads", 3)));<a name="line.1781"></a>
-<span class="sourceLineNo">1782</span>    }<a name="line.1782"></a>
-<span class="sourceLineNo">1783</span><a name="line.1783"></a>
-<span class="sourceLineNo">1784</span>    Threads.setDaemonThreadRunning(this.walRoller.getThread(), getName() + ".logRoller",<a name="line.1784"></a>
-<span class="sourceLineNo">1785</span>        uncaughtExceptionHandler);<a name="line.1785"></a>
-<span class="sourceLineNo">1786</span>    this.cacheFlusher.start(uncaughtExceptionHandler);<a name="line.1786"></a>
-<span class="sourceLineNo">1787</span><a name="line.1787"></a>
-<span class="sourceLineNo">1788</span>    if (this.compactionChecker != null) choreService.scheduleChore(compactionChecker);<a name="line.1788"></a>
-<span class="sourceLineNo">1789</span>    if (this.periodicFlusher != null) choreService.scheduleChore(periodicFlusher);<a name="line.1789"></a>
-<span class="sourceLineNo">1790</span>    if (this.healthCheckChore != null) choreService.scheduleChore(healthCheckChore);<a name="line.1790"></a>
-<span class="sourceLineNo">1791</span>    if (this.nonceManagerChore != null) choreService.scheduleChore(nonceManagerChore);<a name="line.1791"></a>
-<span class="sourceLineNo">1792</span>    if (this.storefileRefresher != null) choreService.scheduleChore(storefileRefresher);<a name="line.1792"></a>
-<span class="sourceLineNo">1793</span>    if (this.movedRegionsCleaner != null) choreService.scheduleChore(movedRegionsCleaner);<a name="line.1793"></a>
-<span class="sourceLineNo">1794</span><a name="line.1794"></a>
-<span class="sourceLineNo">1795</span>    // Leases is not a Thread. Internally it runs a daemon thread. If it gets<a name="line.1795"></a>
-<span class="sourceLineNo">1796</span>    // an unhandled exception, it will just exit.<a name="line.1796"></a>
-<span class="sourceLineNo">1797</span>    Threads.setDaemonThreadRunning(this.leases.getThread(), getName() + ".leaseChecker",<a name="line.1797"></a>
-<span class="sourceLineNo">1798</span>      uncaughtExceptionHandler);<a name="line.1798"></a>
+<span class="sourceLineNo">1492</span>  @Override<a name="line.1492"></a>
+<span class="sourceLineNo">1493</span>  public TableLockManager getTableLockManager() {<a name="line.1493"></a>
+<span class="sourceLineNo">1494</span>    return tableLockManager;<a name="line.1494"></a>
+<span class="sourceLineNo">1495</span>  }<a name="line.1495"></a>
+<span class="sourceLineNo">1496</span><a name="line.1496"></a>
+<span class="sourceLineNo">1497</span>  /*<a name="line.1497"></a>
+<span class="sourceLineNo">1498</span>   * @param r Region to get RegionLoad for.<a name="line.1498"></a>
+<span class="sourceLineNo">1499</span>   * @param regionLoadBldr the RegionLoad.Builder, can be null<a name="line.1499"></a>
+<span class="sourceLineNo">1500</span>   * @param regionSpecifier the RegionSpecifier.Builder, can be null<a name="line.1500"></a>
+<span class="sourceLineNo">1501</span>   * @return RegionLoad instance.<a name="line.1501"></a>
+<span class="sourceLineNo">1502</span>   *<a name="line.1502"></a>
+<span class="sourceLineNo">1503</span>   * @throws IOException<a name="line.1503"></a>
+<span class="sourceLineNo">1504</span>   */<a name="line.1504"></a>
+<span class="sourceLineNo">1505</span>  private RegionLoad createRegionLoad(final Region r, RegionLoad.Builder regionLoadBldr,<a name="line.1505"></a>
+<span class="sourceLineNo">1506</span>      RegionSpecifier.Builder regionSpecifier) throws IOException {<a name="line.1506"></a>
+<span class="sourceLineNo">1507</span>    byte[] name = r.getRegionInfo().getRegionName();<a name="line.1507"></a>
+<span class="sourceLineNo">1508</span>    int stores = 0;<a name="line.1508"></a>
+<span class="sourceLineNo">1509</span>    int storefiles = 0;<a name="line.1509"></a>
+<span class="sourceLineNo">1510</span>    int storeUncompressedSizeMB = 0;<a name="line.1510"></a>
+<span class="sourceLineNo">1511</span>    int storefileSizeMB = 0;<a name="line.1511"></a>
+<span class="sourceLineNo">1512</span>    int memstoreSizeMB = (int) (r.getMemstoreSize() / 1024 / 1024);<a name="line.1512"></a>
+<span class="sourceLineNo">1513</span>    int storefileIndexSizeMB = 0;<a name="line.1513"></a>
+<span class="sourceLineNo">1514</span>    int rootIndexSizeKB = 0;<a name="line.1514"></a>
+<span class="sourceLineNo">1515</span>    int totalStaticIndexSizeKB = 0;<a name="line.1515"></a>
+<span class="sourceLineNo">1516</span>    int totalStaticBloomSizeKB = 0;<a name="line.1516"></a>
+<span class="sourceLineNo">1517</span>    long totalCompactingKVs = 0;<a name="line.1517"></a>
+<span class="sourceLineNo">1518</span>    long currentCompactedKVs = 0;<a name="line.1518"></a>
+<span class="sourceLineNo">1519</span>    List&lt;Store&gt; storeList = r.getStores();<a name="line.1519"></a>
+<span class="sourceLineNo">1520</span>    stores += storeList.size();<a name="line.1520"></a>
+<span class="sourceLineNo">1521</span>    for (Store store : storeList) {<a name="line.1521"></a>
+<span class="sourceLineNo">1522</span>      storefiles += store.getStorefilesCount();<a name="line.1522"></a>
+<span class="sourceLineNo">1523</span>      storeUncompressedSizeMB += (int) (store.getStoreSizeUncompressed() / 1024 / 1024);<a name="line.1523"></a>
+<span class="sourceLineNo">1524</span>      storefileSizeMB += (int) (store.getStorefilesSize() / 1024 / 1024);<a name="line.1524"></a>
+<span class="sourceLineNo">1525</span>      storefileIndexSizeMB += (int) (store.getStorefilesIndexSize() / 1024 / 1024);<a name="line.1525"></a>
+<span class="sourceLineNo">1526</span>      CompactionProgress progress = store.getCompactionProgress();<a name="line.1526"></a>
+<span class="sourceLineNo">1527</span>      if (progress != null) {<a name="line.1527"></a>
+<span class="sourceLineNo">1528</span>        totalCompactingKVs += progress.totalCompactingKVs;<a name="line.1528"></a>
+<span class="sourceLineNo">1529</span>        currentCompactedKVs += progress.currentCompactedKVs;<a name="line.1529"></a>
+<span class="sourceLineNo">1530</span>      }<a name="line.1530"></a>
+<span class="sourceLineNo">1531</span>      rootIndexSizeKB += (int) (store.getStorefilesIndexSize() / 1024);<a name="line.1531"></a>
+<span class="sourceLineNo">1532</span>      totalStaticIndexSizeKB += (int) (store.getTotalStaticIndexSize() / 1024);<a name="line.1532"></a>
+<span class="sourceLineNo">1533</span>      totalStaticBloomSizeKB += (int) (store.getTotalStaticBloomSize() / 1024);<a name="line.1533"></a>
+<span class="sourceLineNo">1534</span>    }<a name="line.1534"></a>
+<span class="sourceLineNo">1535</span><a name="line.1535"></a>
+<span class="sourceLineNo">1536</span>    float dataLocality =<a name="line.1536"></a>
+<span class="sourceLineNo">1537</span>        r.getHDFSBlocksDistribution().getBlockLocalityIndex(serverName.getHostname());<a name="line.1537"></a>
+<span class="sourceLineNo">1538</span>    if (regionLoadBldr == null) {<a name="line.1538"></a>
+<span class="sourceLineNo">1539</span>      regionLoadBldr = RegionLoad.newBuilder();<a name="line.1539"></a>
+<span class="sourceLineNo">1540</span>    }<a name="line.1540"></a>
+<span class="sourceLineNo">1541</span>    if (regionSpecifier == null) {<a name="line.1541"></a>
+<span class="sourceLineNo">1542</span>      regionSpecifier = RegionSpecifier.newBuilder();<a name="line.1542"></a>
+<span class="sourceLineNo">1543</span>    }<a name="line.1543"></a>
+<span class="sourceLineNo">1544</span>    regionSpecifier.setType(RegionSpecifierType.REGION_NAME);<a name="line.1544"></a>
+<span class="sourceLineNo">1545</span>    regionSpecifier.setValue(ByteStringer.wrap(name));<a name="line.1545"></a>
+<span class="sourceLineNo">1546</span>    regionLoadBldr.setRegionSpecifier(regionSpecifier.build())<a name="line.1546"></a>
+<span class="sourceLineNo">1547</span>      .setStores(stores)<a name="line.1547"></a>
+<span class="sourceLineNo">1548</span>      .setStorefiles(storefiles)<a name="line.1548"></a>
+<span class="sourceLineNo">1549</span>      .setStoreUncompressedSizeMB(storeUncompressedSizeMB)<a name="line.1549"></a>
+<span class="sourceLineNo">1550</span>      .setStorefileSizeMB(storefileSizeMB)<a name="line.1550"></a>
+<span class="sourceLineNo">1551</span>      .setMemstoreSizeMB(memstoreSizeMB)<a name="line.1551"></a>
+<span class="sourceLineNo">1552</span>      .setStorefileIndexSizeMB(storefileIndexSizeMB)<a name="line.1552"></a>
+<span class="sourceLineNo">1553</span>      .setRootIndexSizeKB(rootIndexSizeKB)<a name="line.1553"></a>
+<span class="sourceLineNo">1554</span>      .setTotalStaticIndexSizeKB(totalStaticIndexSizeKB)<a name="line.1554"></a>
+<span class="sourceLineNo">1555</span>      .setTotalStaticBloomSizeKB(totalStaticBloomSizeKB)<a name="line.1555"></a>
+<span class="sourceLineNo">1556</span>      .setReadRequestsCount(r.getReadRequestsCount())<a name="line.1556"></a>
+<span class="sourceLineNo">1557</span>      .setFilteredReadRequestsCount(r.getFilteredReadRequestsCount())<a name="line.1557"></a>
+<span class="sourceLineNo">1558</span>      .setWriteRequestsCount(r.getWriteRequestsCount())<a name="line.1558"></a>
+<span class="sourceLineNo">1559</span>      .setTotalCompactingKVs(totalCompactingKVs)<a name="line.1559"></a>
+<span class="sourceLineNo">1560</span>      .setCurrentCompactedKVs(currentCompactedKVs)<a name="line.1560"></a>
+<span class="sourceLineNo">1561</span>      .setDataLocality(dataLocality)<a name="line.1561"></a>
+<span class="sourceLineNo">1562</span>      .setLastMajorCompactionTs(r.getOldestHfileTs(true));<a name="line.1562"></a>
+<span class="sourceLineNo">1563</span>    ((HRegion)r).setCompleteSequenceId(regionLoadBldr);<a name="line.1563"></a>
+<span class="sourceLineNo">1564</span><a name="line.1564"></a>
+<span class="sourceLineNo">1565</span>    return regionLoadBldr.build();<a name="line.1565"></a>
+<span class="sourceLineNo">1566</span>  }<a name="line.1566"></a>
+<span class="sourceLineNo">1567</span><a name="line.1567"></a>
+<span class="sourceLineNo">1568</span>  /**<a name="line.1568"></a>
+<span class="sourceLineNo">1569</span>   * @param encodedRegionName<a name="line.1569"></a>
+<span class="sourceLineNo">1570</span>   * @return An instance of RegionLoad.<a name="line.1570"></a>
+<span class="sourceLineNo">1571</span>   */<a name="line.1571"></a>
+<span class="sourceLineNo">1572</span>  public RegionLoad createRegionLoad(final String encodedRegionName) throws IOException {<a name="line.1572"></a>
+<span class="sourceLineNo">1573</span>    Region r = onlineRegions.get(encodedRegionName);<a name="line.1573"></a>
+<span class="sourceLineNo">1574</span>    return r != null ? createRegionLoad(r, null, null) : null;<a name="line.1574"></a>
+<span class="sourceLineNo">1575</span>  }<a name="line.1575"></a>
+<span class="sourceLineNo">1576</span><a name="line.1576"></a>
+<span class="sourceLineNo">1577</span>  /*<a name="line.1577"></a>
+<span class="sourceLineNo">1578</span>   * Inner class that runs on a long period checking if regions need compaction.<a name="line.1578"></a>
+<span class="sourceLineNo">1579</span>   */<a name="line.1579"></a>
+<span class="sourceLineNo">1580</span>  private static class CompactionChecker extends ScheduledChore {<a name="line.1580"></a>
+<span class="sourceLineNo">1581</span>    private final HRegionServer instance;<a name="line.1581"></a>
+<span class="sourceLineNo">1582</span>    private final int majorCompactPriority;<a name="line.1582"></a>
+<span class="sourceLineNo">1583</span>    private final static int DEFAULT_PRIORITY = Integer.MAX_VALUE;<a name="line.1583"></a>
+<span class="sourceLineNo">1584</span>    private long iteration = 0;<a name="line.1584"></a>
+<span class="sourceLineNo">1585</span><a name="line.1585"></a>
+<span class="sourceLineNo">1586</span>    CompactionChecker(final HRegionServer h, final int sleepTime,<a name="line.1586"></a>
+<span class="sourceLineNo">1587</span>        final Stoppable stopper) {<a name="line.1587"></a>
+<span class="sourceLineNo">1588</span>      super("CompactionChecker", stopper, sleepTime);<a name="line.1588"></a>
+<span class="sourceLineNo">1589</span>      this.instance = h;<a name="line.1589"></a>
+<span class="sourceLineNo">1590</span>      LOG.info(this.getName() + " runs every " + StringUtils.formatTime(sleepTime));<a name="line.1590"></a>
+<span class="sourceLineNo">1591</span><a name="line.1591"></a>
+<span class="sourceLineNo">1592</span>      /* MajorCompactPriority is configurable.<a name="line.1592"></a>
+<span class="sourceLineNo">1593</span>       * If not set, the compaction will use default priority.<a name="line.1593"></a>
+<span class="sourceLineNo">1594</span>       */<a name="line.1594"></a>
+<span class="sourceLineNo">1595</span>      this.majorCompactPriority = this.instance.conf.<a name="line.1595"></a>
+<span class="sourceLineNo">1596</span>        getInt("hbase.regionserver.compactionChecker.majorCompactPriority",<a name="line.1596"></a>
+<span class="sourceLineNo">1597</span>        DEFAULT_PRIORITY);<a name="line.1597"></a>
+<span class="sourceLineNo">1598</span>    }<a name="line.1598"></a>
+<span class="sourceLineNo">1599</span><a name="line.1599"></a>
+<span class="sourceLineNo">1600</span>    @Override<a name="line.1600"></a>
+<span class="sourceLineNo">1601</span>    protected void chore() {<a name="line.1601"></a>
+<span class="sourceLineNo">1602</span>      for (Region r : this.instance.onlineRegions.values()) {<a name="line.1602"></a>
+<span class="sourceLineNo">1603</span>        if (r == null)<a name="line.1603"></a>
+<span class="sourceLineNo">1604</span>          continue;<a name="line.1604"></a>
+<span class="sourceLineNo">1605</span>        for (Store s : r.getStores()) {<a name="line.1605"></a>
+<span class="sourceLineNo">1606</span>          try {<a name="line.1606"></a>
+<span class="sourceLineNo">1607</span>            long multiplier = s.getCompactionCheckMultiplier();<a name="line.1607"></a>
+<span class="sourceLineNo">1608</span>            assert multiplier &gt; 0;<a name="line.1608"></a>
+<span class="sourceLineNo">1609</span>            if (iteration % multiplier != 0) continue;<a name="line.1609"></a>
+<span class="sourceLineNo">1610</span>            if (s.needsCompaction()) {<a name="line.1610"></a>
+<span class="sourceLineNo">1611</span>              // Queue a compaction. Will recognize if major is needed.<a name="line.1611"></a>
+<span class="sourceLineNo">1612</span>              this.instance.compactSplitThread.requestSystemCompaction(r, s, getName()<a name="line.1612"></a>
+<span class="sourceLineNo">1613</span>                  + " requests compaction");<a name="line.1613"></a>
+<span class="sourceLineNo">1614</span>            } else if (s.isMajorCompaction()) {<a name="line.1614"></a>
+<span class="sourceLineNo">1615</span>              if (majorCompactPriority == DEFAULT_PRIORITY<a name="line.1615"></a>
+<span class="sourceLineNo">1616</span>                  || majorCompactPriority &gt; ((HRegion)r).getCompactPriority()) {<a name="line.1616"></a>
+<span class="sourceLineNo">1617</span>                this.instance.compactSplitThread.requestCompaction(r, s, getName()<a name="line.1617"></a>
+<span class="sourceLineNo">1618</span>                    + " requests major compaction; use default priority", null);<a name="line.1618"></a>
+<span class="sourceLineNo">1619</span>              } else {<a name="line.1619"></a>
+<span class="sourceLineNo">1620</span>                this.instance.compactSplitThread.requestCompaction(r, s, getName()<a name="line.1620"></a>
+<span class="sourceLineNo">1621</span>                    + " requests major compaction; use configured priority",<a name="line.1621"></a>
+<span class="sourceLineNo">1622</span>                  this.majorCompactPriority, null, null);<a name="line.1622"></a>
+<span class="sourceLineNo">1623</span>              }<a name="line.1623"></a>
+<span class="sourceLineNo">1624</span>            }<a name="line.1624"></a>
+<span class="sourceLineNo">1625</span>          } catch (IOException e) {<a name="line.1625"></a>
+<span class="sourceLineNo">1626</span>            LOG.warn("Failed major compaction check on " + r, e);<a name="line.1626"></a>
+<span class="sourceLineNo">1627</span>          }<a name="line.1627"></a>
+<span class="sourceLineNo">1628</span>        }<a name="line.1628"></a>
+<span class="sourceLineNo">1629</span>      }<a name="line.1629"></a>
+<span class="sourceLineNo">1630</span>      iteration = (iteration == Long.MAX_VALUE) ? 0 : (iteration + 1);<a name="line.1630"></a>
+<span class="sourceLineNo">1631</span>    }<a name="line.1631"></a>
+<span class="sourceLineNo">1632</span>  }<a name="line.1632"></a>
+<span class="sourceLineNo">1633</span><a name="line.1633"></a>
+<span class="sourceLineNo">1634</span>  static class PeriodicMemstoreFlusher extends ScheduledChore {<a name="line.1634"></a>
+<span class="sourceLineNo">1635</span>    final HRegionServer server;<a name="line.1635"></a>
+<span class="sourceLineNo">1636</span>    final static int RANGE_OF_DELAY = 5 * 60 * 1000; // 5 min in milliseconds<a name="line.1636"></a>
+<span class="sourceLineNo">1637</span>    final static int MIN_DELAY_TIME = 0; // millisec<a name="line.1637"></a>
+<span class="sourceLineNo">1638</span>    public PeriodicMemstoreFlusher(int cacheFlushInterval, final HRegionServer server) {<a name="line.1638"></a>
+<span class="sourceLineNo">1639</span>      super(server.getServerName() + "-MemstoreFlusherChore", server, cacheFlushInterval);<a name="line.1639"></a>
+<span class="sourceLineNo">1640</span>      this.server = server;<a name="line.1640"></a>
+<span class="sourceLineNo">1641</span>    }<a name="line.1641"></a>
+<span class="sourceLineNo">1642</span><a name="line.1642"></a>
+<span class="sourceLineNo">1643</span>    @Override<a name="line.1643"></a>
+<span class="sourceLineNo">1644</span>    protected void chore() {<a name="line.1644"></a>
+<span class="sourceLineNo">1645</span>      final StringBuffer whyFlush = new StringBuffer();<a name="line.1645"></a>
+<span class="sourceLineNo">1646</span>      for (Region r : this.server.onlineRegions.values()) {<a name="line.1646"></a>
+<span class="sourceLineNo">1647</span>        if (r == null) continue;<a name="line.1647"></a>
+<span class="sourceLineNo">1648</span>        if (((HRegion)r).shouldFlush(whyFlush)) {<a name="line.1648"></a>
+<span class="sourceLineNo">1649</span>          FlushRequester requester = server.getFlushRequester();<a name="line.1649"></a>
+<span class="sourceLineNo">1650</span>          if (requester != null) {<a name="line.1650"></a>
+<span class="sourceLineNo">1651</span>            long randomDelay = RandomUtils.nextInt(RANGE_OF_DELAY) + MIN_DELAY_TIME;<a name="line.1651"></a>
+<span class="sourceLineNo">1652</span>            LOG.info(getName() + " requesting flush of " +<a name="line.1652"></a>
+<span class="sourceLineNo">1653</span>              r.getRegionInfo().getRegionNameAsString() + " because " +<a name="line.1653"></a>
+<span class="sourceLineNo">1654</span>              whyFlush.toString() +<a name="line.1654"></a>
+<span class="sourceLineNo">1655</span>              " after random delay " + randomDelay + "ms");<a name="line.1655"></a>
+<span class="sourceLineNo">1656</span>            //Throttle the flushes by putting a delay. If we don't throttle, and there<a name="line.1656"></a>
+<span class="sourceLineNo">1657</span>            //is a balanced write-load on the regions in a table, we might end up<a name="line.1657"></a>
+<span class="sourceLineNo">1658</span>            //overwhelming the filesystem with too many flushes at once.<a name="line.1658"></a>
+<span class="sourceLineNo">1659</span>            requester.requestDelayedFlush(r, randomDelay, false);<a name="line.1659"></a>
+<span class="sourceLineNo">1660</span>          }<a name="line.1660"></a>
+<span class="sourceLineNo">1661</span>        }<a name="line.1661"></a>
+<span class="sourceLineNo">1662</span>      }<a name="line.1662"></a>
+<span class="sourceLineNo">1663</span>    }<a name="line.1663"></a>
+<span class="sourceLineNo">1664</span>  }<a name="line.1664"></a>
+<span class="sourceLineNo">1665</span><a name="line.1665"></a>
+<span class="sourceLineNo">1666</span>  /**<a name="line.1666"></a>
+<span class="sourceLineNo">1667</span>   * Report the status of the server. A server is online once all the startup is<a name="line.1667"></a>
+<span class="sourceLineNo">1668</span>   * completed (setting up filesystem, starting service threads, etc.). This<a name="line.1668"></a>
+<span class="sourceLineNo">1669</span>   * method is designed mostly to be useful in tests.<a name="line.1669"></a>
+<span class="sourceLineNo">1670</span>   *<a name="line.1670"></a>
+<span class="sourceLineNo">1671</span>   * @return true if online, false if not.<a name="line.1671"></a>
+<span class="sourceLineNo">1672</span>   */<a name="line.1672"></a>
+<span class="sourceLineNo">1673</span>  public boolean isOnline() {<a name="line.1673"></a>
+<span class="sourceLineNo">1674</span>    return online.get();<a name="line.1674"></a>
+<span class="sourceLineNo">1675</span>  }<a name="line.1675"></a>
+<span class="sourceLineNo">1676</span><a name="line.1676"></a>
+<span class="sourceLineNo">1677</span>  /**<a name="line.1677"></a>
+<span class="sourceLineNo">1678</span>   * Setup WAL log and replication if enabled.<a name="line.1678"></a>
+<span class="sourceLineNo">1679</span>   * Replication setup is done in here because it wants to be hooked up to WAL.<a name="line.1679"></a>
+<span class="sourceLineNo">1680</span>   * @return A WAL instance.<a name="line.1680"></a>
+<span class="sourceLineNo">1681</span>   * @throws IOException<a name="line.1681"></a>
+<span class="sourceLineNo">1682</span>   */<a name="line.1682"></a>
+<span class="sourceLineNo">1683</span>  private WALFactory setupWALAndReplication() throws IOException {<a name="line.1683"></a>
+<span class="sourceLineNo">1684</span>    // TODO Replication make assumptions here based on the default filesystem impl<a name="line.1684"></a>
+<span class="sourceLineNo">1685</span>    final Path oldLogDir = new Path(rootDir, HConstants.HREGION_OLDLOGDIR_NAME);<a name="line.1685"></a>
+<span class="sourceLineNo">1686</span>    final String logName = AbstractFSWALProvider.getWALDirectoryName(this.serverName.toString());<a name="line.1686"></a>
+<span class="sourceLineNo">1687</span><a name="line.1687"></a>
+<span class="sourceLineNo">1688</span>    Path logdir = new Path(rootDir, logName);<a name="line.1688"></a>
+<span class="sourceLineNo">1689</span>    if (LOG.isDebugEnabled()) LOG.debug("logdir=" + logdir);<a name="line.1689"></a>
+<span class="sourceLineNo">1690</span>    if (this.fs.exists(logdir)) {<a name="line.1690"></a>
+<span class="sourceLineNo">1691</span>      throw new RegionServerRunningException("Region server has already " +<a name="line.1691"></a>
+<span class="sourceLineNo">1692</span>        "created directory at " + this.serverName.toString());<a name="line.1692"></a>
+<span class="sourceLineNo">1693</span>    }<a name="line.1693"></a>
+<span class="sourceLineNo">1694</span><a name="line.1694"></a>
+<span class="sourceLineNo">1695</span>    // Instantiate replication manager if replication enabled.  Pass it the<a name="line.1695"></a>
+<span class="sourceLineNo">1696</span>    // log directories.<a name="line.1696"></a>
+<span class="sourceLineNo">1697</span>    createNewReplicationInstance(conf, this, this.fs, logdir, oldLogDir);<a name="line.1697"></a>
+<span class="sourceLineNo">1698</span><a name="line.1698"></a>
+<span class="sourceLineNo">1699</span>    // listeners the wal factory will add to wals it creates.<a name="line.1699"></a>
+<span class="sourceLineNo">1700</span>    final List&lt;WALActionsListener&gt; listeners = new ArrayList&lt;WALActionsListener&gt;();<a name="line.1700"></a>
+<span class="sourceLineNo">1701</span>    listeners.add(new MetricsWAL());<a name="line.1701"></a>
+<span class="sourceLineNo">1702</span>    if (this.replicationSourceHandler != null &amp;&amp;<a name="line.1702"></a>
+<span class="sourceLineNo">1703</span>        this.replicationSourceHandler.getWALActionsListener() != null) {<a name="line.1703"></a>
+<span class="sourceLineNo">1704</span>      // Replication handler is an implementation of WALActionsListener.<a name="line.1704"></a>
+<span class="sourceLineNo">1705</span>      listeners.add(this.replicationSourceHandler.getWALActionsListener());<a name="line.1705"></a>
+<span class="sourceLineNo">1706</span>    }<a name="line.1706"></a>
+<span class="sourceLineNo">1707</span><a name="line.1707"></a>
+<span class="sourceLineNo">1708</span>    return new WALFactory(conf, listeners, serverName.toString());<a name="line.1708"></a>
+<span class="sourceLineNo">1709</span>  }<a name="line.1709"></a>
+<span class="sourceLineNo">1710</span><a name="line.1710"></a>
+<span class="sourceLineNo">1711</span>  /**<a name="line.1711"></a>
+<span class="sourceLineNo">1712</span>   * We initialize the roller for the wal that handles meta lazily<a name="line.1712"></a>
+<span class="sourceLineNo">1713</span>   * since we don't know if this regionserver will handle it. All calls to<a name="line.1713"></a>
+<span class="sourceLineNo">1714</span>   * this method return a reference to the that same roller. As newly referenced<a name="line.1714"></a>
+<span class="sourceLineNo">1715</span>   * meta regions are brought online, they will be offered to the roller for maintenance.<a name="line.1715"></a>
+<span class="sourceLineNo">1716</span>   * As a part of that registration process, the roller will add itself as a<a name="line.1716"></a>
+<span class="sourceLineNo">1717</span>   * listener on the wal.<a name="line.1717"></a>
+<span class="sourceLineNo">1718</span>   */<a name="line.1718"></a>
+<span class="sourceLineNo">1719</span>  protected LogRoller ensureMetaWALRoller() {<a name="line.1719"></a>
+<span class="sourceLineNo">1720</span>    // Using a tmp log roller to ensure metaLogRoller is alive once it is not<a name="line.1720"></a>
+<span class="sourceLineNo">1721</span>    // null<a name="line.1721"></a>
+<span class="sourceLineNo">1722</span>    LogRoller roller = metawalRoller.get();<a name="line.1722"></a>
+<span class="sourceLineNo">1723</span>    if (null == roller) {<a name="line.1723"></a>
+<span class="sourceLineNo">1724</span>      LogRoller tmpLogRoller = new LogRoller(this, this);<a name="line.1724"></a>
+<span class="sourceLineNo">1725</span>      String n = Thread.currentThread().getName();<a name="line.1725"></a>
+<span class="sourceLineNo">1726</span>      Threads.setDaemonThreadRunning(tmpLogRoller.getThread(),<a name="line.1726"></a>
+<span class="sourceLineNo">1727</span>          n + "-MetaLogRoller", uncaughtExceptionHandler);<a name="line.1727"></a>
+<span class="sourceLineNo">1728</span>      if (metawalRoller.compareAndSet(null, tmpLogRoller)) {<a name="line.1728"></a>
+<span class="sourceLineNo">1729</span>        roller = tmpLogRoller;<a name="line.1729"></a>
+<span class="sourceLineNo">1730</span>      } else {<a name="line.1730"></a>
+<span class="sourceLineNo">1731</span>        // Another thread won starting the roller<a name="line.1731"></a>
+<span class="sourceLineNo">1732</span>        Threads.shutdown(tmpLogRoller.getThread());<a name="line.1732"></a>
+<span class="sourceLineNo">1733</span>        roller = metawalRoller.get();<a name="line.1733"></a>
+<span class="sourceLineNo">1734</span>      }<a name="line.1734"></a>
+<span class="sourceLineNo">1735</span>    }<a name="line.1735"></a>
+<span class="sourceLineNo">1736</span>    return roller;<a name="line.1736"></a>
+<span class="sourceLineNo">1737</span>  }<a name="line.1737"></a>
+<span class="sourceLineNo">1738</span><a name="line.1738"></a>
+<span class="sourceLineNo">1739</span>  public MetricsRegionServer getRegionServerMetrics() {<a name="line.1739"></a>
+<span class="sourceLineNo">1740</span>    return this.metricsRegionServer;<a name="line.1740"></a>
+<span class="sourceLineNo">1741</span>  }<a name="line.1741"></a>
+<span class="sourceLineNo">1742</span><a name="line.1742"></a>
+<span class="sourceLineNo">1743</span>  /**<a name="line.1743"></a>
+<span class="sourceLineNo">1744</span>   * @return Master address tracker instance.<a name="line.1744"></a>
+<span class="sourceLineNo">1745</span>   */<a name="line.1745"></a>
+<span class="sourceLineNo">1746</span>  public MasterAddressTracker getMasterAddressTracker() {<a name="line.1746"></a>
+<span class="sourceLineNo">1747</span>    return this.masterAddressTracker;<a name="line.1747"></a>
+<span class="sourceLineNo">1748</span>  }<a name="line.1748"></a>
+<span class="sourceLineNo">1749</span><a name="line.1749"></a>
+<span class="sourceLineNo">1750</span>  /*<a name="line.1750"></a>
+<span class="sourceLineNo">1751</span>   * Start maintenance Threads, Server, Worker and lease checker threads.<a name="line.1751"></a>
+<span class="sourceLineNo">1752</span>   * Install an UncaughtExceptionHandler that calls abort of RegionServer if we<a name="line.1752"></a>
+<span class="sourceLineNo">1753</span>   * get an unhandled exception. We cannot set the handler on all threads.<a name="line.1753"></a>
+<span class="sourceLineNo">1754</span>   * Server's internal Listener thread is off limits. For Server, if an OOME, it<a name="line.1754"></a>
+<span class="sourceLineNo">1755</span>   * waits a while then retries. Meantime, a flush or a compaction that tries to<a name="line.1755"></a>
+<span class="sourceLineNo">1756</span>   * run should trigger same critical condition and the shutdown will run. On<a name="line.1756"></a>
+<span class="sourceLineNo">1757</span>   * its way out, this server will shut down Server. Leases are sort of<a name="line.1757"></a>
+<span class="sourceLineNo">1758</span>   * inbetween. It has an internal thread that while it inherits from Chore, it<a name="line.1758"></a>
+<span class="sourceLineNo">1759</span>   * keeps its own internal stop mechanism so needs to be stopped by this<a name="line.1759"></a>
+<span class="sourceLineNo">1760</span>   * hosting server. Worker logs the exception and exits.<a name="line.1760"></a>
+<span class="sourceLineNo">1761</span>   */<a name="line.1761"></a>
+<span class="sourceLineNo">1762</span>  private void startServiceThreads() throws IOException {<a name="line.1762"></a>
+<span class="sourceLineNo">1763</span>    // Start executor services<a name="line.1763"></a>
+<span class="sourceLineNo">1764</span>    this.service.startExecutorService(ExecutorType.RS_OPEN_REGION,<a name="line.1764"></a>
+<span class="sourceLineNo">1765</span>      conf.getInt("hbase.regionserver.executor.openregion.threads", 3));<a name="line.1765"></a>
+<span class="sourceLineNo">1766</span>    this.service.startExecutorService(ExecutorType.RS_OPEN_META,<a name="line.1766"></a>
+<span class="sourceLineNo">1767</span>      conf.getInt("hbase.regionserver.executor.openmeta.threads", 1));<a name="line.1767"></a>
+<span class="sourceLineNo">1768</span>    this.service.startExecutorService(ExecutorType.RS_OPEN_PRIORITY_REGION,<a name="line.1768"></a>
+<span class="sourceLineNo">1769</span>      conf.getInt("hbase.regionserver.executor.openpriorityregion.threads", 3));<a name="line.1769"></a>
+<span class="sourceLineNo">1770</span>    this.service.startExecutorService(ExecutorType.RS_CLOSE_REGION,<a name="line.1770"></a>
+<span class="sourceLineNo">1771</span>      conf.getInt("hbase.regionserver.executor.closeregion.threads", 3));<a name="line.1771"></a>
+<span class="sourceLineNo">1772</span>    this.service.startExecutorService(ExecutorType.RS_CLOSE_META,<a name="line.1772"></a>
+<span class="sourceLineNo">1773</span>      conf.getInt("hbase.regionserver.executor.closemeta.threads", 1));<a name="line.1773"></a>
+<span class="sourceLineNo">1774</span>    if (conf.getBoolean(StoreScanner.STORESCANNER_PARALLEL_SEEK_ENABLE, false)) {<a name="line.1774"></a>
+<span class="sourceLineNo">1775</span>      this.service.startExecutorService(ExecutorType.RS_PARALLEL_SEEK,<a name="line.1775"></a>
+<span class="sourceLineNo">1776</span>        conf.getInt("hbase.storescanner.parallel.seek.threads", 10));<a name="line.1776"></a>
+<span class="sourceLineNo">1777</span>    }<a name="line.1777"></a>
+<span class="sourceLineNo">1778</span>    this.service.startExecutorService(ExecutorType.RS_LOG_REPLAY_OPS, conf.getInt(<a name="line.1778"></a>
+<span class="sourceLineNo">1779</span>       "hbase.regionserver.wal.max.splitters", SplitLogWorkerCoordination.DEFAULT_MAX_SPLITTERS));<a name="line.1779"></a>
+<span class="sourceLineNo">1780</span>    // Start the threads for compacted files discharger<a name="line.1780"></a>
+<span class="sourceLineNo">1781</span>    this.service.startExecutorService(ExecutorType.RS_COMPACTED_FILES_DISCHARGER,<a name="line.1781"></a>
+<span class="sourceLineNo">1782</span>      conf.getInt(CompactionConfiguration.HBASE_HFILE_COMPACTION_DISCHARGER_THREAD_COUNT, 10));<a name="line.1782"></a>
+<span class="sourceLineNo">1783</span>    if (ServerRegionReplicaUtil.isRegionReplicaWaitForPrimaryFlushEnabled(conf)) {<a name="line.1783"></a>
+<span class="sourceLineNo">1784</span>      this.service.startExecutorService(ExecutorType.RS_REGION_REPLICA_FLUSH_OPS,<a name="line.1784"></a>
+<span class="sourceLineNo">1785</span>        conf.getInt("hbase.regionserver.region.replica.flusher.threads",<a name="line.1785"></a>
+<span class="sourceLineNo">1786</span>          conf.getInt("hbase.regionserver.executor.openregion.threads", 3)));<a name="line.1786"></a>
+<span class="sourceLineNo">1787</span>    }<a name="line.1787"></a>
+<span class="sourceLineNo">1788</span><a name="line.1788"></a>
+<span class="sourceLineNo">1789</span>    Threads.setDaemonThreadRunning(this.walRoller.getThread(), getName() + ".logRoller",<a name="line.1789"></a>
+<span class="sourceLineNo">1790</span>        uncaughtExceptionHandler);<a name="line.1790"></a>
+<span class="sourceLineNo">1791</span>    this.cacheFlusher.start(uncaughtExceptionHandler);<a name="line.1791"></a>
+<span class="sourceLineNo">1792</span><a name="line.1792"></a>
+<span class="sourceLineNo">1793</span>    if (this.compactionChecker != null) choreService.scheduleChore(compactionChecker);<a name="line.1793"></a>
+<span class="sourceLineNo">1794</span>    if (this.periodicFlusher != null) choreService.scheduleChore(periodicFlusher);<a name="line.1794"></a>
+<span class="sourceLineNo">1795</span>    if (this.healthCheckChore != null) choreService.scheduleChore(healthCheckChore);<a name="line.1795"></a>
+<span class="sourceLineNo">1796</span>    if (this.nonceManagerChore != null) choreService.scheduleChore(nonceManagerChore);<a name="line.1796"></a>
+<span class="sourceLineNo">1797</span>    if (this.storefileRefresher != null) choreService.scheduleChore(storefileRefresher);<a name="line.1797"></a>
+<span class="sourceLineNo">1798</span>    if (this.movedRegionsCleaner != null) choreService.scheduleChore(movedRegionsCleaner);<a name="line.1798"></a>
 <span class="sourceLineNo">1799</span><a name="line.1799"></a>
-<span class="sourceLineNo">1800</span>    if (this.replicationSourceHandler == this.replicationSinkHandler &amp;&amp;<a name="line.1800"></a>
-<span class="sourceLineNo">1801</span>        this.replicationSourceHandler != null) {<a name="line.1801"></a>
-<span class="sourceLineNo">1802</span>      this.replicationSourceHandler.startReplicationService();<a name="line.1802"></a>
-<span class="sourceLineNo">1803</span>    } else {<a name="line.1803"></a>
-<span class="sourceLineNo">1804</span>      if (this.replicationSourceHandler != null) {<a name="line.1804"></a>
-<span class="sourceLineNo">1805</span>        this.replicationSourceHandler.startReplicationService();<a name="line.1805"></a>
-<span class="sourceLineNo">1806</span>      }<a name="line.1806"></a>
-<span class="sourceLineNo">1807</span>      if (this.replicationSinkHandler != null) {<a name="line.1807"></a>
-<span class="sourceLineNo">1808</span>        this.replicationSinkHandler.startReplicationService();<a name="line.1808"></a>
-<span class="sourceLineNo">1809</span>      }<a name="line.1809"></a>
-<span class="sourceLineNo">1810</span>    }<a name="line.1810"></a>
-<span class="sourceLineNo">1811</span><a name="line.1811"></a>
-<span class="sourceLineNo">1812</span>    // Create the log splitting worker and start it<a name="line.1812"></a>
-<span class="sourceLineNo">1813</span>    // set a smaller retries to fast fail otherwise splitlogworker could be blocked for<a name="line.1813"></a>
-<span class="sourceLineNo">1814</span>    // quite a while inside Connection layer. The worker won't be available for other<a name="line.1814"></a>
-<span class="sourceLineNo">1815</span>    // tasks even after current task is preempted after a split task times out.<a name="line.1815"></a>
-<span class="sourceLineNo">1816</span>    Configuration sinkConf = HBaseConfiguration.create(conf);<a name="line.1816"></a>
-<span class="sourceLineNo">1817</span>    sinkConf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER,<a name="line.1817"></a>
-<span class="sourceLineNo">1818</span>      conf.getInt("hbase.log.replay.retries.number", 8)); // 8 retries take about 23 seconds<a name="line.1818"></a>
-<span class="sourceLineNo">1819</span>    sinkConf.setInt(HConstants.HBASE_RPC_TIMEOUT_KEY,<a name="line.1819"></a>
-<span class="sourceLineNo">1820</span>      conf.getInt("hbase.log.replay.rpc.timeout", 30000)); // default 30 seconds<a name="line.1820"></a>
-<span class="sourceLineNo">1821</span>    sinkConf.setInt("hbase.client.serverside.retries.multiplier", 1);<a name="line.1821"></a>
-<span class="sourceLineNo">1822</span>    this.splitLogWorker = new SplitLogWorker(this, sinkConf, this, this, walFactory);<a name="line.1822"></a>
-<span class="sourceLineNo">1823</span>    splitLogWorker.start();<a name="line.1823"></a>
-<span class="sourceLineNo">1824</span>  }<a name="line.1824"></a>
-<span class="sourceLineNo">1825</span><a name="line.1825"></a>
-<span class="sourceLineNo">1826</span>  /**<a name="line.1826"></a>
-<span class="sourceLineNo">1827</span>   * Puts up the webui.<a name="line.1827"></a>
-<span class="sourceLineNo">1828</span>   * @return Returns final port -- maybe different from what we started with.<a name="line.1828"></a>
-<span class="sourceLineNo">1829</span>   * @throws IOException<a name="line.1829"></a>
-<span class="sourceLineNo">1830</span>   */<a name="line.1830"></a>
-<span class="sourceLineNo">1831</span>  private int putUpWebUI() throws IOException {<a name="line.1831"></a>
-<span class="sourceLineNo">1832</span>    int port = this.conf.getInt(HConstants.REGIONSERVER_INFO_PORT,<a name="line.1832"></a>
-<span class="sourceLineNo">1833</span>      HConstants.DEFAULT_REGIONSERVER_INFOPORT);<a name="line.1833"></a>
-<span class="sourceLineNo">1834</span>    String addr = this.conf.get("hbase.regionserver.info.bindAddress", "0.0.0.0");<a name="line.1834"></a>
-<span class="sourceLineNo">1835</span><a name="line.1835"></a>
-<span class="sourceLineNo">1836</span>    if(this instanceof HMaster) {<a name="line.1836"></a>
-<span class="sourceLineNo">1837</span>      port = conf.getInt(HConstants.MASTER_INFO_PORT,<a name="line.1837"></a>
-<span class="sourceLineNo">1838</span>          HConstants.DEFAULT_MASTER_INFOPORT);<a name="line.1838"></a>
-<span class="sourceLineNo">1839</span>      addr = this.conf.get("hbase.master.info.bindAddress", "0.0.0.0");<a name="line.1839"></a>
-<span class="sourceLineNo">1840</span>    }<a name="line.1840"></a>
-<span class="sourceLineNo">1841</span>    // -1 is for disabling info server<a name="line.1841"></a>
-<span class="sourceLineNo">1842</span>    if (port &lt; 0) return port;<a name="line.1842"></a>
-<span class="sourceLineNo">1843</span><a name="line.1843"></a>
-<span class="sourceLineNo">1844</span>    if (!Addressing.isLocalAddress(InetAddress.getByName(addr))) {<a name="line.1844"></a>
-<span class="sourceLineNo">1845</span>      String msg =<a name="line.1845"></a>
-<span class="sourceLineNo">1846</span>          "Failed to start http info server. Address " + addr<a name="line.1846"></a>
-<span class="sourceLineNo">1847</span>              + " does not belong to this host. Correct configuration parameter: "<a name="line.1847"></a>
-<span class="sourceLineNo">1848</span>              + "hbase.regionserver.info.bindAddress";<a name="line.1848"></a>
-<span class="sourceLineNo">1849</span>      LOG.error(msg);<a name="line.1849"></a>
-<span class="sourceLineNo">1850</span>      throw new IOException(msg);<a name="line.1850"></a>
-<span class="sourceLineNo">1851</span>    }<a name="line.1851"></a>
-<span class="sourceLineNo">1852</span>    // check if auto port bind enabled<a name="line.1852"></a>
-<span class="sourceLineNo">1853</span>    boolean auto = this.conf.getBoolean(HConstants.REGIONSERVER_INFO_PORT_AUTO,<a name="line.1853"></a>
-<span class="sourceLineNo">1854</span>        false);<a name="line.1854"></a>
-<span class="sourceLineNo">1855</span>    while (true) {<a name="line.1855"></a>
-<span class="sourceLineNo">1856</span>      try {<a name="line.1856"></a>
-<span class="sourceLineNo">1857</span>        this.infoServer = new InfoServer(getProcessName(), addr, port, false, this.conf);<a name="line.1857"></a>
-<span class="sourceLineNo">1858</span>        infoServer.addServlet("dump", "/dump", getDumpServlet());<a name="line.1858"></a>
-<span class="sourceLineNo">1859</span>        configureInfoServer();<a name="line.1859"></a>
-<span class="sourceLineNo">1860</span>        this.infoServer.start();<a name="line.1860"></a>
-<span class="sourceLineNo">1861</span>        break;<a name="line.1861"></a>
-<span class="sourceLineNo">1862</span>      } catch (BindException e) {<a name="line.1862"></a>
-<span class="sourceLineNo">1863</span>        if (!auto) {<a name="line.1863"></a>
-<span class="sourceLineNo">1864</span>          // auto bind disabled throw BindException<a name="line.1864"></a>
-<span class="sourceLineNo">1865</span>          LOG.error("Failed binding http info server to port: " + port);<a name="line.1865"></a>
-<span class="sourceLineNo">1866</span>          throw e;<a name="line.1866"></a>
-<span class="sourceLineNo">1867</span>        }<a name="line.1867"></a>
-<span class="sourceLineNo">1868</span>        // auto bind enabled, try to use another port<a name="line.1868"></a>
-<span class="sourceLineNo">1869</span>        LOG.info("Failed binding http info server to port: " + port);<a name="line.1869"></a>
-<span class="sourceLineNo">1870</span>        port++;<a name="line.1870"></a>
-<span class="sourceLineNo">1871</span>      }<a name="line.1871"></a>
-<span class="sourceLineNo">1872</span>    }<a name="line.1872"></a>
-<span class="sourceLineNo">1873</span>    port = this.infoServer.getPort();<a name="line.1873"></a>
-<span class="sourceLineNo">1874</span>    conf.setInt(HConstants.REGIONSERVER_INFO_PORT, port);<a name="line.1874"></a>
-<span class="sourceLineNo">1875</span>    int masterInfoPort = conf.getInt(HConstants.MASTER_INFO_PORT,<a name="line.1875"></a>
-<span class="sourceLineNo">1876</span>      HConstants.DEFAULT_MASTER_INFOPORT);<a name="line.1876"></a>
-<span class="sourceLineNo">1877</span>    conf.setInt("hbase.master.info.port.orig", masterInfoPort);<a name="line.1877"></a>
-<span class="sourceLineNo">1878</span>    conf.setInt(HConstants.MASTER_INFO_PORT, port);<a name="line.1878"></a>
-<span class="sourceLineNo">1879</span>    return port;<a name="line.1879"></a>
-<span class="sourceLineNo">1880</span>  }<a name="line.1880"></a>
-<span class="sourceLineNo">1881</span><a name="line.1881"></a>
-<span class="sourceLineNo">1882</span>  /*<a name="line.1882"></a>
-<span class="sourceLineNo">1883</span>   * Verify that server is healthy<a name="line.1883"></a>
-<span class="sourceLineNo">1884</span>   */<a name="line.1884"></a>
-<span class="sourceLineNo">1885</span>  private boolean isHealthy() {<a name="line.1885"></a>
-<span class="sourceLineNo">1886</span>    if (!fsOk) {<a name="line.1886"></a>
-<span class="sourceLineNo">1887</span>      // File system problem<a name="line.1887"></a>
-<span class="sourceLineNo">1888</span>      return false;<a name="line.1888"></a>
-<span class="sourceLineNo">1889</span>    }<a name="line.1889"></a>
-<span class="sourceLineNo">1890</span>    // Verify that all threads are alive<a name="line.1890"></a>
-<span class="sourceLineNo">1891</span>    if (!(leases.isAlive()<a name="line.1891"></a>
-<span class="sourceLineNo">1892</span>        &amp;&amp; cacheFlusher.isAlive() &amp;&amp; walRoller.isAlive()<a name="line.1892"></a>
-<span class="sourceLineNo">1893</span>        &amp;&amp; this.compactionChecker.isScheduled()<a name="line.1893"></a>
-<span class="sourceLineNo">1894</span>        &amp;&amp; this.periodicFlusher.isScheduled())) {<a name="line.1894"></a>
-<span class="sourceLineNo">1895</span>      stop("One or more threads are no longer alive -- stop");<a name="line.1895"></a>
-<span class="sourceLineNo">1896</span>      return false;<a name="line.1896"></a>
-<span class="sourceLineNo">1897</span>    }<a name="line.1897"></a>
-<span class="sourceLineNo">1898</span>    final LogRoller metawalRoller = this.metawalRoller.get();<a name="line.1898"></a>
-<span class="sourceLineNo">1899</span>    if (metawalRoller != null &amp;&amp; !metawalRoller.isAlive()) {<a name="line.1899"></a>
-<span class="sourceLineNo">1900</span>      stop("Meta WAL roller thread is no longer alive -- stop");<a name="line.1900"></a>
+<span class="sourceLineNo">1800</span>    // Leases is not a Thread. Internally it runs a daemon thread. If it gets<a name="line.1800"></a>
+<span class="sourceLineNo">1801</span>    // an unhandled exception, it will just exit.<a name="line.1801"></a>
+<span class="sourceLineNo">1802</span>    Threads.setDaemonThreadRunning(this.leases.getThread(), getName() + ".leaseChecker",<a name="line.1802"></a>
+<span class="sourceLineNo">1803</span>      uncaughtExceptionHandler);<a name="line.1803"></a>
+<span class="sourceLineNo">1804</span><a name="line.1804"></a>
+<span class="sourceLineNo">1805</span>    if (this.replicationSourceHandler == this.replicationSinkHandler &amp;&amp;<a name="line.1805"></a>
+<span class="sourceLineNo">1806</span>        this.replicationSourceHandler != null) {<a name="line.1806"></a>
+<span class="sourceLineNo">1807</span>      this.replicationSourceHandler.startReplicationService();<a name="line.1807"></a>
+<span class="sourceLineNo">1808</span>    } else {<a name="line.1808"></a>
+<span class="sourceLineNo">1809</span>      if (this.replicationSourceHandler != null) {<a name="line.1809"></a>
+<span class="sourceLineNo">1810</span>        this.replicationSourceHandler.startReplicationService();<a name="line.1810"></a>
+<span class="sourceLineNo">1811</span>      }<a name="line.1811"></a>
+<span class="sourceLineNo">1812</span>      if (this.replicationSinkHandler != null) {<a name="line.1812"></a>
+<span class="sourceLineNo">1813</span>        this.replicationSinkHandler.startReplicationService();<a name="line.1813"></a>
+<span class="sourceLineNo">1814</span>      }<a name="line.1814"></a>
+<span class="sourceLineNo">1815</span>    }<a name="line.1815"></a>
+<span class="sourceLineNo">1816</span><a name="line.1816"></a>
+<span class="sourceLineNo">1817</span>    // Create the log splitting worker and start it<a name="line.1817"></a>
+<span class="sourceLineNo">1818</span>    // set a smaller retries to fast fail otherwise splitlogworker could be blocked for<a name="line.1818"></a>
+<span class="sourceLineNo">1819</span>    // quite a while inside Connection layer. The worker won't be available for other<a name="line.1819"></a>
+<span class="sourceLineNo">1820</span>    // tasks even after current task is preempted after a split task times out.<a name="line.1820"></a>
+<span class="sourceLineNo">1821</span>    Configuration sinkConf = HBaseConfiguration.create(conf);<a name="line.1821"></a>
+<span class="sourceLineNo">1822</span>    sinkConf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER,<a name="line.1822"></a>
+<span class="sourceLineNo">1823</span>      conf.getInt("hbase.log.replay.retries.number", 8)); // 8 retries take about 23 seconds<a name="line.1823"></a>
+<span class="sourceLineNo">1824</span>    sinkConf.setInt(HConstants.HBASE_RPC_TIMEOUT_KEY,<a name="line.1824"></a>
+<span class="sourceLineNo">1825</span>      conf.getInt("hbase.log.replay.rpc.timeout", 30000)); // default 30 seconds<a name="line.1825"></a>
+<span class="sourceLineNo">1826</span>    sinkConf.setInt("hbase.client.serverside.retries.multiplier", 1);<a name="line.1826"></a>
+<span class="sourceLineNo">1827</span>    this.splitLogWorker = new SplitLogWorker(this, sinkConf, this, this, walFactory);<a name="line.1827"></a>
+<span class="sourceLineNo">1828</span>    splitLogWorker.start();<a name="line.1828"></a>
+<span class="sourceLineNo">1829</span>  }<a name="line.1829"></a>
+<span class="sourceLineNo">1830</span><a name="line.1830"></a>
+<span class="sourceLineNo">1831</span>  /**<a name="line.1831"></a>
+<span class="sourceLineNo">1832</span>   * Puts up the webui.<a name="line.1832"></a>
+<span class="sourceLineNo">1833</span>   * @return Returns final port -- maybe different from what we started with.<a name="line.1833"></a>
+<span class="sourceLineNo">1834</span>   * @throws IOException<a name="line.1834"></a>
+<span class="sourceLineNo">1835</span>   */<a name="line.1835"></a>
+<span class="sourceLineNo">1836</span>  private int putUpWebUI() throws IOException {<a name="line.1836"></a>
+<span class="sourceLineNo">1837</span>    int port = this.conf.getInt(HConstants.REGIONSERVER_INFO_PORT,<a name="line.1837"></a>
+<span class="sourceLineNo">1838</span>      HConstants.DEFAULT_REGIONSERVER_INFOPORT);<a name="line.1838"></a>
+<span class="sourceLineNo">1839</span>    String addr = this.conf.get("hbase.regionserver.info.bindAddress", "0.0.0.0");<a name="line.1839"></a>
+<span class="sourceLineNo">1840</span><a name="line.1840"></a>
+<span class="sourceLineNo">1841</span>    if(this instanceof HMaster) {<a name="line.1841"></a>
+<span class="sourceLineNo">1842</span>      port = conf.getInt(HConstants.MASTER_INFO_PORT,<a name="line.1842"></a>
+<span class="sourceLineNo">1843</span>          HConstants.DEFAULT_MASTER_INFOPORT);<a name="line.1843"></a>
+<span class="sourceLineNo">1844</span>      addr = this.conf.get("hbase.master.info.bindAddress", "0.0.0.0");<a name="line.1844"></a>
+<span class="sourceLineNo">1845</span>    }<a name="line.1845"></a>
+<span class="sourceLineNo">1846</span>    // -1 is for disabling info server<a name="line.1846"></a>
+<span class="sourceLineNo">1847</span>    if (port &lt; 0) return port;<a name="line.1847"></a>
+<span class="sourceLineNo">1848</span><a name="line.1848"></a>
+<span class="sourceLineNo">1849</span>    if (!Addressing.isLocalAddress(InetAddress.getByName(addr))) {<a name="line.1849"></a>
+<span class="sourceLineNo">1850</span>      String msg =<a name="line.1850"></a>
+<span class="sourceLineNo">1851</span>          "Failed to start http info server. Address " + addr<a name="line.1851"></a>
+<span class="sourceLineNo">1852</span>              + " does not belong to this host. Correct configuration parameter: "<a name="line.1852"></a>
+<span class="sourceLineNo">1853</span>              + "hbase.regionserver.info.bindAddress";<a name="line.1853"></a>
+<span class="sourceLineNo">1854</span>      LOG.error(msg);<a name="line.1854"></a>
+<span class="sourceLineNo">1855</span>      throw new IOException(msg);<a name="line.1855"></a>
+<span class="sourceLineNo">1856</span>    }<a name="line.1856"></a>
+<span class="sourceLineNo">1857</span>    // check if auto port bind enabled<a name="line.1857"></a>
+<span class="sourceLineNo">1858</span>    boolean auto = this.conf.getBoolean(HConstants.REGIONSERVER_INFO_PORT_AUTO,<a name="line.1858"></a>
+<span class="sourceLineNo">1859</span>        false);<a name="line.1859"></a>
+<span class="sourceLineNo">1860</span>    while (true) {<a name="line.1860"></a>
+<span class="sourceLineNo">1861</span>      try {<a name="line.1861"></a>
+<span class="sourceLineNo">1862</span>        this.infoServer = new InfoServer(getProcessName(), addr, port, false, this.conf);<a name="line.1862"></a>
+<span class="sourceLineNo">1863</span>        infoServer.addServlet("dump", "/dump", getDumpServl

<TRUNCATED>

Mime
View raw message