hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From git-site-r...@apache.org
Subject [03/51] [partial] hbase-site git commit: Published site at .
Date Mon, 23 Oct 2017 15:16:05 GMT
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/41a7fcc5/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/HStore.StoreFlusherImpl.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/HStore.StoreFlusherImpl.html b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/HStore.StoreFlusherImpl.html
index 7e5e128..5bc0a56 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/HStore.StoreFlusherImpl.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/HStore.StoreFlusherImpl.html
@@ -1633,951 +1633,954 @@
 <span class="sourceLineNo">1625</span>    return StoreUtils.hasReferences(this.storeEngine.getStoreFileManager().getStorefiles());<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>  @Override<a name="line.1628"></a>
-<span class="sourceLineNo">1629</span>  public CompactionProgress getCompactionProgress() {<a name="line.1629"></a>
-<span class="sourceLineNo">1630</span>    return this.storeEngine.getCompactor().getProgress();<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>  @Override<a name="line.1633"></a>
-<span class="sourceLineNo">1634</span>  public boolean shouldPerformMajorCompaction() throws IOException {<a name="line.1634"></a>
-<span class="sourceLineNo">1635</span>    for (HStoreFile sf : this.storeEngine.getStoreFileManager().getStorefiles()) {<a name="line.1635"></a>
-<span class="sourceLineNo">1636</span>      // TODO: what are these reader checks all over the place?<a name="line.1636"></a>
-<span class="sourceLineNo">1637</span>      if (sf.getReader() == null) {<a name="line.1637"></a>
-<span class="sourceLineNo">1638</span>        LOG.debug("StoreFile " + sf + " has null Reader");<a name="line.1638"></a>
-<span class="sourceLineNo">1639</span>        return false;<a name="line.1639"></a>
-<span class="sourceLineNo">1640</span>      }<a name="line.1640"></a>
-<span class="sourceLineNo">1641</span>    }<a name="line.1641"></a>
-<span class="sourceLineNo">1642</span>    return storeEngine.getCompactionPolicy().shouldPerformMajorCompaction(<a name="line.1642"></a>
-<span class="sourceLineNo">1643</span>        this.storeEngine.getStoreFileManager().getStorefiles());<a name="line.1643"></a>
-<span class="sourceLineNo">1644</span>  }<a name="line.1644"></a>
-<span class="sourceLineNo">1645</span><a name="line.1645"></a>
-<span class="sourceLineNo">1646</span>  public Optional&lt;CompactionContext&gt; requestCompaction() throws IOException {<a name="line.1646"></a>
-<span class="sourceLineNo">1647</span>    return requestCompaction(NO_PRIORITY, CompactionLifeCycleTracker.DUMMY, null);<a name="line.1647"></a>
-<span class="sourceLineNo">1648</span>  }<a name="line.1648"></a>
-<span class="sourceLineNo">1649</span><a name="line.1649"></a>
-<span class="sourceLineNo">1650</span>  public Optional&lt;CompactionContext&gt; requestCompaction(int priority,<a name="line.1650"></a>
-<span class="sourceLineNo">1651</span>      CompactionLifeCycleTracker tracker, User user) throws IOException {<a name="line.1651"></a>
-<span class="sourceLineNo">1652</span>    // don't even select for compaction if writes are disabled<a name="line.1652"></a>
-<span class="sourceLineNo">1653</span>    if (!this.areWritesEnabled()) {<a name="line.1653"></a>
-<span class="sourceLineNo">1654</span>      return Optional.empty();<a name="line.1654"></a>
-<span class="sourceLineNo">1655</span>    }<a name="line.1655"></a>
-<span class="sourceLineNo">1656</span>    // Before we do compaction, try to get rid of unneeded files to simplify things.<a name="line.1656"></a>
-<span class="sourceLineNo">1657</span>    removeUnneededFiles();<a name="line.1657"></a>
-<span class="sourceLineNo">1658</span><a name="line.1658"></a>
-<span class="sourceLineNo">1659</span>    final CompactionContext compaction = storeEngine.createCompaction();<a name="line.1659"></a>
-<span class="sourceLineNo">1660</span>    CompactionRequestImpl request = null;<a name="line.1660"></a>
-<span class="sourceLineNo">1661</span>    this.lock.readLock().lock();<a name="line.1661"></a>
-<span class="sourceLineNo">1662</span>    try {<a name="line.1662"></a>
-<span class="sourceLineNo">1663</span>      synchronized (filesCompacting) {<a name="line.1663"></a>
-<span class="sourceLineNo">1664</span>        // First, see if coprocessor would want to override selection.<a name="line.1664"></a>
-<span class="sourceLineNo">1665</span>        if (this.getCoprocessorHost() != null) {<a name="line.1665"></a>
-<span class="sourceLineNo">1666</span>          final List&lt;HStoreFile&gt; candidatesForCoproc = compaction.preSelect(this.filesCompacting);<a name="line.1666"></a>
-<span class="sourceLineNo">1667</span>          boolean override = false;<a name="line.1667"></a>
-<span class="sourceLineNo">1668</span>          //TODO: is it correct way to get CompactionRequest?<a name="line.1668"></a>
-<span class="sourceLineNo">1669</span>          override = getCoprocessorHost().preCompactSelection(this, candidatesForCoproc,<a name="line.1669"></a>
-<span class="sourceLineNo">1670</span>            tracker, user);<a name="line.1670"></a>
-<span class="sourceLineNo">1671</span>          if (override) {<a name="line.1671"></a>
-<span class="sourceLineNo">1672</span>            // Coprocessor is overriding normal file selection.<a name="line.1672"></a>
-<span class="sourceLineNo">1673</span>            compaction.forceSelect(new CompactionRequestImpl(candidatesForCoproc));<a name="line.1673"></a>
-<span class="sourceLineNo">1674</span>          }<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>        // Normal case - coprocessor is not overriding file selection.<a name="line.1677"></a>
-<span class="sourceLineNo">1678</span>        if (!compaction.hasSelection()) {<a name="line.1678"></a>
-<span class="sourceLineNo">1679</span>          boolean isUserCompaction = priority == Store.PRIORITY_USER;<a name="line.1679"></a>
-<span class="sourceLineNo">1680</span>          boolean mayUseOffPeak = offPeakHours.isOffPeakHour() &amp;&amp;<a name="line.1680"></a>
-<span class="sourceLineNo">1681</span>              offPeakCompactionTracker.compareAndSet(false, true);<a name="line.1681"></a>
-<span class="sourceLineNo">1682</span>          try {<a name="line.1682"></a>
-<span class="sourceLineNo">1683</span>            compaction.select(this.filesCompacting, isUserCompaction,<a name="line.1683"></a>
-<span class="sourceLineNo">1684</span>              mayUseOffPeak, forceMajor &amp;&amp; filesCompacting.isEmpty());<a name="line.1684"></a>
-<span class="sourceLineNo">1685</span>          } catch (IOException e) {<a name="line.1685"></a>
-<span class="sourceLineNo">1686</span>            if (mayUseOffPeak) {<a name="line.1686"></a>
-<span class="sourceLineNo">1687</span>              offPeakCompactionTracker.set(false);<a name="line.1687"></a>
-<span class="sourceLineNo">1688</span>            }<a name="line.1688"></a>
-<span class="sourceLineNo">1689</span>            throw e;<a name="line.1689"></a>
-<span class="sourceLineNo">1690</span>          }<a name="line.1690"></a>
-<span class="sourceLineNo">1691</span>          assert compaction.hasSelection();<a name="line.1691"></a>
-<span class="sourceLineNo">1692</span>          if (mayUseOffPeak &amp;&amp; !compaction.getRequest().isOffPeak()) {<a name="line.1692"></a>
-<span class="sourceLineNo">1693</span>            // Compaction policy doesn't want to take advantage of off-peak.<a name="line.1693"></a>
-<span class="sourceLineNo">1694</span>            offPeakCompactionTracker.set(false);<a name="line.1694"></a>
-<span class="sourceLineNo">1695</span>          }<a name="line.1695"></a>
-<span class="sourceLineNo">1696</span>        }<a name="line.1696"></a>
-<span class="sourceLineNo">1697</span>        if (this.getCoprocessorHost() != null) {<a name="line.1697"></a>
-<span class="sourceLineNo">1698</span>          this.getCoprocessorHost().postCompactSelection(<a name="line.1698"></a>
-<span class="sourceLineNo">1699</span>              this, ImmutableList.copyOf(compaction.getRequest().getFiles()), tracker,<a name="line.1699"></a>
-<span class="sourceLineNo">1700</span>              compaction.getRequest(), user);<a name="line.1700"></a>
-<span class="sourceLineNo">1701</span>        }<a name="line.1701"></a>
-<span class="sourceLineNo">1702</span>        // Finally, we have the resulting files list. Check if we have any files at all.<a name="line.1702"></a>
-<span class="sourceLineNo">1703</span>        request = compaction.getRequest();<a name="line.1703"></a>
-<span class="sourceLineNo">1704</span>        Collection&lt;HStoreFile&gt; selectedFiles = request.getFiles();<a name="line.1704"></a>
-<span class="sourceLineNo">1705</span>        if (selectedFiles.isEmpty()) {<a name="line.1705"></a>
-<span class="sourceLineNo">1706</span>          return Optional.empty();<a name="line.1706"></a>
-<span class="sourceLineNo">1707</span>        }<a name="line.1707"></a>
-<span class="sourceLineNo">1708</span><a name="line.1708"></a>
-<span class="sourceLineNo">1709</span>        addToCompactingFiles(selectedFiles);<a name="line.1709"></a>
-<span class="sourceLineNo">1710</span><a name="line.1710"></a>
-<span class="sourceLineNo">1711</span>        // If we're enqueuing a major, clear the force flag.<a name="line.1711"></a>
-<span class="sourceLineNo">1712</span>        this.forceMajor = this.forceMajor &amp;&amp; !request.isMajor();<a name="line.1712"></a>
+<span class="sourceLineNo">1628</span>  /**<a name="line.1628"></a>
+<span class="sourceLineNo">1629</span>   * getter for CompactionProgress object<a name="line.1629"></a>
+<span class="sourceLineNo">1630</span>   * @return CompactionProgress object; can be null<a name="line.1630"></a>
+<span class="sourceLineNo">1631</span>   */<a name="line.1631"></a>
+<span class="sourceLineNo">1632</span>  public CompactionProgress getCompactionProgress() {<a name="line.1632"></a>
+<span class="sourceLineNo">1633</span>    return this.storeEngine.getCompactor().getProgress();<a name="line.1633"></a>
+<span class="sourceLineNo">1634</span>  }<a name="line.1634"></a>
+<span class="sourceLineNo">1635</span><a name="line.1635"></a>
+<span class="sourceLineNo">1636</span>  @Override<a name="line.1636"></a>
+<span class="sourceLineNo">1637</span>  public boolean shouldPerformMajorCompaction() throws IOException {<a name="line.1637"></a>
+<span class="sourceLineNo">1638</span>    for (HStoreFile sf : this.storeEngine.getStoreFileManager().getStorefiles()) {<a name="line.1638"></a>
+<span class="sourceLineNo">1639</span>      // TODO: what are these reader checks all over the place?<a name="line.1639"></a>
+<span class="sourceLineNo">1640</span>      if (sf.getReader() == null) {<a name="line.1640"></a>
+<span class="sourceLineNo">1641</span>        LOG.debug("StoreFile " + sf + " has null Reader");<a name="line.1641"></a>
+<span class="sourceLineNo">1642</span>        return false;<a name="line.1642"></a>
+<span class="sourceLineNo">1643</span>      }<a name="line.1643"></a>
+<span class="sourceLineNo">1644</span>    }<a name="line.1644"></a>
+<span class="sourceLineNo">1645</span>    return storeEngine.getCompactionPolicy().shouldPerformMajorCompaction(<a name="line.1645"></a>
+<span class="sourceLineNo">1646</span>        this.storeEngine.getStoreFileManager().getStorefiles());<a name="line.1646"></a>
+<span class="sourceLineNo">1647</span>  }<a name="line.1647"></a>
+<span class="sourceLineNo">1648</span><a name="line.1648"></a>
+<span class="sourceLineNo">1649</span>  public Optional&lt;CompactionContext&gt; requestCompaction() throws IOException {<a name="line.1649"></a>
+<span class="sourceLineNo">1650</span>    return requestCompaction(NO_PRIORITY, CompactionLifeCycleTracker.DUMMY, null);<a name="line.1650"></a>
+<span class="sourceLineNo">1651</span>  }<a name="line.1651"></a>
+<span class="sourceLineNo">1652</span><a name="line.1652"></a>
+<span class="sourceLineNo">1653</span>  public Optional&lt;CompactionContext&gt; requestCompaction(int priority,<a name="line.1653"></a>
+<span class="sourceLineNo">1654</span>      CompactionLifeCycleTracker tracker, User user) throws IOException {<a name="line.1654"></a>
+<span class="sourceLineNo">1655</span>    // don't even select for compaction if writes are disabled<a name="line.1655"></a>
+<span class="sourceLineNo">1656</span>    if (!this.areWritesEnabled()) {<a name="line.1656"></a>
+<span class="sourceLineNo">1657</span>      return Optional.empty();<a name="line.1657"></a>
+<span class="sourceLineNo">1658</span>    }<a name="line.1658"></a>
+<span class="sourceLineNo">1659</span>    // Before we do compaction, try to get rid of unneeded files to simplify things.<a name="line.1659"></a>
+<span class="sourceLineNo">1660</span>    removeUnneededFiles();<a name="line.1660"></a>
+<span class="sourceLineNo">1661</span><a name="line.1661"></a>
+<span class="sourceLineNo">1662</span>    final CompactionContext compaction = storeEngine.createCompaction();<a name="line.1662"></a>
+<span class="sourceLineNo">1663</span>    CompactionRequestImpl request = null;<a name="line.1663"></a>
+<span class="sourceLineNo">1664</span>    this.lock.readLock().lock();<a name="line.1664"></a>
+<span class="sourceLineNo">1665</span>    try {<a name="line.1665"></a>
+<span class="sourceLineNo">1666</span>      synchronized (filesCompacting) {<a name="line.1666"></a>
+<span class="sourceLineNo">1667</span>        // First, see if coprocessor would want to override selection.<a name="line.1667"></a>
+<span class="sourceLineNo">1668</span>        if (this.getCoprocessorHost() != null) {<a name="line.1668"></a>
+<span class="sourceLineNo">1669</span>          final List&lt;HStoreFile&gt; candidatesForCoproc = compaction.preSelect(this.filesCompacting);<a name="line.1669"></a>
+<span class="sourceLineNo">1670</span>          boolean override = false;<a name="line.1670"></a>
+<span class="sourceLineNo">1671</span>          //TODO: is it correct way to get CompactionRequest?<a name="line.1671"></a>
+<span class="sourceLineNo">1672</span>          override = getCoprocessorHost().preCompactSelection(this, candidatesForCoproc,<a name="line.1672"></a>
+<span class="sourceLineNo">1673</span>            tracker, user);<a name="line.1673"></a>
+<span class="sourceLineNo">1674</span>          if (override) {<a name="line.1674"></a>
+<span class="sourceLineNo">1675</span>            // Coprocessor is overriding normal file selection.<a name="line.1675"></a>
+<span class="sourceLineNo">1676</span>            compaction.forceSelect(new CompactionRequestImpl(candidatesForCoproc));<a name="line.1676"></a>
+<span class="sourceLineNo">1677</span>          }<a name="line.1677"></a>
+<span class="sourceLineNo">1678</span>        }<a name="line.1678"></a>
+<span class="sourceLineNo">1679</span><a name="line.1679"></a>
+<span class="sourceLineNo">1680</span>        // Normal case - coprocessor is not overriding file selection.<a name="line.1680"></a>
+<span class="sourceLineNo">1681</span>        if (!compaction.hasSelection()) {<a name="line.1681"></a>
+<span class="sourceLineNo">1682</span>          boolean isUserCompaction = priority == Store.PRIORITY_USER;<a name="line.1682"></a>
+<span class="sourceLineNo">1683</span>          boolean mayUseOffPeak = offPeakHours.isOffPeakHour() &amp;&amp;<a name="line.1683"></a>
+<span class="sourceLineNo">1684</span>              offPeakCompactionTracker.compareAndSet(false, true);<a name="line.1684"></a>
+<span class="sourceLineNo">1685</span>          try {<a name="line.1685"></a>
+<span class="sourceLineNo">1686</span>            compaction.select(this.filesCompacting, isUserCompaction,<a name="line.1686"></a>
+<span class="sourceLineNo">1687</span>              mayUseOffPeak, forceMajor &amp;&amp; filesCompacting.isEmpty());<a name="line.1687"></a>
+<span class="sourceLineNo">1688</span>          } catch (IOException e) {<a name="line.1688"></a>
+<span class="sourceLineNo">1689</span>            if (mayUseOffPeak) {<a name="line.1689"></a>
+<span class="sourceLineNo">1690</span>              offPeakCompactionTracker.set(false);<a name="line.1690"></a>
+<span class="sourceLineNo">1691</span>            }<a name="line.1691"></a>
+<span class="sourceLineNo">1692</span>            throw e;<a name="line.1692"></a>
+<span class="sourceLineNo">1693</span>          }<a name="line.1693"></a>
+<span class="sourceLineNo">1694</span>          assert compaction.hasSelection();<a name="line.1694"></a>
+<span class="sourceLineNo">1695</span>          if (mayUseOffPeak &amp;&amp; !compaction.getRequest().isOffPeak()) {<a name="line.1695"></a>
+<span class="sourceLineNo">1696</span>            // Compaction policy doesn't want to take advantage of off-peak.<a name="line.1696"></a>
+<span class="sourceLineNo">1697</span>            offPeakCompactionTracker.set(false);<a name="line.1697"></a>
+<span class="sourceLineNo">1698</span>          }<a name="line.1698"></a>
+<span class="sourceLineNo">1699</span>        }<a name="line.1699"></a>
+<span class="sourceLineNo">1700</span>        if (this.getCoprocessorHost() != null) {<a name="line.1700"></a>
+<span class="sourceLineNo">1701</span>          this.getCoprocessorHost().postCompactSelection(<a name="line.1701"></a>
+<span class="sourceLineNo">1702</span>              this, ImmutableList.copyOf(compaction.getRequest().getFiles()), tracker,<a name="line.1702"></a>
+<span class="sourceLineNo">1703</span>              compaction.getRequest(), user);<a name="line.1703"></a>
+<span class="sourceLineNo">1704</span>        }<a name="line.1704"></a>
+<span class="sourceLineNo">1705</span>        // Finally, we have the resulting files list. Check if we have any files at all.<a name="line.1705"></a>
+<span class="sourceLineNo">1706</span>        request = compaction.getRequest();<a name="line.1706"></a>
+<span class="sourceLineNo">1707</span>        Collection&lt;HStoreFile&gt; selectedFiles = request.getFiles();<a name="line.1707"></a>
+<span class="sourceLineNo">1708</span>        if (selectedFiles.isEmpty()) {<a name="line.1708"></a>
+<span class="sourceLineNo">1709</span>          return Optional.empty();<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>        addToCompactingFiles(selectedFiles);<a name="line.1712"></a>
 <span class="sourceLineNo">1713</span><a name="line.1713"></a>
-<span class="sourceLineNo">1714</span>        // Set common request properties.<a name="line.1714"></a>
-<span class="sourceLineNo">1715</span>        // Set priority, either override value supplied by caller or from store.<a name="line.1715"></a>
-<span class="sourceLineNo">1716</span>        request.setPriority((priority != Store.NO_PRIORITY) ? priority : getCompactPriority());<a name="line.1716"></a>
-<span class="sourceLineNo">1717</span>        request.setDescription(getRegionInfo().getRegionNameAsString(), getColumnFamilyName());<a name="line.1717"></a>
-<span class="sourceLineNo">1718</span>        request.setTracker(tracker);<a name="line.1718"></a>
-<span class="sourceLineNo">1719</span>      }<a name="line.1719"></a>
-<span class="sourceLineNo">1720</span>    } finally {<a name="line.1720"></a>
-<span class="sourceLineNo">1721</span>      this.lock.readLock().unlock();<a name="line.1721"></a>
-<span class="sourceLineNo">1722</span>    }<a name="line.1722"></a>
-<span class="sourceLineNo">1723</span><a name="line.1723"></a>
-<span class="sourceLineNo">1724</span>    LOG.debug(getRegionInfo().getEncodedName() + " - " + getColumnFamilyName()<a name="line.1724"></a>
-<span class="sourceLineNo">1725</span>        + ": Initiating " + (request.isMajor() ? "major" : "minor") + " compaction"<a name="line.1725"></a>
-<span class="sourceLineNo">1726</span>        + (request.isAllFiles() ? " (all files)" : ""));<a name="line.1726"></a>
-<span class="sourceLineNo">1727</span>    this.region.reportCompactionRequestStart(request.isMajor());<a name="line.1727"></a>
-<span class="sourceLineNo">1728</span>    return Optional.of(compaction);<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>  /** Adds the files to compacting files. filesCompacting must be locked. */<a name="line.1731"></a>
-<span class="sourceLineNo">1732</span>  private void addToCompactingFiles(Collection&lt;HStoreFile&gt; filesToAdd) {<a name="line.1732"></a>
-<span class="sourceLineNo">1733</span>    if (filesToAdd == null) return;<a name="line.1733"></a>
-<span class="sourceLineNo">1734</span>    // Check that we do not try to compact the same StoreFile twice.<a name="line.1734"></a>
-<span class="sourceLineNo">1735</span>    if (!Collections.disjoint(filesCompacting, filesToAdd)) {<a name="line.1735"></a>
-<span class="sourceLineNo">1736</span>      Preconditions.checkArgument(false, "%s overlaps with %s", filesToAdd, filesCompacting);<a name="line.1736"></a>
-<span class="sourceLineNo">1737</span>    }<a name="line.1737"></a>
-<span class="sourceLineNo">1738</span>    filesCompacting.addAll(filesToAdd);<a name="line.1738"></a>
-<span class="sourceLineNo">1739</span>    Collections.sort(filesCompacting, storeEngine.getStoreFileManager().getStoreFileComparator());<a name="line.1739"></a>
-<span class="sourceLineNo">1740</span>  }<a name="line.1740"></a>
-<span class="sourceLineNo">1741</span><a name="line.1741"></a>
-<span class="sourceLineNo">1742</span>  private void removeUnneededFiles() throws IOException {<a name="line.1742"></a>
-<span class="sourceLineNo">1743</span>    if (!conf.getBoolean("hbase.store.delete.expired.storefile", true)) return;<a name="line.1743"></a>
-<span class="sourceLineNo">1744</span>    if (getColumnFamilyDescriptor().getMinVersions() &gt; 0) {<a name="line.1744"></a>
-<span class="sourceLineNo">1745</span>      LOG.debug("Skipping expired store file removal due to min version being " +<a name="line.1745"></a>
-<span class="sourceLineNo">1746</span>          getColumnFamilyDescriptor().getMinVersions());<a name="line.1746"></a>
-<span class="sourceLineNo">1747</span>      return;<a name="line.1747"></a>
-<span class="sourceLineNo">1748</span>    }<a name="line.1748"></a>
-<span class="sourceLineNo">1749</span>    this.lock.readLock().lock();<a name="line.1749"></a>
-<span class="sourceLineNo">1750</span>    Collection&lt;HStoreFile&gt; delSfs = null;<a name="line.1750"></a>
-<span class="sourceLineNo">1751</span>    try {<a name="line.1751"></a>
-<span class="sourceLineNo">1752</span>      synchronized (filesCompacting) {<a name="line.1752"></a>
-<span class="sourceLineNo">1753</span>        long cfTtl = getStoreFileTtl();<a name="line.1753"></a>
-<span class="sourceLineNo">1754</span>        if (cfTtl != Long.MAX_VALUE) {<a name="line.1754"></a>
-<span class="sourceLineNo">1755</span>          delSfs = storeEngine.getStoreFileManager().getUnneededFiles(<a name="line.1755"></a>
-<span class="sourceLineNo">1756</span>              EnvironmentEdgeManager.currentTime() - cfTtl, filesCompacting);<a name="line.1756"></a>
-<span class="sourceLineNo">1757</span>          addToCompactingFiles(delSfs);<a name="line.1757"></a>
-<span class="sourceLineNo">1758</span>        }<a name="line.1758"></a>
-<span class="sourceLineNo">1759</span>      }<a name="line.1759"></a>
-<span class="sourceLineNo">1760</span>    } finally {<a name="line.1760"></a>
-<span class="sourceLineNo">1761</span>      this.lock.readLock().unlock();<a name="line.1761"></a>
-<span class="sourceLineNo">1762</span>    }<a name="line.1762"></a>
-<span class="sourceLineNo">1763</span>    if (delSfs == null || delSfs.isEmpty()) return;<a name="line.1763"></a>
-<span class="sourceLineNo">1764</span><a name="line.1764"></a>
-<span class="sourceLineNo">1765</span>    Collection&lt;HStoreFile&gt; newFiles = new ArrayList&lt;&gt;(); // No new files.<a name="line.1765"></a>
-<span class="sourceLineNo">1766</span>    writeCompactionWalRecord(delSfs, newFiles);<a name="line.1766"></a>
-<span class="sourceLineNo">1767</span>    replaceStoreFiles(delSfs, newFiles);<a name="line.1767"></a>
-<span class="sourceLineNo">1768</span>    completeCompaction(delSfs);<a name="line.1768"></a>
-<span class="sourceLineNo">1769</span>    LOG.info("Completed removal of " + delSfs.size() + " unnecessary (expired) file(s) in "<a name="line.1769"></a>
-<span class="sourceLineNo">1770</span>        + this + " of " + this.getRegionInfo().getRegionNameAsString()<a name="line.1770"></a>
-<span class="sourceLineNo">1771</span>        + "; total size for store is " + TraditionalBinaryPrefix.long2String(storeSize, "", 1));<a name="line.1771"></a>
-<span class="sourceLineNo">1772</span>  }<a name="line.1772"></a>
-<span class="sourceLineNo">1773</span><a name="line.1773"></a>
-<span class="sourceLineNo">1774</span>  public void cancelRequestedCompaction(CompactionContext compaction) {<a name="line.1774"></a>
-<span class="sourceLineNo">1775</span>    finishCompactionRequest(compaction.getRequest());<a name="line.1775"></a>
-<span class="sourceLineNo">1776</span>  }<a name="line.1776"></a>
-<span class="sourceLineNo">1777</span><a name="line.1777"></a>
-<span class="sourceLineNo">1778</span>  private void finishCompactionRequest(CompactionRequestImpl cr) {<a name="line.1778"></a>
-<span class="sourceLineNo">1779</span>    this.region.reportCompactionRequestEnd(cr.isMajor(), cr.getFiles().size(), cr.getSize());<a name="line.1779"></a>
-<span class="sourceLineNo">1780</span>    if (cr.isOffPeak()) {<a name="line.1780"></a>
-<span class="sourceLineNo">1781</span>      offPeakCompactionTracker.set(false);<a name="line.1781"></a>
-<span class="sourceLineNo">1782</span>      cr.setOffPeak(false);<a name="line.1782"></a>
-<span class="sourceLineNo">1783</span>    }<a name="line.1783"></a>
-<span class="sourceLineNo">1784</span>    synchronized (filesCompacting) {<a name="line.1784"></a>
-<span class="sourceLineNo">1785</span>      filesCompacting.removeAll(cr.getFiles());<a name="line.1785"></a>
+<span class="sourceLineNo">1714</span>        // If we're enqueuing a major, clear the force flag.<a name="line.1714"></a>
+<span class="sourceLineNo">1715</span>        this.forceMajor = this.forceMajor &amp;&amp; !request.isMajor();<a name="line.1715"></a>
+<span class="sourceLineNo">1716</span><a name="line.1716"></a>
+<span class="sourceLineNo">1717</span>        // Set common request properties.<a name="line.1717"></a>
+<span class="sourceLineNo">1718</span>        // Set priority, either override value supplied by caller or from store.<a name="line.1718"></a>
+<span class="sourceLineNo">1719</span>        request.setPriority((priority != Store.NO_PRIORITY) ? priority : getCompactPriority());<a name="line.1719"></a>
+<span class="sourceLineNo">1720</span>        request.setDescription(getRegionInfo().getRegionNameAsString(), getColumnFamilyName());<a name="line.1720"></a>
+<span class="sourceLineNo">1721</span>        request.setTracker(tracker);<a name="line.1721"></a>
+<span class="sourceLineNo">1722</span>      }<a name="line.1722"></a>
+<span class="sourceLineNo">1723</span>    } finally {<a name="line.1723"></a>
+<span class="sourceLineNo">1724</span>      this.lock.readLock().unlock();<a name="line.1724"></a>
+<span class="sourceLineNo">1725</span>    }<a name="line.1725"></a>
+<span class="sourceLineNo">1726</span><a name="line.1726"></a>
+<span class="sourceLineNo">1727</span>    LOG.debug(getRegionInfo().getEncodedName() + " - " + getColumnFamilyName()<a name="line.1727"></a>
+<span class="sourceLineNo">1728</span>        + ": Initiating " + (request.isMajor() ? "major" : "minor") + " compaction"<a name="line.1728"></a>
+<span class="sourceLineNo">1729</span>        + (request.isAllFiles() ? " (all files)" : ""));<a name="line.1729"></a>
+<span class="sourceLineNo">1730</span>    this.region.reportCompactionRequestStart(request.isMajor());<a name="line.1730"></a>
+<span class="sourceLineNo">1731</span>    return Optional.of(compaction);<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>  /** Adds the files to compacting files. filesCompacting must be locked. */<a name="line.1734"></a>
+<span class="sourceLineNo">1735</span>  private void addToCompactingFiles(Collection&lt;HStoreFile&gt; filesToAdd) {<a name="line.1735"></a>
+<span class="sourceLineNo">1736</span>    if (filesToAdd == null) return;<a name="line.1736"></a>
+<span class="sourceLineNo">1737</span>    // Check that we do not try to compact the same StoreFile twice.<a name="line.1737"></a>
+<span class="sourceLineNo">1738</span>    if (!Collections.disjoint(filesCompacting, filesToAdd)) {<a name="line.1738"></a>
+<span class="sourceLineNo">1739</span>      Preconditions.checkArgument(false, "%s overlaps with %s", filesToAdd, filesCompacting);<a name="line.1739"></a>
+<span class="sourceLineNo">1740</span>    }<a name="line.1740"></a>
+<span class="sourceLineNo">1741</span>    filesCompacting.addAll(filesToAdd);<a name="line.1741"></a>
+<span class="sourceLineNo">1742</span>    Collections.sort(filesCompacting, storeEngine.getStoreFileManager().getStoreFileComparator());<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>  private void removeUnneededFiles() throws IOException {<a name="line.1745"></a>
+<span class="sourceLineNo">1746</span>    if (!conf.getBoolean("hbase.store.delete.expired.storefile", true)) return;<a name="line.1746"></a>
+<span class="sourceLineNo">1747</span>    if (getColumnFamilyDescriptor().getMinVersions() &gt; 0) {<a name="line.1747"></a>
+<span class="sourceLineNo">1748</span>      LOG.debug("Skipping expired store file removal due to min version being " +<a name="line.1748"></a>
+<span class="sourceLineNo">1749</span>          getColumnFamilyDescriptor().getMinVersions());<a name="line.1749"></a>
+<span class="sourceLineNo">1750</span>      return;<a name="line.1750"></a>
+<span class="sourceLineNo">1751</span>    }<a name="line.1751"></a>
+<span class="sourceLineNo">1752</span>    this.lock.readLock().lock();<a name="line.1752"></a>
+<span class="sourceLineNo">1753</span>    Collection&lt;HStoreFile&gt; delSfs = null;<a name="line.1753"></a>
+<span class="sourceLineNo">1754</span>    try {<a name="line.1754"></a>
+<span class="sourceLineNo">1755</span>      synchronized (filesCompacting) {<a name="line.1755"></a>
+<span class="sourceLineNo">1756</span>        long cfTtl = getStoreFileTtl();<a name="line.1756"></a>
+<span class="sourceLineNo">1757</span>        if (cfTtl != Long.MAX_VALUE) {<a name="line.1757"></a>
+<span class="sourceLineNo">1758</span>          delSfs = storeEngine.getStoreFileManager().getUnneededFiles(<a name="line.1758"></a>
+<span class="sourceLineNo">1759</span>              EnvironmentEdgeManager.currentTime() - cfTtl, filesCompacting);<a name="line.1759"></a>
+<span class="sourceLineNo">1760</span>          addToCompactingFiles(delSfs);<a name="line.1760"></a>
+<span class="sourceLineNo">1761</span>        }<a name="line.1761"></a>
+<span class="sourceLineNo">1762</span>      }<a name="line.1762"></a>
+<span class="sourceLineNo">1763</span>    } finally {<a name="line.1763"></a>
+<span class="sourceLineNo">1764</span>      this.lock.readLock().unlock();<a name="line.1764"></a>
+<span class="sourceLineNo">1765</span>    }<a name="line.1765"></a>
+<span class="sourceLineNo">1766</span>    if (delSfs == null || delSfs.isEmpty()) return;<a name="line.1766"></a>
+<span class="sourceLineNo">1767</span><a name="line.1767"></a>
+<span class="sourceLineNo">1768</span>    Collection&lt;HStoreFile&gt; newFiles = new ArrayList&lt;&gt;(); // No new files.<a name="line.1768"></a>
+<span class="sourceLineNo">1769</span>    writeCompactionWalRecord(delSfs, newFiles);<a name="line.1769"></a>
+<span class="sourceLineNo">1770</span>    replaceStoreFiles(delSfs, newFiles);<a name="line.1770"></a>
+<span class="sourceLineNo">1771</span>    completeCompaction(delSfs);<a name="line.1771"></a>
+<span class="sourceLineNo">1772</span>    LOG.info("Completed removal of " + delSfs.size() + " unnecessary (expired) file(s) in "<a name="line.1772"></a>
+<span class="sourceLineNo">1773</span>        + this + " of " + this.getRegionInfo().getRegionNameAsString()<a name="line.1773"></a>
+<span class="sourceLineNo">1774</span>        + "; total size for store is " + TraditionalBinaryPrefix.long2String(storeSize, "", 1));<a name="line.1774"></a>
+<span class="sourceLineNo">1775</span>  }<a name="line.1775"></a>
+<span class="sourceLineNo">1776</span><a name="line.1776"></a>
+<span class="sourceLineNo">1777</span>  public void cancelRequestedCompaction(CompactionContext compaction) {<a name="line.1777"></a>
+<span class="sourceLineNo">1778</span>    finishCompactionRequest(compaction.getRequest());<a name="line.1778"></a>
+<span class="sourceLineNo">1779</span>  }<a name="line.1779"></a>
+<span class="sourceLineNo">1780</span><a name="line.1780"></a>
+<span class="sourceLineNo">1781</span>  private void finishCompactionRequest(CompactionRequestImpl cr) {<a name="line.1781"></a>
+<span class="sourceLineNo">1782</span>    this.region.reportCompactionRequestEnd(cr.isMajor(), cr.getFiles().size(), cr.getSize());<a name="line.1782"></a>
+<span class="sourceLineNo">1783</span>    if (cr.isOffPeak()) {<a name="line.1783"></a>
+<span class="sourceLineNo">1784</span>      offPeakCompactionTracker.set(false);<a name="line.1784"></a>
+<span class="sourceLineNo">1785</span>      cr.setOffPeak(false);<a name="line.1785"></a>
 <span class="sourceLineNo">1786</span>    }<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>  /**<a name="line.1789"></a>
-<span class="sourceLineNo">1790</span>   * Validates a store file by opening and closing it. In HFileV2 this should not be an expensive<a name="line.1790"></a>
-<span class="sourceLineNo">1791</span>   * operation.<a name="line.1791"></a>
-<span class="sourceLineNo">1792</span>   * @param path the path to the store file<a name="line.1792"></a>
-<span class="sourceLineNo">1793</span>   */<a name="line.1793"></a>
-<span class="sourceLineNo">1794</span>  private void validateStoreFile(Path path) throws IOException {<a name="line.1794"></a>
-<span class="sourceLineNo">1795</span>    HStoreFile storeFile = null;<a name="line.1795"></a>
-<span class="sourceLineNo">1796</span>    try {<a name="line.1796"></a>
-<span class="sourceLineNo">1797</span>      storeFile = createStoreFileAndReader(path);<a name="line.1797"></a>
-<span class="sourceLineNo">1798</span>    } catch (IOException e) {<a name="line.1798"></a>
-<span class="sourceLineNo">1799</span>      LOG.error("Failed to open store file : " + path + ", keeping it in tmp location", e);<a name="line.1799"></a>
-<span class="sourceLineNo">1800</span>      throw e;<a name="line.1800"></a>
-<span class="sourceLineNo">1801</span>    } finally {<a name="line.1801"></a>
-<span class="sourceLineNo">1802</span>      if (storeFile != null) {<a name="line.1802"></a>
-<span class="sourceLineNo">1803</span>        storeFile.closeStoreFile(false);<a name="line.1803"></a>
-<span class="sourceLineNo">1804</span>      }<a name="line.1804"></a>
-<span class="sourceLineNo">1805</span>    }<a name="line.1805"></a>
-<span class="sourceLineNo">1806</span>  }<a name="line.1806"></a>
-<span class="sourceLineNo">1807</span><a name="line.1807"></a>
-<span class="sourceLineNo">1808</span>  /**<a name="line.1808"></a>
-<span class="sourceLineNo">1809</span>   * &lt;p&gt;It works by processing a compaction that's been written to disk.<a name="line.1809"></a>
-<span class="sourceLineNo">1810</span>   *<a name="line.1810"></a>
-<span class="sourceLineNo">1811</span>   * &lt;p&gt;It is usually invoked at the end of a compaction, but might also be<a name="line.1811"></a>
-<span class="sourceLineNo">1812</span>   * invoked at HStore startup, if the prior execution died midway through.<a name="line.1812"></a>
+<span class="sourceLineNo">1787</span>    synchronized (filesCompacting) {<a name="line.1787"></a>
+<span class="sourceLineNo">1788</span>      filesCompacting.removeAll(cr.getFiles());<a name="line.1788"></a>
+<span class="sourceLineNo">1789</span>    }<a name="line.1789"></a>
+<span class="sourceLineNo">1790</span>  }<a name="line.1790"></a>
+<span class="sourceLineNo">1791</span><a name="line.1791"></a>
+<span class="sourceLineNo">1792</span>  /**<a name="line.1792"></a>
+<span class="sourceLineNo">1793</span>   * Validates a store file by opening and closing it. In HFileV2 this should not be an expensive<a name="line.1793"></a>
+<span class="sourceLineNo">1794</span>   * operation.<a name="line.1794"></a>
+<span class="sourceLineNo">1795</span>   * @param path the path to the store file<a name="line.1795"></a>
+<span class="sourceLineNo">1796</span>   */<a name="line.1796"></a>
+<span class="sourceLineNo">1797</span>  private void validateStoreFile(Path path) throws IOException {<a name="line.1797"></a>
+<span class="sourceLineNo">1798</span>    HStoreFile storeFile = null;<a name="line.1798"></a>
+<span class="sourceLineNo">1799</span>    try {<a name="line.1799"></a>
+<span class="sourceLineNo">1800</span>      storeFile = createStoreFileAndReader(path);<a name="line.1800"></a>
+<span class="sourceLineNo">1801</span>    } catch (IOException e) {<a name="line.1801"></a>
+<span class="sourceLineNo">1802</span>      LOG.error("Failed to open store file : " + path + ", keeping it in tmp location", e);<a name="line.1802"></a>
+<span class="sourceLineNo">1803</span>      throw e;<a name="line.1803"></a>
+<span class="sourceLineNo">1804</span>    } finally {<a name="line.1804"></a>
+<span class="sourceLineNo">1805</span>      if (storeFile != null) {<a name="line.1805"></a>
+<span class="sourceLineNo">1806</span>        storeFile.closeStoreFile(false);<a name="line.1806"></a>
+<span class="sourceLineNo">1807</span>      }<a name="line.1807"></a>
+<span class="sourceLineNo">1808</span>    }<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>   * &lt;p&gt;It works by processing a compaction that's been written to disk.<a name="line.1812"></a>
 <span class="sourceLineNo">1813</span>   *<a name="line.1813"></a>
-<span class="sourceLineNo">1814</span>   * &lt;p&gt;Moving the compacted TreeMap into place means:<a name="line.1814"></a>
-<span class="sourceLineNo">1815</span>   * &lt;pre&gt;<a name="line.1815"></a>
-<span class="sourceLineNo">1816</span>   * 1) Unload all replaced StoreFile, close and collect list to delete.<a name="line.1816"></a>
-<span class="sourceLineNo">1817</span>   * 2) Compute new store size<a name="line.1817"></a>
-<span class="sourceLineNo">1818</span>   * &lt;/pre&gt;<a name="line.1818"></a>
-<span class="sourceLineNo">1819</span>   *<a name="line.1819"></a>
-<span class="sourceLineNo">1820</span>   * @param compactedFiles list of files that were compacted<a name="line.1820"></a>
-<span class="sourceLineNo">1821</span>   */<a name="line.1821"></a>
-<span class="sourceLineNo">1822</span>  @VisibleForTesting<a name="line.1822"></a>
-<span class="sourceLineNo">1823</span>  protected void completeCompaction(Collection&lt;HStoreFile&gt; compactedFiles)<a name="line.1823"></a>
-<span class="sourceLineNo">1824</span>    throws IOException {<a name="line.1824"></a>
-<span class="sourceLineNo">1825</span>    this.storeSize = 0L;<a name="line.1825"></a>
-<span class="sourceLineNo">1826</span>    this.totalUncompressedBytes = 0L;<a name="line.1826"></a>
-<span class="sourceLineNo">1827</span>    for (HStoreFile hsf : this.storeEngine.getStoreFileManager().getStorefiles()) {<a name="line.1827"></a>
-<span class="sourceLineNo">1828</span>      StoreFileReader r = hsf.getReader();<a name="line.1828"></a>
-<span class="sourceLineNo">1829</span>      if (r == null) {<a name="line.1829"></a>
-<span class="sourceLineNo">1830</span>        LOG.warn("StoreFile " + hsf + " has a null Reader");<a name="line.1830"></a>
-<span class="sourceLineNo">1831</span>        continue;<a name="line.1831"></a>
-<span class="sourceLineNo">1832</span>      }<a name="line.1832"></a>
-<span class="sourceLineNo">1833</span>      this.storeSize += r.length();<a name="line.1833"></a>
-<span class="sourceLineNo">1834</span>      this.totalUncompressedBytes += r.getTotalUncompressedBytes();<a name="line.1834"></a>
-<span class="sourceLineNo">1835</span>    }<a name="line.1835"></a>
-<span class="sourceLineNo">1836</span>  }<a name="line.1836"></a>
-<span class="sourceLineNo">1837</span><a name="line.1837"></a>
-<span class="sourceLineNo">1838</span>  /*<a name="line.1838"></a>
-<span class="sourceLineNo">1839</span>   * @param wantedVersions How many versions were asked for.<a name="line.1839"></a>
-<span class="sourceLineNo">1840</span>   * @return wantedVersions or this families' {@link HConstants#VERSIONS}.<a name="line.1840"></a>
-<span class="sourceLineNo">1841</span>   */<a name="line.1841"></a>
-<span class="sourceLineNo">1842</span>  int versionsToReturn(final int wantedVersions) {<a name="line.1842"></a>
-<span class="sourceLineNo">1843</span>    if (wantedVersions &lt;= 0) {<a name="line.1843"></a>
-<span class="sourceLineNo">1844</span>      throw new IllegalArgumentException("Number of versions must be &gt; 0");<a name="line.1844"></a>
-<span class="sourceLineNo">1845</span>    }<a name="line.1845"></a>
-<span class="sourceLineNo">1846</span>    // Make sure we do not return more than maximum versions for this store.<a name="line.1846"></a>
-<span class="sourceLineNo">1847</span>    int maxVersions = this.family.getMaxVersions();<a name="line.1847"></a>
-<span class="sourceLineNo">1848</span>    return wantedVersions &gt; maxVersions ? maxVersions: wantedVersions;<a name="line.1848"></a>
-<span class="sourceLineNo">1849</span>  }<a name="line.1849"></a>
-<span class="sourceLineNo">1850</span><a name="line.1850"></a>
-<span class="sourceLineNo">1851</span>  @Override<a name="line.1851"></a>
-<span class="sourceLineNo">1852</span>  public boolean canSplit() {<a name="line.1852"></a>
-<span class="sourceLineNo">1853</span>    this.lock.readLock().lock();<a name="line.1853"></a>
-<span class="sourceLineNo">1854</span>    try {<a name="line.1854"></a>
-<span class="sourceLineNo">1855</span>      // Not split-able if we find a reference store file present in the store.<a name="line.1855"></a>
-<span class="sourceLineNo">1856</span>      boolean result = !hasReferences();<a name="line.1856"></a>
-<span class="sourceLineNo">1857</span>      if (!result) {<a name="line.1857"></a>
-<span class="sourceLineNo">1858</span>          if (LOG.isTraceEnabled()) {<a name="line.1858"></a>
-<span class="sourceLineNo">1859</span>            LOG.trace("Not splittable; has references: " + this);<a name="line.1859"></a>
-<span class="sourceLineNo">1860</span>          }<a name="line.1860"></a>
-<span class="sourceLineNo">1861</span>      }<a name="line.1861"></a>
-<span class="sourceLineNo">1862</span>      return result;<a name="line.1862"></a>
-<span class="sourceLineNo">1863</span>    } finally {<a name="line.1863"></a>
-<span class="sourceLineNo">1864</span>      this.lock.readLock().unlock();<a name="line.1864"></a>
-<span class="sourceLineNo">1865</span>    }<a name="line.1865"></a>
-<span class="sourceLineNo">1866</span>  }<a name="line.1866"></a>
-<span class="sourceLineNo">1867</span><a name="line.1867"></a>
-<span class="sourceLineNo">1868</span>  /**<a name="line.1868"></a>
-<span class="sourceLineNo">1869</span>   * Determines if Store should be split.<a name="line.1869"></a>
-<span class="sourceLineNo">1870</span>   */<a name="line.1870"></a>
-<span class="sourceLineNo">1871</span>  public Optional&lt;byte[]&gt; getSplitPoint() {<a name="line.1871"></a>
-<span class="sourceLineNo">1872</span>    this.lock.readLock().lock();<a name="line.1872"></a>
-<span class="sourceLineNo">1873</span>    try {<a name="line.1873"></a>
-<span class="sourceLineNo">1874</span>      // Should already be enforced by the split policy!<a name="line.1874"></a>
-<span class="sourceLineNo">1875</span>      assert !this.getRegionInfo().isMetaRegion();<a name="line.1875"></a>
-<span class="sourceLineNo">1876</span>      // Not split-able if we find a reference store file present in the store.<a name="line.1876"></a>
-<span class="sourceLineNo">1877</span>      if (hasReferences()) {<a name="line.1877"></a>
-<span class="sourceLineNo">1878</span>        if (LOG.isTraceEnabled()) {<a name="line.1878"></a>
-<span class="sourceLineNo">1879</span>          LOG.trace("Not splittable; has references: " + this);<a name="line.1879"></a>
-<span class="sourceLineNo">1880</span>        }<a name="line.1880"></a>
-<span class="sourceLineNo">1881</span>        return Optional.empty();<a name="line.1881"></a>
-<span class="sourceLineNo">1882</span>      }<a name="line.1882"></a>
-<span class="sourceLineNo">1883</span>      return this.storeEngine.getStoreFileManager().getSplitPoint();<a name="line.1883"></a>
-<span class="sourceLineNo">1884</span>    } catch(IOException e) {<a name="line.1884"></a>
-<span class="sourceLineNo">1885</span>      LOG.warn("Failed getting store size for " + this, e);<a name="line.1885"></a>
-<span class="sourceLineNo">1886</span>    } finally {<a name="line.1886"></a>
-<span class="sourceLineNo">1887</span>      this.lock.readLock().unlock();<a name="line.1887"></a>
-<span class="sourceLineNo">1888</span>    }<a name="line.1888"></a>
-<span class="sourceLineNo">1889</span>    return Optional.empty();<a name="line.1889"></a>
-<span class="sourceLineNo">1890</span>  }<a name="line.1890"></a>
-<span class="sourceLineNo">1891</span><a name="line.1891"></a>
-<span class="sourceLineNo">1892</span>  @Override<a name="line.1892"></a>
-<span class="sourceLineNo">1893</span>  public long getLastCompactSize() {<a name="line.1893"></a>
-<span class="sourceLineNo">1894</span>    return this.lastCompactSize;<a name="line.1894"></a>
-<span class="sourceLineNo">1895</span>  }<a name="line.1895"></a>
-<span class="sourceLineNo">1896</span><a name="line.1896"></a>
-<span class="sourceLineNo">1897</span>  @Override<a name="line.1897"></a>
-<span class="sourceLineNo">1898</span>  public long getSize() {<a name="line.1898"></a>
-<span class="sourceLineNo">1899</span>    return storeSize;<a name="line.1899"></a>
-<span class="sourceLineNo">1900</span>  }<a name="line.1900"></a>
-<span class="sourceLineNo">1901</span><a name="line.1901"></a>
-<span class="sourceLineNo">1902</span>  public void triggerMajorCompaction() {<a name="line.1902"></a>
-<span class="sourceLineNo">1903</span>    this.forceMajor = true;<a name="line.1903"></a>
-<span class="sourceLineNo">1904</span>  }<a name="line.1904"></a>
-<span class="sourceLineNo">1905</span><a name="line.1905"></a>
-<span class="sourceLineNo">1906</span><a name="line.1906"></a>
-<span class="sourceLineNo">1907</span>  //////////////////////////////////////////////////////////////////////////////<a name="line.1907"></a>
-<span class="sourceLineNo">1908</span>  // File administration<a name="line.1908"></a>
-<span class="sourceLineNo">1909</span>  //////////////////////////////////////////////////////////////////////////////<a name="line.1909"></a>
-<span class="sourceLineNo">1910</span><a name="line.1910"></a>
-<span class="sourceLineNo">1911</span>  /**<a name="line.1911"></a>
-<span class="sourceLineNo">1912</span>   * Return a scanner for both the memstore and the HStore files. Assumes we are not in a<a name="line.1912"></a>
-<span class="sourceLineNo">1913</span>   * compaction.<a name="line.1913"></a>
-<span class="sourceLineNo">1914</span>   * @param scan Scan to apply when scanning the stores<a name="line.1914"></a>
-<span class="sourceLineNo">1915</span>   * @param targetCols columns to scan<a name="line.1915"></a>
-<span class="sourceLineNo">1916</span>   * @return a scanner over the current key values<a name="line.1916"></a>
-<span class="sourceLineNo">1917</span>   * @throws IOException on failure<a name="line.1917"></a>
-<span class="sourceLineNo">1918</span>   */<a name="line.1918"></a>
-<span class="sourceLineNo">1919</span>  public KeyValueScanner getScanner(Scan scan,<a name="line.1919"></a>
-<span class="sourceLineNo">1920</span>      final NavigableSet&lt;byte []&gt; targetCols, long readPt) throws IOException {<a name="line.1920"></a>
-<span class="sourceLineNo">1921</span>    lock.readLock().lock();<a name="line.1921"></a>
-<span class="sourceLineNo">1922</span>    try {<a name="line.1922"></a>
-<span class="sourceLineNo">1923</span>      return createScanner(scan, targetCols, readPt);<a name="line.1923"></a>
-<span class="sourceLineNo">1924</span>    } finally {<a name="line.1924"></a>
-<span class="sourceLineNo">1925</span>      lock.readLock().unlock();<a name="line.1925"></a>
-<span class="sourceLineNo">1926</span>    }<a name="line.1926"></a>
-<span class="sourceLineNo">1927</span>  }<a name="line.1927"></a>
-<span class="sourceLineNo">1928</span><a name="line.1928"></a>
-<span class="sourceLineNo">1929</span>  protected KeyValueScanner createScanner(Scan scan, final NavigableSet&lt;byte[]&gt; targetCols,<a name="line.1929"></a>
-<span class="sourceLineNo">1930</span>      long readPt) throws IOException {<a name="line.1930"></a>
-<span class="sourceLineNo">1931</span>    return scan.isReversed() ? new ReversedStoreScanner(this,<a name="line.1931"></a>
-<span class="sourceLineNo">1932</span>      getScanInfo(), scan, targetCols, readPt) : new StoreScanner(this,<a name="line.1932"></a>
-<span class="sourceLineNo">1933</span>      getScanInfo(), scan, targetCols, readPt);<a name="line.1933"></a>
-<span class="sourceLineNo">1934</span>  }<a name="line.1934"></a>
-<span class="sourceLineNo">1935</span><a name="line.1935"></a>
-<span class="sourceLineNo">1936</span>  /**<a name="line.1936"></a>
-<span class="sourceLineNo">1937</span>   * Recreates the scanners on the current list of active store file scanners<a name="line.1937"></a>
-<span class="sourceLineNo">1938</span>   * @param currentFileScanners the current set of active store file scanners<a name="line.1938"></a>
-<span class="sourceLineNo">1939</span>   * @param cacheBlocks cache the blocks or not<a name="line.1939"></a>
-<span class="sourceLineNo">1940</span>   * @param usePread use pread or not<a name="line.1940"></a>
-<span class="sourceLineNo">1941</span>   * @param isCompaction is the scanner for compaction<a name="line.1941"></a>
-<span class="sourceLineNo">1942</span>   * @param matcher the scan query matcher<a name="line.1942"></a>
-<span class="sourceLineNo">1943</span>   * @param startRow the scan's start row<a name="line.1943"></a>
-<span class="sourceLineNo">1944</span>   * @param includeStartRow should the scan include the start row<a name="line.1944"></a>
-<span class="sourceLineNo">1945</span>   * @param stopRow the scan's stop row<a name="line.1945"></a>
-<span class="sourceLineNo">1946</span>   * @param includeStopRow should the scan include the stop row<a name="line.1946"></a>
-<span class="sourceLineNo">1947</span>   * @param readPt the read point of the current scane<a name="line.1947"></a>
-<span class="sourceLineNo">1948</span>   * @param includeMemstoreScanner whether the current scanner should include memstorescanner<a name="line.1948"></a>
-<span class="sourceLineNo">1949</span>   * @return list of scanners recreated on the current Scanners<a name="line.1949"></a>
-<span class="sourceLineNo">1950</span>   * @throws IOException<a name="line.1950"></a>
-<span class="sourceLineNo">1951</span>   */<a name="line.1951"></a>
-<span class="sourceLineNo">1952</span>  public List&lt;KeyValueScanner&gt; recreateScanners(List&lt;KeyValueScanner&gt; currentFileScanners,<a name="line.1952"></a>
-<span class="sourceLineNo">1953</span>      boolean cacheBlocks, boolean usePread, boolean isCompaction, ScanQueryMatcher matcher,<a name="line.1953"></a>
-<span class="sourceLineNo">1954</span>      byte[] startRow, boolean includeStartRow, byte[] stopRow, boolean includeStopRow, long readPt,<a name="line.1954"></a>
-<span class="sourceLineNo">1955</span>      boolean includeMemstoreScanner) throws IOException {<a name="line.1955"></a>
-<span class="sourceLineNo">1956</span>    this.lock.readLock().lock();<a name="line.1956"></a>
-<span class="sourceLineNo">1957</span>    try {<a name="line.1957"></a>
-<span class="sourceLineNo">1958</span>      Map&lt;String, HStoreFile&gt; name2File =<a name="line.1958"></a>
-<span class="sourceLineNo">1959</span>          new HashMap&lt;&gt;(getStorefilesCount() + getCompactedFilesCount());<a name="line.1959"></a>
-<span class="sourceLineNo">1960</span>      for (HStoreFile file : getStorefiles()) {<a name="line.1960"></a>
-<span class="sourceLineNo">1961</span>        name2File.put(file.getFileInfo().getActiveFileName(), file);<a name="line.1961"></a>
-<span class="sourceLineNo">1962</span>      }<a name="line.1962"></a>
-<span class="sourceLineNo">1963</span>      if (getCompactedFiles() != null) {<a name="line.1963"></a>
-<span class="sourceLineNo">1964</span>        for (HStoreFile file : getCompactedFiles()) {<a name="line.1964"></a>
-<span class="sourceLineNo">1965</span>          name2File.put(file.getFileInfo().getActiveFileName(), file);<a name="line.1965"></a>
-<span class="sourceLineNo">1966</span>        }<a name="line.1966"></a>
-<span class="sourceLineNo">1967</span>      }<a name="line.1967"></a>
-<span class="sourceLineNo">1968</span>      List&lt;HStoreFile&gt; filesToReopen = new ArrayList&lt;&gt;();<a name="line.1968"></a>
-<span class="sourceLineNo">1969</span>      for (KeyValueScanner kvs : currentFileScanners) {<a name="line.1969"></a>
-<span class="sourceLineNo">1970</span>        assert kvs.isFileScanner();<a name="line.1970"></a>
-<span class="sourceLineNo">1971</span>        if (kvs.peek() == null) {<a name="line.1971"></a>
-<span class="sourceLineNo">1972</span>          continue;<a name="line.1972"></a>
-<span class="sourceLineNo">1973</span>        }<a name="line.1973"></a>
-<span class="sourceLineNo">1974</span>        filesToReopen.add(name2File.get(kvs.getFilePath().getName()));<a name="line.1974"></a>
-<span class="sourceLineNo">1975</span>      }<a name="line.1975"></a>
-<span class="sourceLineNo">1976</span>      if (filesToReopen.isEmpty()) {<a name="line.1976"></a>
-<span class="sourceLineNo">1977</span>        return null;<a name="line.1977"></a>
+<span class="sourceLineNo">1814</span>   * &lt;p&gt;It is usually invoked at the end of a compaction, but might also be<a name="line.1814"></a>
+<span class="sourceLineNo">1815</span>   * invoked at HStore startup, if the prior execution died midway through.<a name="line.1815"></a>
+<span class="sourceLineNo">1816</span>   *<a name="line.1816"></a>
+<span class="sourceLineNo">1817</span>   * &lt;p&gt;Moving the compacted TreeMap into place means:<a name="line.1817"></a>
+<span class="sourceLineNo">1818</span>   * &lt;pre&gt;<a name="line.1818"></a>
+<span class="sourceLineNo">1819</span>   * 1) Unload all replaced StoreFile, close and collect list to delete.<a name="line.1819"></a>
+<span class="sourceLineNo">1820</span>   * 2) Compute new store size<a name="line.1820"></a>
+<span class="sourceLineNo">1821</span>   * &lt;/pre&gt;<a name="line.1821"></a>
+<span class="sourceLineNo">1822</span>   *<a name="line.1822"></a>
+<span class="sourceLineNo">1823</span>   * @param compactedFiles list of files that were compacted<a name="line.1823"></a>
+<span class="sourceLineNo">1824</span>   */<a name="line.1824"></a>
+<span class="sourceLineNo">1825</span>  @VisibleForTesting<a name="line.1825"></a>
+<span class="sourceLineNo">1826</span>  protected void completeCompaction(Collection&lt;HStoreFile&gt; compactedFiles)<a name="line.1826"></a>
+<span class="sourceLineNo">1827</span>    throws IOException {<a name="line.1827"></a>
+<span class="sourceLineNo">1828</span>    this.storeSize = 0L;<a name="line.1828"></a>
+<span class="sourceLineNo">1829</span>    this.totalUncompressedBytes = 0L;<a name="line.1829"></a>
+<span class="sourceLineNo">1830</span>    for (HStoreFile hsf : this.storeEngine.getStoreFileManager().getStorefiles()) {<a name="line.1830"></a>
+<span class="sourceLineNo">1831</span>      StoreFileReader r = hsf.getReader();<a name="line.1831"></a>
+<span class="sourceLineNo">1832</span>      if (r == null) {<a name="line.1832"></a>
+<span class="sourceLineNo">1833</span>        LOG.warn("StoreFile " + hsf + " has a null Reader");<a name="line.1833"></a>
+<span class="sourceLineNo">1834</span>        continue;<a name="line.1834"></a>
+<span class="sourceLineNo">1835</span>      }<a name="line.1835"></a>
+<span class="sourceLineNo">1836</span>      this.storeSize += r.length();<a name="line.1836"></a>
+<span class="sourceLineNo">1837</span>      this.totalUncompressedBytes += r.getTotalUncompressedBytes();<a name="line.1837"></a>
+<span class="sourceLineNo">1838</span>    }<a name="line.1838"></a>
+<span class="sourceLineNo">1839</span>  }<a name="line.1839"></a>
+<span class="sourceLineNo">1840</span><a name="line.1840"></a>
+<span class="sourceLineNo">1841</span>  /*<a name="line.1841"></a>
+<span class="sourceLineNo">1842</span>   * @param wantedVersions How many versions were asked for.<a name="line.1842"></a>
+<span class="sourceLineNo">1843</span>   * @return wantedVersions or this families' {@link HConstants#VERSIONS}.<a name="line.1843"></a>
+<span class="sourceLineNo">1844</span>   */<a name="line.1844"></a>
+<span class="sourceLineNo">1845</span>  int versionsToReturn(final int wantedVersions) {<a name="line.1845"></a>
+<span class="sourceLineNo">1846</span>    if (wantedVersions &lt;= 0) {<a name="line.1846"></a>
+<span class="sourceLineNo">1847</span>      throw new IllegalArgumentException("Number of versions must be &gt; 0");<a name="line.1847"></a>
+<span class="sourceLineNo">1848</span>    }<a name="line.1848"></a>
+<span class="sourceLineNo">1849</span>    // Make sure we do not return more than maximum versions for this store.<a name="line.1849"></a>
+<span class="sourceLineNo">1850</span>    int maxVersions = this.family.getMaxVersions();<a name="line.1850"></a>
+<span class="sourceLineNo">1851</span>    return wantedVersions &gt; maxVersions ? maxVersions: wantedVersions;<a name="line.1851"></a>
+<span class="sourceLineNo">1852</span>  }<a name="line.1852"></a>
+<span class="sourceLineNo">1853</span><a name="line.1853"></a>
+<span class="sourceLineNo">1854</span>  @Override<a name="line.1854"></a>
+<span class="sourceLineNo">1855</span>  public boolean canSplit() {<a name="line.1855"></a>
+<span class="sourceLineNo">1856</span>    this.lock.readLock().lock();<a name="line.1856"></a>
+<span class="sourceLineNo">1857</span>    try {<a name="line.1857"></a>
+<span class="sourceLineNo">1858</span>      // Not split-able if we find a reference store file present in the store.<a name="line.1858"></a>
+<span class="sourceLineNo">1859</span>      boolean result = !hasReferences();<a name="line.1859"></a>
+<span class="sourceLineNo">1860</span>      if (!result) {<a name="line.1860"></a>
+<span class="sourceLineNo">1861</span>          if (LOG.isTraceEnabled()) {<a name="line.1861"></a>
+<span class="sourceLineNo">1862</span>            LOG.trace("Not splittable; has references: " + this);<a name="line.1862"></a>
+<span class="sourceLineNo">1863</span>          }<a name="line.1863"></a>
+<span class="sourceLineNo">1864</span>      }<a name="line.1864"></a>
+<span class="sourceLineNo">1865</span>      return result;<a name="line.1865"></a>
+<span class="sourceLineNo">1866</span>    } finally {<a name="line.1866"></a>
+<span class="sourceLineNo">1867</span>      this.lock.readLock().unlock();<a name="line.1867"></a>
+<span class="sourceLineNo">1868</span>    }<a name="line.1868"></a>
+<span class="sourceLineNo">1869</span>  }<a name="line.1869"></a>
+<span class="sourceLineNo">1870</span><a name="line.1870"></a>
+<span class="sourceLineNo">1871</span>  /**<a name="line.1871"></a>
+<span class="sourceLineNo">1872</span>   * Determines if Store should be split.<a name="line.1872"></a>
+<span class="sourceLineNo">1873</span>   */<a name="line.1873"></a>
+<span class="sourceLineNo">1874</span>  public Optional&lt;byte[]&gt; getSplitPoint() {<a name="line.1874"></a>
+<span class="sourceLineNo">1875</span>    this.lock.readLock().lock();<a name="line.1875"></a>
+<span class="sourceLineNo">1876</span>    try {<a name="line.1876"></a>
+<span class="sourceLineNo">1877</span>      // Should already be enforced by the split policy!<a name="line.1877"></a>
+<span class="sourceLineNo">1878</span>      assert !this.getRegionInfo().isMetaRegion();<a name="line.1878"></a>
+<span class="sourceLineNo">1879</span>      // Not split-able if we find a reference store file present in the store.<a name="line.1879"></a>
+<span class="sourceLineNo">1880</span>      if (hasReferences()) {<a name="line.1880"></a>
+<span class="sourceLineNo">1881</span>        if (LOG.isTraceEnabled()) {<a name="line.1881"></a>
+<span class="sourceLineNo">1882</span>          LOG.trace("Not splittable; has references: " + this);<a name="line.1882"></a>
+<span class="sourceLineNo">1883</span>        }<a name="line.1883"></a>
+<span class="sourceLineNo">1884</span>        return Optional.empty();<a name="line.1884"></a>
+<span class="sourceLineNo">1885</span>      }<a name="line.1885"></a>
+<span class="sourceLineNo">1886</span>      return this.storeEngine.getStoreFileManager().getSplitPoint();<a name="line.1886"></a>
+<span class="sourceLineNo">1887</span>    } catch(IOException e) {<a name="line.1887"></a>
+<span class="sourceLineNo">1888</span>      LOG.warn("Failed getting store size for " + this, e);<a name="line.1888"></a>
+<span class="sourceLineNo">1889</span>    } finally {<a name="line.1889"></a>
+<span class="sourceLineNo">1890</span>      this.lock.readLock().unlock();<a name="line.1890"></a>
+<span class="sourceLineNo">1891</span>    }<a name="line.1891"></a>
+<span class="sourceLineNo">1892</span>    return Optional.empty();<a name="line.1892"></a>
+<span class="sourceLineNo">1893</span>  }<a name="line.1893"></a>
+<span class="sourceLineNo">1894</span><a name="line.1894"></a>
+<span class="sourceLineNo">1895</span>  @Override<a name="line.1895"></a>
+<span class="sourceLineNo">1896</span>  public long getLastCompactSize() {<a name="line.1896"></a>
+<span class="sourceLineNo">1897</span>    return this.lastCompactSize;<a name="line.1897"></a>
+<span class="sourceLineNo">1898</span>  }<a name="line.1898"></a>
+<span class="sourceLineNo">1899</span><a name="line.1899"></a>
+<span class="sourceLineNo">1900</span>  @Override<a name="line.1900"></a>
+<span class="sourceLineNo">1901</span>  public long getSize() {<a name="line.1901"></a>
+<span class="sourceLineNo">1902</span>    return storeSize;<a name="line.1902"></a>
+<span class="sourceLineNo">1903</span>  }<a name="line.1903"></a>
+<span class="sourceLineNo">1904</span><a name="line.1904"></a>
+<span class="sourceLineNo">1905</span>  public void triggerMajorCompaction() {<a name="line.1905"></a>
+<span class="sourceLineNo">1906</span>    this.forceMajor = true;<a name="line.1906"></a>
+<span class="sourceLineNo">1907</span>  }<a name="line.1907"></a>
+<span class="sourceLineNo">1908</span><a name="line.1908"></a>
+<span class="sourceLineNo">1909</span><a name="line.1909"></a>
+<span class="sourceLineNo">1910</span>  //////////////////////////////////////////////////////////////////////////////<a name="line.1910"></a>
+<span class="sourceLineNo">1911</span>  // File administration<a name="line.1911"></a>
+<span class="sourceLineNo">1912</span>  //////////////////////////////////////////////////////////////////////////////<a name="line.1912"></a>
+<span class="sourceLineNo">1913</span><a name="line.1913"></a>
+<span class="sourceLineNo">1914</span>  /**<a name="line.1914"></a>
+<span class="sourceLineNo">1915</span>   * Return a scanner for both the memstore and the HStore files. Assumes we are not in a<a name="line.1915"></a>
+<span class="sourceLineNo">1916</span>   * compaction.<a name="line.1916"></a>
+<span class="sourceLineNo">1917</span>   * @param scan Scan to apply when scanning the stores<a name="line.1917"></a>
+<span class="sourceLineNo">1918</span>   * @param targetCols columns to scan<a name="line.1918"></a>
+<span class="sourceLineNo">1919</span>   * @return a scanner over the current key values<a name="line.1919"></a>
+<span class="sourceLineNo">1920</span>   * @throws IOException on failure<a name="line.1920"></a>
+<span class="sourceLineNo">1921</span>   */<a name="line.1921"></a>
+<span class="sourceLineNo">1922</span>  public KeyValueScanner getScanner(Scan scan,<a name="line.1922"></a>
+<span class="sourceLineNo">1923</span>      final NavigableSet&lt;byte []&gt; targetCols, long readPt) throws IOException {<a name="line.1923"></a>
+<span class="sourceLineNo">1924</span>    lock.readLock().lock();<a name="line.1924"></a>
+<span class="sourceLineNo">1925</span>    try {<a name="line.1925"></a>
+<span class="sourceLineNo">1926</span>      return createScanner(scan, targetCols, readPt);<a name="line.1926"></a>
+<span class="sourceLineNo">1927</span>    } finally {<a name="line.1927"></a>
+<span class="sourceLineNo">1928</span>      lock.readLock().unlock();<a name="line.1928"></a>
+<span class="sourceLineNo">1929</span>    }<a name="line.1929"></a>
+<span class="sourceLineNo">1930</span>  }<a name="line.1930"></a>
+<span class="sourceLineNo">1931</span><a name="line.1931"></a>
+<span class="sourceLineNo">1932</span>  protected KeyValueScanner createScanner(Scan scan, final NavigableSet&lt;byte[]&gt; targetCols,<a name="line.1932"></a>
+<span class="sourceLineNo">1933</span>      long readPt) throws IOException {<a name="line.1933"></a>
+<span class="sourceLineNo">1934</span>    return scan.isReversed() ? new ReversedStoreScanner(this,<a name="line.1934"></a>
+<span class="sourceLineNo">1935</span>      getScanInfo(), scan, targetCols, readPt) : new StoreScanner(this,<a name="line.1935"></a>
+<span class="sourceLineNo">1936</span>      getScanInfo(), scan, targetCols, readPt);<a name="line.1936"></a>
+<span class="sourceLineNo">1937</span>  }<a name="line.1937"></a>
+<span class="sourceLineNo">1938</span><a name="line.1938"></a>
+<span class="sourceLineNo">1939</span>  /**<a name="line.1939"></a>
+<span class="sourceLineNo">1940</span>   * Recreates the scanners on the current list of active store file scanners<a name="line.1940"></a>
+<span class="sourceLineNo">1941</span>   * @param currentFileScanners the current set of active store file scanners<a name="line.1941"></a>
+<span class="sourceLineNo">1942</span>   * @param cacheBlocks cache the blocks or not<a name="line.1942"></a>
+<span class="sourceLineNo">1943</span>   * @param usePread use pread or not<a name="line.1943"></a>
+<span class="sourceLineNo">1944</span>   * @param isCompaction is the scanner for compaction<a name="line.1944"></a>
+<span class="sourceLineNo">1945</span>   * @param matcher the scan query matcher<a name="line.1945"></a>
+<span class="sourceLineNo">1946</span>   * @param startRow the scan's start row<a name="line.1946"></a>
+<span class="sourceLineNo">1947</span>   * @param includeStartRow should the scan include the start row<a name="line.1947"></a>
+<span class="sourceLineNo">1948</span>   * @param stopRow the scan's stop row<a name="line.1948"></a>
+<span class="sourceLineNo">1949</span>   * @param includeStopRow should the scan include the stop row<a name="line.1949"></a>
+<span class="sourceLineNo">1950</span>   * @param readPt the read point of the current scane<a name="line.1950"></a>
+<span class="sourceLineNo">1951</span>   * @param includeMemstoreScanner whether the current scanner should include memstorescanner<a name="line.1951"></a>
+<span class="sourceLineNo">1952</span>   * @return list of scanners recreated on the current Scanners<a name="line.1952"></a>
+<span class="sourceLineNo">1953</span>   * @throws IOException<a name="line.1953"></a>
+<span class="sourceLineNo">1954</span>   */<a name="line.1954"></a>
+<span class="sourceLineNo">1955</span>  public List&lt;KeyValueScanner&gt; recreateScanners(List&lt;KeyValueScanner&gt; currentFileScanners,<a name="line.1955"></a>
+<span class="sourceLineNo">1956</span>      boolean cacheBlocks, boolean usePread, boolean isCompaction, ScanQueryMatcher matcher,<a name="line.1956"></a>
+<span class="sourceLineNo">1957</span>      byte[] startRow, boolean includeStartRow, byte[] stopRow, boolean includeStopRow, long readPt,<a name="line.1957"></a>
+<span class="sourceLineNo">1958</span>      boolean includeMemstoreScanner) throws IOException {<a name="line.1958"></a>
+<span class="sourceLineNo">1959</span>    this.lock.readLock().lock();<a name="line.1959"></a>
+<span class="sourceLineNo">1960</span>    try {<a name="line.1960"></a>
+<span class="sourceLineNo">1961</span>      Map&lt;String, HStoreFile&gt; name2File =<a name="line.1961"></a>
+<span class="sourceLineNo">1962</span>          new HashMap&lt;&gt;(getStorefilesCount() + getCompactedFilesCount());<a name="line.1962"></a>
+<span class="sourceLineNo">1963</span>      for (HStoreFile file : getStorefiles()) {<a name="line.1963"></a>
+<span class="sourceLineNo">1964</span>        name2File.put(file.getFileInfo().getActiveFileName(), file);<a name="line.1964"></a>
+<span class="sourceLineNo">1965</span>      }<a name="line.1965"></a>
+<span class="sourceLineNo">1966</span>      if (getCompactedFiles() != null) {<a name="line.1966"></a>
+<span class="sourceLineNo">1967</span>        for (HStoreFile file : getCompactedFiles()) {<a name="line.1967"></a>
+<span class="sourceLineNo">1968</span>          name2File.put(file.getFileInfo().getActiveFileName(), file);<a name="line.1968"></a>
+<span class="sourceLineNo">1969</span>        }<a name="line.1969"></a>
+<span class="sourceLineNo">1970</span>      }<a name="line.1970"></a>
+<span class="sourceLineNo">1971</span>      List&lt;HStoreFile&gt; filesToReopen = new ArrayList&lt;&gt;();<a name="line.1971"></a>
+<span class="sourceLineNo">1972</span>      for (KeyValueScanner kvs : currentFileScanners) {<a name="line.1972"></a>
+<span class="sourceLineNo">1973</span>        assert kvs.isFileScanner();<a name="line.1973"></a>
+<span class="sourceLineNo">1974</span>        if (kvs.peek() == null) {<a name="line.1974"></a>
+<span class="sourceLineNo">1975</span>          continue;<a name="line.1975"></a>
+<span class="sourceLineNo">1976</span>        }<a name="line.1976"></a>
+<span class="sourceLineNo">1977</span>        filesToReopen.add(name2File.get(kvs.getFilePath().getName()));<a name="line.1977"></a>
 <span class="sourceLineNo">1978</span>      }<a name="line.1978"></a>
-<span class="sourceLineNo">1979</span>      return getScanners(filesToReopen, cacheBlocks, false, false, matcher, startRow,<a name="line.1979"></a>
-<span class="sourceLineNo">1980</span>        includeStartRow, stopRow, includeStopRow, readPt, false);<a name="line.1980"></a>
-<span class="sourceLineNo">1981</span>    } finally {<a name="line.1981"></a>
-<span class="sourceLineNo">1982</span>      this.lock.readLock().unlock();<a name="line.1982"></a>
-<span class="sourceLineNo">1983</span>    }<a name="line.1983"></a>
-<span class="sourceLineNo">1984</span>  }<a name="line.1984"></a>
-<span class="sourceLineNo">1985</span><a name="line.1985"></a>
-<span class="sourceLineNo">1986</span>  @Override<a name="line.1986"></a>
-<span class="sourceLineNo">1987</span>  public String toString() {<a name="line.1987"></a>
-<span class="sourceLineNo">1988</span>    return this.getColumnFamilyName();<a name="line.1988"></a>
-<span class="sourceLineNo">1989</span>  }<a name="line.1989"></a>
-<span class="sourceLineNo">1990</span><a name="line.1990"></a>
-<span class="sourceLineNo">1991</span>  @Override<a name="line.1991"></a>
-<span class="sourceLineNo">1992</span>  public int getStorefilesCount() {<a name="line.1992"></a>
-<span class="sourceLineNo">1993</span>    return this.storeEngine.getStoreFileManager().getStorefileCount();<a name="line.1993"></a>
-<span class="sourceLineNo">1994</span>  }<a name="line.1994"></a>
-<span class="sourceLineNo">1995</span><a name="line.1995"></a>
-<span class="sourceLineNo">1996</span>  @Override<a name="line.1996"></a>
-<span class="sourceLineNo">1997</span>  public int getCompactedFilesCount() {<a name="line.1997"></a>
-<span class="sourceLineNo">1998</span>    return this.storeEngine.getStoreFileManager().getCompactedFilesCount();<a name="line.1998"></a>
-<span class="sourceLineNo">1999</span>  }<a name="line.1999"></a>
-<span class="sourceLineNo">2000</span><a name="line.2000"></a>
-<span class="sourceLineNo">2001</span>  private LongStream getStoreFileAgeStream() {<a name="line.2001"></a>
-<span class="sourceLineNo">2002</span>    return this.storeEngine.getStoreFileManager().getStorefiles().stream().filter(sf -&gt; {<a name="line.2002"></a>
-<span class="sourceLineNo">2003</span>      if (sf.getReader() == null) {<a name="line.2003"></a>
-<span class="sourceLineNo">2004</span>        LOG.warn("StoreFile " + sf + " has a null Reader");<a name="line.2004"></a>
-<span class="sourceLineNo">2005</span>        return false;<a name="line.2005"></a>
-<span class="sourceLineNo">2006</span>      } else {<a name="line.2006"></a>
-<span class="sourceLineNo">2007</span>        return true;<a name="line.2007"></a>
-<span class="sourceLineNo">2008</span>      }<a name="line.2008"></a>
-<span class="sourceLineNo">2009</span>    }).filter(HStoreFile::isHFile).mapToLong(sf -&gt; sf.getFileInfo().getCreatedTimestamp())<a name="line.2009"></a>
-<span class="sourceLineNo">2010</span>        .map(t -&gt; EnvironmentEdgeManager.currentTime() - t);<a name="line.2010"></a>
-<span class="sourceLineNo">2011</span>  }<a name="line.2011"></a>
-<span class="sourceLineNo">2012</span><a name="line.2012"></a>
-<span class="sourceLineNo">2013</span>  @Override<a name="line.2013"></a>
-<span class="sourceLineNo">2014</span>  public OptionalLong getMaxStoreFileAge() {<a name="line.2014"></a>
-<span class="sourceLineNo">2015</span>    return getStoreFileAgeStream().max();<a name="line.2015"></a>
-<span class="sourceLineNo">2016</span>  }<a name="line.2016"></a>
-<span class="sourceLineNo">2017</span><a name="line.2017"></a>
-<span class="sourceLineNo">2018</span>  @Override<a name="line.2018"></a>
-<span class="sourceLineNo">2019</span>  public OptionalLong getMinStoreFileAge() {<a name="line.2019"></a>
-<span class="sourceLineNo">2020</span>    return getStoreFileAgeStream().min();<a name="line.2020"></a>
-<span class="sourceLineNo">2021</span>  }<a name="line.2021"></a>
-<span class="sourceLineNo">2022</span><a name="line.2022"></a>
-<span class="sourceLineNo">2023</span>  @Override<a name="line.2023"></a>
-<span class="sourceLineNo">2024</span>  public OptionalDouble getAvgStoreFileAge() {<a name="line.2024"></a>
-<span class="sourceLineNo">2025</span>    return getStoreFileAgeStream().average();<a name="line.2025"></a>
-<span class="sourceLineNo">2026</span>  }<a name="line.2026"></a>
-<span class="sourceLineNo">2027</span><a name="line.2027"></a>
-<span class="sourceLineNo">2028</span>  @Override<a name="line.2028"></a>
-<span class="sourceLineNo">2029</span>  public long getNumReferenceFiles() {<a name="line.2029"></a>
-<span class="sourceLineNo">2030</span>    return this.storeEngine.getStoreFileManager().getStorefiles().stream()<a name="line.2030"></a>
-<span class="sourceLineNo">2031</span>        .filter(HStoreFile::isReference).count();<a name="line.2031"></a>
-<span class="sourceLineNo">2032</span>  }<a name="line.2032"></a>
-<span class="sourceLineNo">2033</span><a name="line.2033"></a>
-<span class="sourceLineNo">2034</span>  @Override<a name="line.2034"></a>
-<span class="sourceLineNo">2035</span>  public long getNumHFiles() {<a name="line.2035"></a>
-<span class="sourceLineNo">2036</span>    return this.storeEngine.getStoreFileManager().getStorefiles().stream()<a name="line.2036"></a>
-<span class="sourceLineNo">2037</span>        .filter(HStoreFile::isHFile).count();<a name="line.2037"></a>
-<span class="sourceLineNo">2038</span>  }<a name="line.2038"></a>
-<span class="sourceLineNo">2039</span><a name="line.2039"></a>
-<span class="sourceLineNo">2040</span>  @Override<a name="line.2040"></a>
-<span class="sourceLineNo">2041</span>  public long getStoreSizeUncompressed() {<a name="line.2041"></a>
-<span class="sourceLineNo">2042</span>    return this.totalUncompressedBytes;<a name="line.2042"></a>
-<span class="sourceLineNo">2043</span>  }<a name="line.2043"></a>
-<span class="sourceLineNo">2044</span><a name="line.2044"></a>
-<span class="sourceLineNo">2045</span>  @Override<a name="line.2045"></a>
-<span class="sourceLineNo">2046</span>  public long getStorefilesSize() {<a name="line.2046"></a>
-<span class="sourceLineNo">2047</span>    // Include all StoreFiles<a name="line.2047"></a>
-<span class="sourceLineNo">2048</span>    return getStorefilesSize(storeFile -&gt; true);<a name="line.2048"></a>
-<span class="sourceLineNo">2049</span>  }<a name="line.2049"></a>
-<span class="sourceLineNo">2050</span><a name="line.2050"></a>
-<span class="sourceLineNo">2051</span>  @Override<a name="line.2051"></a>
-<span class="sourceLineNo">2052</span>  public long getHFilesSize() {<a name="line.2052"></a>
-<span class="sourceLineNo">2053</span>    // Include only StoreFiles which are HFiles<a name="line.2053"></a>
-<span class="sourceLineNo">2054</span>    return getStorefilesSize(storeFile -&gt; storeFile.isHFile());<a name="line.2054"></a>
-<span class="sourceLineNo">2055</span>  }<a name="line.2055"></a>
-<span class="sourceLineNo">2056</span><a name="line.2056"></a>
-<span class="sourceLineNo">2057</span>  private long getStorefilesSize(Predicate&lt;HStoreFile&gt; predicate) {<a name="line.2057"></a>
-<span class="sourceLineNo">2058</span>    return this.storeEngine.getStoreFileManager().getStorefiles().stream().filter(sf -&gt; {<a name="line.2058"></a>
-<span class="sourceLineNo">2059</span>      if (sf.getReader() == null) {<a name="line.2059"></a>
-<span class="sourceLineNo">2060</span>        LOG.warn("StoreFile " + sf + " has a null Reader");<a name="line.2060"></a>
-<span class="sourceLineNo">2061</span>        return false;<a name="line.2061"></a>
-<span class="sourceLineNo">2062</span>      } else {<a name="line.2062"></a>
-<span class="sourceLineNo">2063</span>        return true;<a name="line.2063"></a>
-<span class="sourceLineNo">2064</span>      }<a name="line.2064"></a>
-<span class="sourceLineNo">2065</span>    }).filter(predicate).mapToLong(sf -&gt; sf.getReader().length()).sum();<a name="line.2065"></a>
-<span class="sourceLineNo">2066</span>  }<a name="line.2066"></a>
-<span class="sourceLineNo">2067</span><a name="line.2067"></a>
-<span class="sourceLineNo">2068</span>  private long getStoreFileFieldSize(ToLongFunction&lt;StoreFileReader&gt; f) {<a name="line.2068"></a>
-<span class="sourceLineNo">2069</span>    return this.storeEngine.getStoreFileManager().getStorefiles().stream().filter(sf -&gt; {<a name="line.2069"></a>
-<span class="sourceLineNo">2070</span>      if (sf.getReader() == null) {<a name="line.2070"></a>
-<span class="sourceLineNo">2071</span>        LOG.warn("StoreFile " + sf + " has a null Reader");<a name="line.2071"></a>
-<span class="sourceLineNo">2072</span>        return false;<a name="line.2072"></a>
-<span class="sourceLineNo">2073</span>      } else {<a name="line.2073"></a>
-<span class="sourceLineNo">2074</span>        return true;<a name="line.2074"></a>
-<span class="sourceLineNo">2075</span>      }<a name="line.2075"></a>
-<span class="sourceLineNo">2076</span>    }).map(HStoreFile::getReader).mapToLong(f).sum();<a name="line.2076"></a>
-<span class="sourceLineNo">2077</span>  }<a name="line.2077"></a>
-<span class="sourceLineNo">2078</span><a name="line.2078"></a>
-<span class="sourceLineNo">2079</span>  @Override<a name="line.2079"></a>
-<span class="sourceLineNo">2080</span>  public long getStorefilesIndexSize() {<a name="line.2080"></a>
-<span class="sourceLineNo">2081</span>    return getStoreFileFieldSize(StoreFileReader::indexSize);<a name="line.2081"></a>
-<span class="sourceLineNo">2082</span>  }<a name="line.2082"></a>
-<span class="sourceLineNo">2083</span><a name="line.2083"></a>
-<span class="sourceLineNo">2084</span>  @Override<a name="line.2084"></a>
-<span class="sourceLineNo">2085</span>  public long getTotalStaticIndexSize() {<a name="line.2085"></a>
-<span class="sourceLineNo">2086</span>    return getStoreFileFieldSize(StoreFileReader::getUncompressedDataIndexSize);<a name="line.2086"></a>
-<span class="sourceLineNo">2087</span>  }<a name="line.2087"></a>
-<span class="sourceLineNo">2088</span><a name="line.2088"></a>
-<span class="sourceLineNo">2089</span>  @Override<a name="line.2089"></a>
-<span class="sourceLineNo">2090</span>  public long getTotalStaticBloomSize() {<a name="line.2090"></a>
-<span class="sourceLineNo">2091</span>    return getStoreFileFieldSize(StoreFileReader::getTotalBloomSize);<a name="line.2091"></a>
-<span class="sourceLineNo">2092</span>  }<a name="line.2092"></a>
-<span class="sourceLineNo">2093</span><a name="line.2093"></a>
-<span class="sourceLineNo">2094</span>  @Override<a name="line.2094"></a>
-<span class="sourceLineNo">2095</span>  public MemStoreSize getMemStoreSize() {<a name="line.2095"></a>
-<span class="sourceLineNo">2096</span>    return this.memstore.size();<a name="line.2096"></a>
-<span class="sourceLineNo">2097</span>  }<a name="line.2097"></a>
-<span class="sourceLineNo">2098</span><a name="line.2098"></a>
-<span class="sourceLineNo">2099</span>  @Override<a name="line.2099"></a>
-<span class="sourceLineNo">2100</span>  public int getCompactPriority() {<a name="line.2100"></a>
-<span class="sourceLineNo">2101</span>    int priority = this.storeEngine.getStoreFileManager().getStoreCompactionPriority();<a name="line.2101"></a>
-<span class="sourceLineNo">2102</span>    if (priority == PRIORITY_USER) {<a name="line.2102"></a>
-<span class="sourceLineNo">2103</span>      LOG.warn("Compaction priority is USER despite there being no user compaction");<a name="line.2103"></a>
-<span class="sourceLineNo">2104</span>    }<a name="line.2104"></a>
-<span class="sourceLineNo">2105</span>    return priority;<a name="line.2105"></a>
-<span class="sourceLineNo">2106</span>  }<a name="line.2106"></a>
-<span class="sourceLineNo">2107</span><a name="line.2107"></a>
-<span class="sourceLineNo">2108</span>  public boolean throttleCompaction(long compactionSize) {<a name="line.2108"></a>
-<span class="sourceLineNo">2109</span>    return storeEngine.getCompactionPolicy().throttleCompaction(compactionSize);<a name="line.2109"></a>
-<span class="sourceLineNo">2110</span>  }<a name="line.2110"></a>
-<span class="sourceLineNo">2111</span><a name="line.2111"></a>
-<span class="sourceLineNo">2112</span>  public HRegion getHRegion() {<a name="line.2112"></a>
-<span class="sourceLineNo">2113</span>    return this.region;<a name="line.2113"></a>
-<span class="sourceLineNo">2114</span>  }<a name="line.2114"></a>
-<span class="sourceLineNo">2115</span><a name="line.2115"></a>
-<span class="sourceLineNo">2116</span>  public RegionCoprocessorHost getCoprocessorHost() {<a name="line.2116"></a>
-<span class="sourceLineNo">2117</span>    return this.region.getCoprocessorHost();<a name="line.2117"></a>
-<span class="sourceLineNo">2118</span>  }<a name="line.2118"></a>
-<span class="sourceLineNo">2119</span><a name="line.2119"></a>
-<span class="sourceLineNo">2120</span>  @Override<a name="line.2120"></a>
-<span class="sourceLineNo">2121</span>  public RegionInfo getRegionInfo() {<a name="line.2121"></a>
-<span class="sourceLineNo">2122</span>    return this.fs.getRegionInfo();<a name="line.2122"></a>
-<span class="sourceLineNo">2123</span>  }<a name="line.2123"></a>
-<span class="sourceLineNo">2124</span><a name="line.2124"></a>
-<span class="sourceLineNo">2125</span>  @Override<a name="line.2125"></a>
-<span class="sourceLineNo">2126</span>  public boolean areWritesEnabled() {<a name="line.2126"></a>
-<span class="sourceLineNo">2127</span>    return this.region.areWritesEnabled();<a name="line.2127"></a>
-<span class="sourceLineNo">2128</span>  }<a name="line.2128"></a>
-<span class="sourceLineNo">2129</span><a name="line.2129"></a>
-<span class="sourceLineNo">2130</span>  @Override<a name="line.2130"></a>
-<span class="sourceLineNo">2131</span>  public long getSmallestReadPoint() {<a name="line.2131"></a>
-<span class="sourceLineNo">2132</span>    return this.region.getSmallestReadPoint();<a name="line.2132"></a>
-<span class="sourceLineNo">2133</span>  }<a name="line.2133"></a>
-<span class="sourceLineNo">2134</span><a name="line.2134"></a>
-<span class="sourceLineNo">2135</span>  /**<a name="line.2135"></a>
-<span class="sourceLineNo">2136</span>   * Adds or replaces the specified KeyValues.<a name="line.2136"></a>
-<span class="sourceLineNo">2137</span>   * &lt;p&gt;<a name="line.2137"></a>
-<span class="sourceLineNo">2138</span>   * For each KeyValue specified, if a cell with the same row, family, and qualifier exists in<a name="line.2138"></a>
-<span class="sourceLineNo">2139</span>   * MemStore, it will be replaced. Otherwise, it will just be inserted to MemStore.<a name="line.2139"></a>
+<span class="sourceLineNo">1979</span>      if (filesToReopen.isEmpty()) {<a name="line.1979"></a>
+<span class="sourceLineNo">1980</span>        return null;<a name="line.1980"></a>
+<span class="sourceLineNo">1981</span>      }<a name="line.1981"></a>
+<span class="sourceLineNo">1982</span>      return getScanners(filesToReopen, cacheBlocks, false, false, matcher, startRow,<a name="line.1982"></a>
+<span class="sourceLineNo">1983</span>        includeStartRow, stopRow, includeStopRow, readPt, false);<a name="line.1983"></a>
+<span class="sourceLineNo">1984</span>    } finally {<a name="line.1984"></a>
+<span class="sourceLineNo">1985</span>      this.lock.readLock().unlock();<a name="line.1985"></a>
+<span class="sourceLineNo">1986</span>    }<a name="line.1986"></a>
+<span class="sourceLineNo">1987</span>  }<a name="line.1987"></a>
+<span class="sourceLineNo">1988</span><a name="line.1988"></a>
+<span class="sourceLineNo">1989</span>  @Override<a name="line.1989"></a>
+<span class="sourceLineNo">1990</span>  public String toString() {<a name="line.1990"></a>
+<span class="sourceLineNo">1991</span>    return this.getColumnFamilyName();<a name="line.1991"></a>
+<span class="sourceLineNo">1992</span>  }<a name="line.1992"></a>
+<span class="sourceLineNo">1993</span><a name="line.1993"></a>
+<span class="sourceLineNo">1994</span>  @Override<a name="line.1994"></a>
+<span class="sourceLineNo">1995</span>  public int getStorefilesCount() {<a name="line.1995"></a>
+<span class="sourceLineNo">1996</span>    return this.storeEngine.getStoreFileManager().getStorefileCount();<a name="line.1996"></a>
+<span class="sourceLineNo">1997</span>  }<a name="line.1997"></a>
+<span class="sourceLineNo">1998</span><a name="line.1998"></a>
+<span class="sourceLineNo">1999</span>  @Override<a name="line.1999"></a>
+<span class="sourceLineNo">2000</span>  public int getCompactedFilesCount() {<a name="line.2000"></a>
+<span class="sourceLineNo">2001</span>    return this.storeEngine.getStoreFileManager().getCompactedFilesCount();<a name="line.2001"></a>
+<span class="sourceLineNo">2002</span>  }<a name="line.2002"></a>
+<span class="sourceLineNo">2003</span><a name="line.2003"></a>
+<span class="sourceLineNo">2004</span>  private LongStream getStoreFileAgeStream() {<a name="line.2004"></a>
+<span class="sourceLineNo">2005</span>    return this.storeEngine.getStoreFileManager().getStorefiles().stream().filter(sf -&gt; {<a name="line.2005"></a>
+<span class="sourceLineNo">2006</span>      if (sf.getReader() == null) {<a name="line.2006"></a>
+<span class="sourceLineNo">2007</span>        LOG.warn("StoreFile " + sf + " has a null Reader");<a name="line.2007"></a>
+<span class="sourceLineNo">2008</span>        return false;<a name="line.2008"></a>
+<span class="sourceLineNo">2009</span>   

<TRUNCATED>

Mime
View raw message