hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From git-site-r...@apache.org
Subject [16/38] hbase-site git commit: Published site at 0ab7c3a18906fcf33af38da29c211ac7fcb46492.
Date Fri, 26 Oct 2018 14:53:55 GMT
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/fa850293/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/HRegion.ObservedExceptionsInBatch.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/HRegion.ObservedExceptionsInBatch.html b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/HRegion.ObservedExceptionsInBatch.html
index da040ad..d6702a7 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/HRegion.ObservedExceptionsInBatch.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/HRegion.ObservedExceptionsInBatch.html
@@ -2957,7 +2957,7 @@
 <span class="sourceLineNo">2949</span>        if(family == null) {<a name="line.2949"></a>
 <span class="sourceLineNo">2950</span>          throw new NoSuchColumnFamilyException("Empty family is invalid");<a name="line.2950"></a>
 <span class="sourceLineNo">2951</span>        }<a name="line.2951"></a>
-<span class="sourceLineNo">2952</span>        checkFamily(family);<a name="line.2952"></a>
+<span class="sourceLineNo">2952</span>        checkFamily(family, delete.getDurability());<a name="line.2952"></a>
 <span class="sourceLineNo">2953</span>      }<a name="line.2953"></a>
 <span class="sourceLineNo">2954</span>    }<a name="line.2954"></a>
 <span class="sourceLineNo">2955</span>  }<a name="line.2955"></a>
@@ -3569,7 +3569,7 @@
 <span class="sourceLineNo">3561</span><a name="line.3561"></a>
 <span class="sourceLineNo">3562</span>    @Override<a name="line.3562"></a>
 <span class="sourceLineNo">3563</span>    public void checkAndPreparePut(Put p) throws IOException {<a name="line.3563"></a>
-<span class="sourceLineNo">3564</span>      region.checkFamilies(p.getFamilyCellMap().keySet());<a name="line.3564"></a>
+<span class="sourceLineNo">3564</span>      region.checkFamilies(p.getFamilyCellMap().keySet(), p.getDurability());<a name="line.3564"></a>
 <span class="sourceLineNo">3565</span>    }<a name="line.3565"></a>
 <span class="sourceLineNo">3566</span><a name="line.3566"></a>
 <span class="sourceLineNo">3567</span>    @Override<a name="line.3567"></a>
@@ -4462,4304 +4462,4307 @@
 <span class="sourceLineNo">4454</span>    store.add(cell, memstoreAccounting);<a name="line.4454"></a>
 <span class="sourceLineNo">4455</span>  }<a name="line.4455"></a>
 <span class="sourceLineNo">4456</span><a name="line.4456"></a>
-<span class="sourceLineNo">4457</span>  /**<a name="line.4457"></a>
-<span class="sourceLineNo">4458</span>   * Check the collection of families for validity.<a name="line.4458"></a>
-<span class="sourceLineNo">4459</span>   * @param families<a name="line.4459"></a>
-<span class="sourceLineNo">4460</span>   * @throws NoSuchColumnFamilyException<a name="line.4460"></a>
-<span class="sourceLineNo">4461</span>   */<a name="line.4461"></a>
-<span class="sourceLineNo">4462</span>  public void checkFamilies(Collection&lt;byte[]&gt; families) throws NoSuchColumnFamilyException {<a name="line.4462"></a>
-<span class="sourceLineNo">4463</span>    for (byte[] family : families) {<a name="line.4463"></a>
-<span class="sourceLineNo">4464</span>      checkFamily(family);<a name="line.4464"></a>
-<span class="sourceLineNo">4465</span>    }<a name="line.4465"></a>
-<span class="sourceLineNo">4466</span>  }<a name="line.4466"></a>
-<span class="sourceLineNo">4467</span><a name="line.4467"></a>
-<span class="sourceLineNo">4468</span>  /**<a name="line.4468"></a>
-<span class="sourceLineNo">4469</span>   * Check the collection of families for valid timestamps<a name="line.4469"></a>
-<span class="sourceLineNo">4470</span>   * @param familyMap<a name="line.4470"></a>
-<span class="sourceLineNo">4471</span>   * @param now current timestamp<a name="line.4471"></a>
-<span class="sourceLineNo">4472</span>   * @throws FailedSanityCheckException<a name="line.4472"></a>
-<span class="sourceLineNo">4473</span>   */<a name="line.4473"></a>
-<span class="sourceLineNo">4474</span>  public void checkTimestamps(final Map&lt;byte[], List&lt;Cell&gt;&gt; familyMap, long now)<a name="line.4474"></a>
-<span class="sourceLineNo">4475</span>      throws FailedSanityCheckException {<a name="line.4475"></a>
-<span class="sourceLineNo">4476</span>    if (timestampSlop == HConstants.LATEST_TIMESTAMP) {<a name="line.4476"></a>
-<span class="sourceLineNo">4477</span>      return;<a name="line.4477"></a>
-<span class="sourceLineNo">4478</span>    }<a name="line.4478"></a>
-<span class="sourceLineNo">4479</span>    long maxTs = now + timestampSlop;<a name="line.4479"></a>
-<span class="sourceLineNo">4480</span>    for (List&lt;Cell&gt; kvs : familyMap.values()) {<a name="line.4480"></a>
-<span class="sourceLineNo">4481</span>      // Optimization: 'foreach' loop is not used. See:<a name="line.4481"></a>
-<span class="sourceLineNo">4482</span>      // HBASE-12023 HRegion.applyFamilyMapToMemstore creates too many iterator objects<a name="line.4482"></a>
-<span class="sourceLineNo">4483</span>      assert kvs instanceof RandomAccess;<a name="line.4483"></a>
-<span class="sourceLineNo">4484</span>      int listSize  = kvs.size();<a name="line.4484"></a>
-<span class="sourceLineNo">4485</span>      for (int i=0; i &lt; listSize; i++) {<a name="line.4485"></a>
-<span class="sourceLineNo">4486</span>        Cell cell = kvs.get(i);<a name="line.4486"></a>
-<span class="sourceLineNo">4487</span>        // see if the user-side TS is out of range. latest = server-side<a name="line.4487"></a>
-<span class="sourceLineNo">4488</span>        long ts = cell.getTimestamp();<a name="line.4488"></a>
-<span class="sourceLineNo">4489</span>        if (ts != HConstants.LATEST_TIMESTAMP &amp;&amp; ts &gt; maxTs) {<a name="line.4489"></a>
-<span class="sourceLineNo">4490</span>          throw new FailedSanityCheckException("Timestamp for KV out of range "<a name="line.4490"></a>
-<span class="sourceLineNo">4491</span>              + cell + " (too.new=" + timestampSlop + ")");<a name="line.4491"></a>
-<span class="sourceLineNo">4492</span>        }<a name="line.4492"></a>
-<span class="sourceLineNo">4493</span>      }<a name="line.4493"></a>
+<span class="sourceLineNo">4457</span>  private void checkFamilies(Collection&lt;byte[]&gt; families, Durability durability)<a name="line.4457"></a>
+<span class="sourceLineNo">4458</span>      throws NoSuchColumnFamilyException, InvalidMutationDurabilityException {<a name="line.4458"></a>
+<span class="sourceLineNo">4459</span>    for (byte[] family : families) {<a name="line.4459"></a>
+<span class="sourceLineNo">4460</span>      checkFamily(family, durability);<a name="line.4460"></a>
+<span class="sourceLineNo">4461</span>    }<a name="line.4461"></a>
+<span class="sourceLineNo">4462</span>  }<a name="line.4462"></a>
+<span class="sourceLineNo">4463</span><a name="line.4463"></a>
+<span class="sourceLineNo">4464</span>  private void checkFamily(final byte[] family, Durability durability)<a name="line.4464"></a>
+<span class="sourceLineNo">4465</span>      throws NoSuchColumnFamilyException, InvalidMutationDurabilityException {<a name="line.4465"></a>
+<span class="sourceLineNo">4466</span>    checkFamily(family);<a name="line.4466"></a>
+<span class="sourceLineNo">4467</span>    if (durability.equals(Durability.SKIP_WAL)<a name="line.4467"></a>
+<span class="sourceLineNo">4468</span>        &amp;&amp; htableDescriptor.getColumnFamily(family).getScope()<a name="line.4468"></a>
+<span class="sourceLineNo">4469</span>        != HConstants.REPLICATION_SCOPE_LOCAL) {<a name="line.4469"></a>
+<span class="sourceLineNo">4470</span>      throw new InvalidMutationDurabilityException(<a name="line.4470"></a>
+<span class="sourceLineNo">4471</span>          "Mutation's durability is SKIP_WAL but table's column family " + Bytes.toString(family)<a name="line.4471"></a>
+<span class="sourceLineNo">4472</span>              + " need replication");<a name="line.4472"></a>
+<span class="sourceLineNo">4473</span>    }<a name="line.4473"></a>
+<span class="sourceLineNo">4474</span>  }<a name="line.4474"></a>
+<span class="sourceLineNo">4475</span><a name="line.4475"></a>
+<span class="sourceLineNo">4476</span>  void checkFamily(final byte[] family) throws NoSuchColumnFamilyException {<a name="line.4476"></a>
+<span class="sourceLineNo">4477</span>    if (!this.htableDescriptor.hasColumnFamily(family)) {<a name="line.4477"></a>
+<span class="sourceLineNo">4478</span>      throw new NoSuchColumnFamilyException(<a name="line.4478"></a>
+<span class="sourceLineNo">4479</span>          "Column family " + Bytes.toString(family) + " does not exist in region " + this<a name="line.4479"></a>
+<span class="sourceLineNo">4480</span>              + " in table " + this.htableDescriptor);<a name="line.4480"></a>
+<span class="sourceLineNo">4481</span>    }<a name="line.4481"></a>
+<span class="sourceLineNo">4482</span>  }<a name="line.4482"></a>
+<span class="sourceLineNo">4483</span><a name="line.4483"></a>
+<span class="sourceLineNo">4484</span>  /**<a name="line.4484"></a>
+<span class="sourceLineNo">4485</span>   * Check the collection of families for valid timestamps<a name="line.4485"></a>
+<span class="sourceLineNo">4486</span>   * @param familyMap<a name="line.4486"></a>
+<span class="sourceLineNo">4487</span>   * @param now current timestamp<a name="line.4487"></a>
+<span class="sourceLineNo">4488</span>   * @throws FailedSanityCheckException<a name="line.4488"></a>
+<span class="sourceLineNo">4489</span>   */<a name="line.4489"></a>
+<span class="sourceLineNo">4490</span>  public void checkTimestamps(final Map&lt;byte[], List&lt;Cell&gt;&gt; familyMap, long now)<a name="line.4490"></a>
+<span class="sourceLineNo">4491</span>      throws FailedSanityCheckException {<a name="line.4491"></a>
+<span class="sourceLineNo">4492</span>    if (timestampSlop == HConstants.LATEST_TIMESTAMP) {<a name="line.4492"></a>
+<span class="sourceLineNo">4493</span>      return;<a name="line.4493"></a>
 <span class="sourceLineNo">4494</span>    }<a name="line.4494"></a>
-<span class="sourceLineNo">4495</span>  }<a name="line.4495"></a>
-<span class="sourceLineNo">4496</span><a name="line.4496"></a>
-<span class="sourceLineNo">4497</span>  /*<a name="line.4497"></a>
-<span class="sourceLineNo">4498</span>   * @param size<a name="line.4498"></a>
-<span class="sourceLineNo">4499</span>   * @return True if size is over the flush threshold<a name="line.4499"></a>
-<span class="sourceLineNo">4500</span>   */<a name="line.4500"></a>
-<span class="sourceLineNo">4501</span>  private boolean isFlushSize(MemStoreSize size) {<a name="line.4501"></a>
-<span class="sourceLineNo">4502</span>    return size.getHeapSize() + size.getOffHeapSize() &gt; getMemStoreFlushSize();<a name="line.4502"></a>
-<span class="sourceLineNo">4503</span>  }<a name="line.4503"></a>
-<span class="sourceLineNo">4504</span><a name="line.4504"></a>
-<span class="sourceLineNo">4505</span>  /**<a name="line.4505"></a>
-<span class="sourceLineNo">4506</span>   * Read the edits put under this region by wal splitting process.  Put<a name="line.4506"></a>
-<span class="sourceLineNo">4507</span>   * the recovered edits back up into this region.<a name="line.4507"></a>
-<span class="sourceLineNo">4508</span>   *<a name="line.4508"></a>
-<span class="sourceLineNo">4509</span>   * &lt;p&gt;We can ignore any wal message that has a sequence ID that's equal to or<a name="line.4509"></a>
-<span class="sourceLineNo">4510</span>   * lower than minSeqId.  (Because we know such messages are already<a name="line.4510"></a>
-<span class="sourceLineNo">4511</span>   * reflected in the HFiles.)<a name="line.4511"></a>
-<span class="sourceLineNo">4512</span>   *<a name="line.4512"></a>
-<span class="sourceLineNo">4513</span>   * &lt;p&gt;While this is running we are putting pressure on memory yet we are<a name="line.4513"></a>
-<span class="sourceLineNo">4514</span>   * outside of our usual accounting because we are not yet an onlined region<a name="line.4514"></a>
-<span class="sourceLineNo">4515</span>   * (this stuff is being run as part of Region initialization).  This means<a name="line.4515"></a>
-<span class="sourceLineNo">4516</span>   * that if we're up against global memory limits, we'll not be flagged to flush<a name="line.4516"></a>
-<span class="sourceLineNo">4517</span>   * because we are not online. We can't be flushed by usual mechanisms anyways;<a name="line.4517"></a>
-<span class="sourceLineNo">4518</span>   * we're not yet online so our relative sequenceids are not yet aligned with<a name="line.4518"></a>
-<span class="sourceLineNo">4519</span>   * WAL sequenceids -- not till we come up online, post processing of split<a name="line.4519"></a>
-<span class="sourceLineNo">4520</span>   * edits.<a name="line.4520"></a>
-<span class="sourceLineNo">4521</span>   *<a name="line.4521"></a>
-<span class="sourceLineNo">4522</span>   * &lt;p&gt;But to help relieve memory pressure, at least manage our own heap size<a name="line.4522"></a>
-<span class="sourceLineNo">4523</span>   * flushing if are in excess of per-region limits.  Flushing, though, we have<a name="line.4523"></a>
-<span class="sourceLineNo">4524</span>   * to be careful and avoid using the regionserver/wal sequenceid.  Its running<a name="line.4524"></a>
-<span class="sourceLineNo">4525</span>   * on a different line to whats going on in here in this region context so if we<a name="line.4525"></a>
-<span class="sourceLineNo">4526</span>   * crashed replaying these edits, but in the midst had a flush that used the<a name="line.4526"></a>
-<span class="sourceLineNo">4527</span>   * regionserver wal with a sequenceid in excess of whats going on in here<a name="line.4527"></a>
-<span class="sourceLineNo">4528</span>   * in this region and with its split editlogs, then we could miss edits the<a name="line.4528"></a>
-<span class="sourceLineNo">4529</span>   * next time we go to recover. So, we have to flush inline, using seqids that<a name="line.4529"></a>
-<span class="sourceLineNo">4530</span>   * make sense in a this single region context only -- until we online.<a name="line.4530"></a>
-<span class="sourceLineNo">4531</span>   *<a name="line.4531"></a>
-<span class="sourceLineNo">4532</span>   * @param maxSeqIdInStores Any edit found in split editlogs needs to be in excess of<a name="line.4532"></a>
-<span class="sourceLineNo">4533</span>   * the maxSeqId for the store to be applied, else its skipped.<a name="line.4533"></a>
-<span class="sourceLineNo">4534</span>   * @return the sequence id of the last edit added to this region out of the<a name="line.4534"></a>
-<span class="sourceLineNo">4535</span>   * recovered edits log or &lt;code&gt;minSeqId&lt;/code&gt; if nothing added from editlogs.<a name="line.4535"></a>
-<span class="sourceLineNo">4536</span>   * @throws IOException<a name="line.4536"></a>
-<span class="sourceLineNo">4537</span>   */<a name="line.4537"></a>
-<span class="sourceLineNo">4538</span>  protected long replayRecoveredEditsIfAny(Map&lt;byte[], Long&gt; maxSeqIdInStores,<a name="line.4538"></a>
-<span class="sourceLineNo">4539</span>      final CancelableProgressable reporter, final MonitoredTask status)<a name="line.4539"></a>
-<span class="sourceLineNo">4540</span>      throws IOException {<a name="line.4540"></a>
-<span class="sourceLineNo">4541</span>    long minSeqIdForTheRegion = -1;<a name="line.4541"></a>
-<span class="sourceLineNo">4542</span>    for (Long maxSeqIdInStore : maxSeqIdInStores.values()) {<a name="line.4542"></a>
-<span class="sourceLineNo">4543</span>      if (maxSeqIdInStore &lt; minSeqIdForTheRegion || minSeqIdForTheRegion == -1) {<a name="line.4543"></a>
-<span class="sourceLineNo">4544</span>        minSeqIdForTheRegion = maxSeqIdInStore;<a name="line.4544"></a>
-<span class="sourceLineNo">4545</span>      }<a name="line.4545"></a>
-<span class="sourceLineNo">4546</span>    }<a name="line.4546"></a>
-<span class="sourceLineNo">4547</span>    long seqid = minSeqIdForTheRegion;<a name="line.4547"></a>
-<span class="sourceLineNo">4548</span><a name="line.4548"></a>
-<span class="sourceLineNo">4549</span>    FileSystem walFS = getWalFileSystem();<a name="line.4549"></a>
-<span class="sourceLineNo">4550</span>    FileSystem rootFS = getFilesystem();<a name="line.4550"></a>
-<span class="sourceLineNo">4551</span>    Path regionDir = getWALRegionDir();<a name="line.4551"></a>
-<span class="sourceLineNo">4552</span>    Path defaultRegionDir = getRegionDir(FSUtils.getRootDir(conf), getRegionInfo());<a name="line.4552"></a>
-<span class="sourceLineNo">4553</span><a name="line.4553"></a>
-<span class="sourceLineNo">4554</span>    // This is to ensure backwards compatability with HBASE-20723 where recovered edits can appear<a name="line.4554"></a>
-<span class="sourceLineNo">4555</span>    // under the root dir even if walDir is set.<a name="line.4555"></a>
-<span class="sourceLineNo">4556</span>    NavigableSet&lt;Path&gt; filesUnderRootDir = null;<a name="line.4556"></a>
-<span class="sourceLineNo">4557</span>    if (!regionDir.equals(defaultRegionDir)) {<a name="line.4557"></a>
-<span class="sourceLineNo">4558</span>      filesUnderRootDir =<a name="line.4558"></a>
-<span class="sourceLineNo">4559</span>          WALSplitter.getSplitEditFilesSorted(rootFS, defaultRegionDir);<a name="line.4559"></a>
-<span class="sourceLineNo">4560</span>      seqid = Math.max(seqid,<a name="line.4560"></a>
-<span class="sourceLineNo">4561</span>          replayRecoveredEditsForPaths(minSeqIdForTheRegion, rootFS, filesUnderRootDir, reporter,<a name="line.4561"></a>
-<span class="sourceLineNo">4562</span>              defaultRegionDir));<a name="line.4562"></a>
-<span class="sourceLineNo">4563</span>    }<a name="line.4563"></a>
+<span class="sourceLineNo">4495</span>    long maxTs = now + timestampSlop;<a name="line.4495"></a>
+<span class="sourceLineNo">4496</span>    for (List&lt;Cell&gt; kvs : familyMap.values()) {<a name="line.4496"></a>
+<span class="sourceLineNo">4497</span>      // Optimization: 'foreach' loop is not used. See:<a name="line.4497"></a>
+<span class="sourceLineNo">4498</span>      // HBASE-12023 HRegion.applyFamilyMapToMemstore creates too many iterator objects<a name="line.4498"></a>
+<span class="sourceLineNo">4499</span>      assert kvs instanceof RandomAccess;<a name="line.4499"></a>
+<span class="sourceLineNo">4500</span>      int listSize  = kvs.size();<a name="line.4500"></a>
+<span class="sourceLineNo">4501</span>      for (int i=0; i &lt; listSize; i++) {<a name="line.4501"></a>
+<span class="sourceLineNo">4502</span>        Cell cell = kvs.get(i);<a name="line.4502"></a>
+<span class="sourceLineNo">4503</span>        // see if the user-side TS is out of range. latest = server-side<a name="line.4503"></a>
+<span class="sourceLineNo">4504</span>        long ts = cell.getTimestamp();<a name="line.4504"></a>
+<span class="sourceLineNo">4505</span>        if (ts != HConstants.LATEST_TIMESTAMP &amp;&amp; ts &gt; maxTs) {<a name="line.4505"></a>
+<span class="sourceLineNo">4506</span>          throw new FailedSanityCheckException("Timestamp for KV out of range "<a name="line.4506"></a>
+<span class="sourceLineNo">4507</span>              + cell + " (too.new=" + timestampSlop + ")");<a name="line.4507"></a>
+<span class="sourceLineNo">4508</span>        }<a name="line.4508"></a>
+<span class="sourceLineNo">4509</span>      }<a name="line.4509"></a>
+<span class="sourceLineNo">4510</span>    }<a name="line.4510"></a>
+<span class="sourceLineNo">4511</span>  }<a name="line.4511"></a>
+<span class="sourceLineNo">4512</span><a name="line.4512"></a>
+<span class="sourceLineNo">4513</span>  /*<a name="line.4513"></a>
+<span class="sourceLineNo">4514</span>   * @param size<a name="line.4514"></a>
+<span class="sourceLineNo">4515</span>   * @return True if size is over the flush threshold<a name="line.4515"></a>
+<span class="sourceLineNo">4516</span>   */<a name="line.4516"></a>
+<span class="sourceLineNo">4517</span>  private boolean isFlushSize(MemStoreSize size) {<a name="line.4517"></a>
+<span class="sourceLineNo">4518</span>    return size.getHeapSize() + size.getOffHeapSize() &gt; getMemStoreFlushSize();<a name="line.4518"></a>
+<span class="sourceLineNo">4519</span>  }<a name="line.4519"></a>
+<span class="sourceLineNo">4520</span><a name="line.4520"></a>
+<span class="sourceLineNo">4521</span>  /**<a name="line.4521"></a>
+<span class="sourceLineNo">4522</span>   * Read the edits put under this region by wal splitting process.  Put<a name="line.4522"></a>
+<span class="sourceLineNo">4523</span>   * the recovered edits back up into this region.<a name="line.4523"></a>
+<span class="sourceLineNo">4524</span>   *<a name="line.4524"></a>
+<span class="sourceLineNo">4525</span>   * &lt;p&gt;We can ignore any wal message that has a sequence ID that's equal to or<a name="line.4525"></a>
+<span class="sourceLineNo">4526</span>   * lower than minSeqId.  (Because we know such messages are already<a name="line.4526"></a>
+<span class="sourceLineNo">4527</span>   * reflected in the HFiles.)<a name="line.4527"></a>
+<span class="sourceLineNo">4528</span>   *<a name="line.4528"></a>
+<span class="sourceLineNo">4529</span>   * &lt;p&gt;While this is running we are putting pressure on memory yet we are<a name="line.4529"></a>
+<span class="sourceLineNo">4530</span>   * outside of our usual accounting because we are not yet an onlined region<a name="line.4530"></a>
+<span class="sourceLineNo">4531</span>   * (this stuff is being run as part of Region initialization).  This means<a name="line.4531"></a>
+<span class="sourceLineNo">4532</span>   * that if we're up against global memory limits, we'll not be flagged to flush<a name="line.4532"></a>
+<span class="sourceLineNo">4533</span>   * because we are not online. We can't be flushed by usual mechanisms anyways;<a name="line.4533"></a>
+<span class="sourceLineNo">4534</span>   * we're not yet online so our relative sequenceids are not yet aligned with<a name="line.4534"></a>
+<span class="sourceLineNo">4535</span>   * WAL sequenceids -- not till we come up online, post processing of split<a name="line.4535"></a>
+<span class="sourceLineNo">4536</span>   * edits.<a name="line.4536"></a>
+<span class="sourceLineNo">4537</span>   *<a name="line.4537"></a>
+<span class="sourceLineNo">4538</span>   * &lt;p&gt;But to help relieve memory pressure, at least manage our own heap size<a name="line.4538"></a>
+<span class="sourceLineNo">4539</span>   * flushing if are in excess of per-region limits.  Flushing, though, we have<a name="line.4539"></a>
+<span class="sourceLineNo">4540</span>   * to be careful and avoid using the regionserver/wal sequenceid.  Its running<a name="line.4540"></a>
+<span class="sourceLineNo">4541</span>   * on a different line to whats going on in here in this region context so if we<a name="line.4541"></a>
+<span class="sourceLineNo">4542</span>   * crashed replaying these edits, but in the midst had a flush that used the<a name="line.4542"></a>
+<span class="sourceLineNo">4543</span>   * regionserver wal with a sequenceid in excess of whats going on in here<a name="line.4543"></a>
+<span class="sourceLineNo">4544</span>   * in this region and with its split editlogs, then we could miss edits the<a name="line.4544"></a>
+<span class="sourceLineNo">4545</span>   * next time we go to recover. So, we have to flush inline, using seqids that<a name="line.4545"></a>
+<span class="sourceLineNo">4546</span>   * make sense in a this single region context only -- until we online.<a name="line.4546"></a>
+<span class="sourceLineNo">4547</span>   *<a name="line.4547"></a>
+<span class="sourceLineNo">4548</span>   * @param maxSeqIdInStores Any edit found in split editlogs needs to be in excess of<a name="line.4548"></a>
+<span class="sourceLineNo">4549</span>   * the maxSeqId for the store to be applied, else its skipped.<a name="line.4549"></a>
+<span class="sourceLineNo">4550</span>   * @return the sequence id of the last edit added to this region out of the<a name="line.4550"></a>
+<span class="sourceLineNo">4551</span>   * recovered edits log or &lt;code&gt;minSeqId&lt;/code&gt; if nothing added from editlogs.<a name="line.4551"></a>
+<span class="sourceLineNo">4552</span>   * @throws IOException<a name="line.4552"></a>
+<span class="sourceLineNo">4553</span>   */<a name="line.4553"></a>
+<span class="sourceLineNo">4554</span>  protected long replayRecoveredEditsIfAny(Map&lt;byte[], Long&gt; maxSeqIdInStores,<a name="line.4554"></a>
+<span class="sourceLineNo">4555</span>      final CancelableProgressable reporter, final MonitoredTask status)<a name="line.4555"></a>
+<span class="sourceLineNo">4556</span>      throws IOException {<a name="line.4556"></a>
+<span class="sourceLineNo">4557</span>    long minSeqIdForTheRegion = -1;<a name="line.4557"></a>
+<span class="sourceLineNo">4558</span>    for (Long maxSeqIdInStore : maxSeqIdInStores.values()) {<a name="line.4558"></a>
+<span class="sourceLineNo">4559</span>      if (maxSeqIdInStore &lt; minSeqIdForTheRegion || minSeqIdForTheRegion == -1) {<a name="line.4559"></a>
+<span class="sourceLineNo">4560</span>        minSeqIdForTheRegion = maxSeqIdInStore;<a name="line.4560"></a>
+<span class="sourceLineNo">4561</span>      }<a name="line.4561"></a>
+<span class="sourceLineNo">4562</span>    }<a name="line.4562"></a>
+<span class="sourceLineNo">4563</span>    long seqid = minSeqIdForTheRegion;<a name="line.4563"></a>
 <span class="sourceLineNo">4564</span><a name="line.4564"></a>
-<span class="sourceLineNo">4565</span>    NavigableSet&lt;Path&gt; files = WALSplitter.getSplitEditFilesSorted(walFS, regionDir);<a name="line.4565"></a>
-<span class="sourceLineNo">4566</span>    seqid = Math.max(seqid, replayRecoveredEditsForPaths(minSeqIdForTheRegion, walFS,<a name="line.4566"></a>
-<span class="sourceLineNo">4567</span>        files, reporter, regionDir));<a name="line.4567"></a>
-<span class="sourceLineNo">4568</span><a name="line.4568"></a>
-<span class="sourceLineNo">4569</span>    if (seqid &gt; minSeqIdForTheRegion) {<a name="line.4569"></a>
-<span class="sourceLineNo">4570</span>      // Then we added some edits to memory. Flush and cleanup split edit files.<a name="line.4570"></a>
-<span class="sourceLineNo">4571</span>      internalFlushcache(null, seqid, stores.values(), status, false, FlushLifeCycleTracker.DUMMY);<a name="line.4571"></a>
-<span class="sourceLineNo">4572</span>    }<a name="line.4572"></a>
-<span class="sourceLineNo">4573</span>    // Now delete the content of recovered edits.  We're done w/ them.<a name="line.4573"></a>
-<span class="sourceLineNo">4574</span>    if (files.size() &gt; 0 &amp;&amp; this.conf.getBoolean("hbase.region.archive.recovered.edits", false)) {<a name="line.4574"></a>
-<span class="sourceLineNo">4575</span>      // For debugging data loss issues!<a name="line.4575"></a>
-<span class="sourceLineNo">4576</span>      // If this flag is set, make use of the hfile archiving by making recovered.edits a fake<a name="line.4576"></a>
-<span class="sourceLineNo">4577</span>      // column family. Have to fake out file type too by casting our recovered.edits as storefiles<a name="line.4577"></a>
-<span class="sourceLineNo">4578</span>      String fakeFamilyName = WALSplitter.getRegionDirRecoveredEditsDir(regionDir).getName();<a name="line.4578"></a>
-<span class="sourceLineNo">4579</span>      Set&lt;HStoreFile&gt; fakeStoreFiles = new HashSet&lt;&gt;(files.size());<a name="line.4579"></a>
-<span class="sourceLineNo">4580</span>      for (Path file: files) {<a name="line.4580"></a>
-<span class="sourceLineNo">4581</span>        fakeStoreFiles.add(<a name="line.4581"></a>
-<span class="sourceLineNo">4582</span>          new HStoreFile(walFS, file, this.conf, null, null, true));<a name="line.4582"></a>
-<span class="sourceLineNo">4583</span>      }<a name="line.4583"></a>
-<span class="sourceLineNo">4584</span>      getRegionWALFileSystem().removeStoreFiles(fakeFamilyName, fakeStoreFiles);<a name="line.4584"></a>
-<span class="sourceLineNo">4585</span>    } else {<a name="line.4585"></a>
-<span class="sourceLineNo">4586</span>      if (filesUnderRootDir != null) {<a name="line.4586"></a>
-<span class="sourceLineNo">4587</span>        for (Path file : filesUnderRootDir) {<a name="line.4587"></a>
-<span class="sourceLineNo">4588</span>          if (!rootFS.delete(file, false)) {<a name="line.4588"></a>
-<span class="sourceLineNo">4589</span>            LOG.error("Failed delete of {} from under the root directory.", file);<a name="line.4589"></a>
-<span class="sourceLineNo">4590</span>          } else {<a name="line.4590"></a>
-<span class="sourceLineNo">4591</span>            LOG.debug("Deleted recovered.edits under root directory. file=" + file);<a name="line.4591"></a>
-<span class="sourceLineNo">4592</span>          }<a name="line.4592"></a>
-<span class="sourceLineNo">4593</span>        }<a name="line.4593"></a>
-<span class="sourceLineNo">4594</span>      }<a name="line.4594"></a>
-<span class="sourceLineNo">4595</span>      for (Path file: files) {<a name="line.4595"></a>
-<span class="sourceLineNo">4596</span>        if (!walFS.delete(file, false)) {<a name="line.4596"></a>
-<span class="sourceLineNo">4597</span>          LOG.error("Failed delete of " + file);<a name="line.4597"></a>
-<span class="sourceLineNo">4598</span>        } else {<a name="line.4598"></a>
-<span class="sourceLineNo">4599</span>          LOG.debug("Deleted recovered.edits file=" + file);<a name="line.4599"></a>
-<span class="sourceLineNo">4600</span>        }<a name="line.4600"></a>
-<span class="sourceLineNo">4601</span>      }<a name="line.4601"></a>
-<span class="sourceLineNo">4602</span>    }<a name="line.4602"></a>
-<span class="sourceLineNo">4603</span>    return seqid;<a name="line.4603"></a>
-<span class="sourceLineNo">4604</span>  }<a name="line.4604"></a>
-<span class="sourceLineNo">4605</span><a name="line.4605"></a>
-<span class="sourceLineNo">4606</span>  private long replayRecoveredEditsForPaths(long minSeqIdForTheRegion, FileSystem fs,<a name="line.4606"></a>
-<span class="sourceLineNo">4607</span>      final NavigableSet&lt;Path&gt; files, final CancelableProgressable reporter, final Path regionDir)<a name="line.4607"></a>
-<span class="sourceLineNo">4608</span>      throws IOException {<a name="line.4608"></a>
-<span class="sourceLineNo">4609</span>    long seqid = minSeqIdForTheRegion;<a name="line.4609"></a>
-<span class="sourceLineNo">4610</span>    if (LOG.isDebugEnabled()) {<a name="line.4610"></a>
-<span class="sourceLineNo">4611</span>      LOG.debug("Found " + (files == null ? 0 : files.size())<a name="line.4611"></a>
-<span class="sourceLineNo">4612</span>          + " recovered edits file(s) under " + regionDir);<a name="line.4612"></a>
-<span class="sourceLineNo">4613</span>    }<a name="line.4613"></a>
-<span class="sourceLineNo">4614</span><a name="line.4614"></a>
-<span class="sourceLineNo">4615</span>    if (files == null || files.isEmpty()) {<a name="line.4615"></a>
-<span class="sourceLineNo">4616</span>      return minSeqIdForTheRegion;<a name="line.4616"></a>
-<span class="sourceLineNo">4617</span>    }<a name="line.4617"></a>
-<span class="sourceLineNo">4618</span><a name="line.4618"></a>
-<span class="sourceLineNo">4619</span>    for (Path edits: files) {<a name="line.4619"></a>
-<span class="sourceLineNo">4620</span>      if (edits == null || !fs.exists(edits)) {<a name="line.4620"></a>
-<span class="sourceLineNo">4621</span>        LOG.warn("Null or non-existent edits file: " + edits);<a name="line.4621"></a>
-<span class="sourceLineNo">4622</span>        continue;<a name="line.4622"></a>
-<span class="sourceLineNo">4623</span>      }<a name="line.4623"></a>
-<span class="sourceLineNo">4624</span>      if (isZeroLengthThenDelete(fs, edits)) continue;<a name="line.4624"></a>
-<span class="sourceLineNo">4625</span><a name="line.4625"></a>
-<span class="sourceLineNo">4626</span>      long maxSeqId;<a name="line.4626"></a>
-<span class="sourceLineNo">4627</span>      String fileName = edits.getName();<a name="line.4627"></a>
-<span class="sourceLineNo">4628</span>      maxSeqId = Math.abs(Long.parseLong(fileName));<a name="line.4628"></a>
-<span class="sourceLineNo">4629</span>      if (maxSeqId &lt;= minSeqIdForTheRegion) {<a name="line.4629"></a>
-<span class="sourceLineNo">4630</span>        if (LOG.isDebugEnabled()) {<a name="line.4630"></a>
-<span class="sourceLineNo">4631</span>          String msg = "Maximum sequenceid for this wal is " + maxSeqId<a name="line.4631"></a>
-<span class="sourceLineNo">4632</span>              + " and minimum sequenceid for the region is " + minSeqIdForTheRegion<a name="line.4632"></a>
-<span class="sourceLineNo">4633</span>              + ", skipped the whole file, path=" + edits;<a name="line.4633"></a>
-<span class="sourceLineNo">4634</span>          LOG.debug(msg);<a name="line.4634"></a>
-<span class="sourceLineNo">4635</span>        }<a name="line.4635"></a>
-<span class="sourceLineNo">4636</span>        continue;<a name="line.4636"></a>
-<span class="sourceLineNo">4637</span>      }<a name="line.4637"></a>
-<span class="sourceLineNo">4638</span><a name="line.4638"></a>
-<span class="sourceLineNo">4639</span>      try {<a name="line.4639"></a>
-<span class="sourceLineNo">4640</span>        // replay the edits. Replay can return -1 if everything is skipped, only update<a name="line.4640"></a>
-<span class="sourceLineNo">4641</span>        // if seqId is greater<a name="line.4641"></a>
-<span class="sourceLineNo">4642</span>        seqid = Math.max(seqid, replayRecoveredEdits(edits, maxSeqIdInStores, reporter, fs));<a name="line.4642"></a>
-<span class="sourceLineNo">4643</span>      } catch (IOException e) {<a name="line.4643"></a>
-<span class="sourceLineNo">4644</span>        boolean skipErrors = conf.getBoolean(<a name="line.4644"></a>
-<span class="sourceLineNo">4645</span>            HConstants.HREGION_EDITS_REPLAY_SKIP_ERRORS,<a name="line.4645"></a>
-<span class="sourceLineNo">4646</span>            conf.getBoolean(<a name="line.4646"></a>
-<span class="sourceLineNo">4647</span>                "hbase.skip.errors",<a name="line.4647"></a>
-<span class="sourceLineNo">4648</span>                HConstants.DEFAULT_HREGION_EDITS_REPLAY_SKIP_ERRORS));<a name="line.4648"></a>
-<span class="sourceLineNo">4649</span>        if (conf.get("hbase.skip.errors") != null) {<a name="line.4649"></a>
-<span class="sourceLineNo">4650</span>          LOG.warn(<a name="line.4650"></a>
-<span class="sourceLineNo">4651</span>              "The property 'hbase.skip.errors' has been deprecated. Please use " +<a name="line.4651"></a>
-<span class="sourceLineNo">4652</span>                  HConstants.HREGION_EDITS_REPLAY_SKIP_ERRORS + " instead.");<a name="line.4652"></a>
-<span class="sourceLineNo">4653</span>        }<a name="line.4653"></a>
-<span class="sourceLineNo">4654</span>        if (skipErrors) {<a name="line.4654"></a>
-<span class="sourceLineNo">4655</span>          Path p = WALSplitter.moveAsideBadEditsFile(walFS, edits);<a name="line.4655"></a>
-<span class="sourceLineNo">4656</span>          LOG.error(HConstants.HREGION_EDITS_REPLAY_SKIP_ERRORS<a name="line.4656"></a>
-<span class="sourceLineNo">4657</span>              + "=true so continuing. Renamed " + edits +<a name="line.4657"></a>
-<span class="sourceLineNo">4658</span>              " as " + p, e);<a name="line.4658"></a>
-<span class="sourceLineNo">4659</span>        } else {<a name="line.4659"></a>
-<span class="sourceLineNo">4660</span>          throw e;<a name="line.4660"></a>
-<span class="sourceLineNo">4661</span>        }<a name="line.4661"></a>
-<span class="sourceLineNo">4662</span>      }<a name="line.4662"></a>
-<span class="sourceLineNo">4663</span>    }<a name="line.4663"></a>
-<span class="sourceLineNo">4664</span>    return seqid;<a name="line.4664"></a>
-<span class="sourceLineNo">4665</span>  }<a name="line.4665"></a>
-<span class="sourceLineNo">4666</span><a name="line.4666"></a>
-<span class="sourceLineNo">4667</span>  /*<a name="line.4667"></a>
-<span class="sourceLineNo">4668</span>   * @param edits File of recovered edits.<a name="line.4668"></a>
-<span class="sourceLineNo">4669</span>   * @param maxSeqIdInStores Maximum sequenceid found in each store.  Edits in wal<a name="line.4669"></a>
-<span class="sourceLineNo">4670</span>   * must be larger than this to be replayed for each store.<a name="line.4670"></a>
-<span class="sourceLineNo">4671</span>   * @param reporter<a name="line.4671"></a>
-<span class="sourceLineNo">4672</span>   * @return the sequence id of the last edit added to this region out of the<a name="line.4672"></a>
-<span class="sourceLineNo">4673</span>   * recovered edits log or &lt;code&gt;minSeqId&lt;/code&gt; if nothing added from editlogs.<a name="line.4673"></a>
-<span class="sourceLineNo">4674</span>   * @throws IOException<a name="line.4674"></a>
-<span class="sourceLineNo">4675</span>   */<a name="line.4675"></a>
-<span class="sourceLineNo">4676</span>  private long replayRecoveredEdits(final Path edits,<a name="line.4676"></a>
-<span class="sourceLineNo">4677</span>      Map&lt;byte[], Long&gt; maxSeqIdInStores, final CancelableProgressable reporter, FileSystem fs)<a name="line.4677"></a>
-<span class="sourceLineNo">4678</span>    throws IOException {<a name="line.4678"></a>
-<span class="sourceLineNo">4679</span>    String msg = "Replaying edits from " + edits;<a name="line.4679"></a>
-<span class="sourceLineNo">4680</span>    LOG.info(msg);<a name="line.4680"></a>
-<span class="sourceLineNo">4681</span>    MonitoredTask status = TaskMonitor.get().createStatus(msg);<a name="line.4681"></a>
+<span class="sourceLineNo">4565</span>    FileSystem walFS = getWalFileSystem();<a name="line.4565"></a>
+<span class="sourceLineNo">4566</span>    FileSystem rootFS = getFilesystem();<a name="line.4566"></a>
+<span class="sourceLineNo">4567</span>    Path regionDir = getWALRegionDir();<a name="line.4567"></a>
+<span class="sourceLineNo">4568</span>    Path defaultRegionDir = getRegionDir(FSUtils.getRootDir(conf), getRegionInfo());<a name="line.4568"></a>
+<span class="sourceLineNo">4569</span><a name="line.4569"></a>
+<span class="sourceLineNo">4570</span>    // This is to ensure backwards compatability with HBASE-20723 where recovered edits can appear<a name="line.4570"></a>
+<span class="sourceLineNo">4571</span>    // under the root dir even if walDir is set.<a name="line.4571"></a>
+<span class="sourceLineNo">4572</span>    NavigableSet&lt;Path&gt; filesUnderRootDir = null;<a name="line.4572"></a>
+<span class="sourceLineNo">4573</span>    if (!regionDir.equals(defaultRegionDir)) {<a name="line.4573"></a>
+<span class="sourceLineNo">4574</span>      filesUnderRootDir =<a name="line.4574"></a>
+<span class="sourceLineNo">4575</span>          WALSplitter.getSplitEditFilesSorted(rootFS, defaultRegionDir);<a name="line.4575"></a>
+<span class="sourceLineNo">4576</span>      seqid = Math.max(seqid,<a name="line.4576"></a>
+<span class="sourceLineNo">4577</span>          replayRecoveredEditsForPaths(minSeqIdForTheRegion, rootFS, filesUnderRootDir, reporter,<a name="line.4577"></a>
+<span class="sourceLineNo">4578</span>              defaultRegionDir));<a name="line.4578"></a>
+<span class="sourceLineNo">4579</span>    }<a name="line.4579"></a>
+<span class="sourceLineNo">4580</span><a name="line.4580"></a>
+<span class="sourceLineNo">4581</span>    NavigableSet&lt;Path&gt; files = WALSplitter.getSplitEditFilesSorted(walFS, regionDir);<a name="line.4581"></a>
+<span class="sourceLineNo">4582</span>    seqid = Math.max(seqid, replayRecoveredEditsForPaths(minSeqIdForTheRegion, walFS,<a name="line.4582"></a>
+<span class="sourceLineNo">4583</span>        files, reporter, regionDir));<a name="line.4583"></a>
+<span class="sourceLineNo">4584</span><a name="line.4584"></a>
+<span class="sourceLineNo">4585</span>    if (seqid &gt; minSeqIdForTheRegion) {<a name="line.4585"></a>
+<span class="sourceLineNo">4586</span>      // Then we added some edits to memory. Flush and cleanup split edit files.<a name="line.4586"></a>
+<span class="sourceLineNo">4587</span>      internalFlushcache(null, seqid, stores.values(), status, false, FlushLifeCycleTracker.DUMMY);<a name="line.4587"></a>
+<span class="sourceLineNo">4588</span>    }<a name="line.4588"></a>
+<span class="sourceLineNo">4589</span>    // Now delete the content of recovered edits.  We're done w/ them.<a name="line.4589"></a>
+<span class="sourceLineNo">4590</span>    if (files.size() &gt; 0 &amp;&amp; this.conf.getBoolean("hbase.region.archive.recovered.edits", false)) {<a name="line.4590"></a>
+<span class="sourceLineNo">4591</span>      // For debugging data loss issues!<a name="line.4591"></a>
+<span class="sourceLineNo">4592</span>      // If this flag is set, make use of the hfile archiving by making recovered.edits a fake<a name="line.4592"></a>
+<span class="sourceLineNo">4593</span>      // column family. Have to fake out file type too by casting our recovered.edits as storefiles<a name="line.4593"></a>
+<span class="sourceLineNo">4594</span>      String fakeFamilyName = WALSplitter.getRegionDirRecoveredEditsDir(regionDir).getName();<a name="line.4594"></a>
+<span class="sourceLineNo">4595</span>      Set&lt;HStoreFile&gt; fakeStoreFiles = new HashSet&lt;&gt;(files.size());<a name="line.4595"></a>
+<span class="sourceLineNo">4596</span>      for (Path file: files) {<a name="line.4596"></a>
+<span class="sourceLineNo">4597</span>        fakeStoreFiles.add(<a name="line.4597"></a>
+<span class="sourceLineNo">4598</span>          new HStoreFile(walFS, file, this.conf, null, null, true));<a name="line.4598"></a>
+<span class="sourceLineNo">4599</span>      }<a name="line.4599"></a>
+<span class="sourceLineNo">4600</span>      getRegionWALFileSystem().removeStoreFiles(fakeFamilyName, fakeStoreFiles);<a name="line.4600"></a>
+<span class="sourceLineNo">4601</span>    } else {<a name="line.4601"></a>
+<span class="sourceLineNo">4602</span>      if (filesUnderRootDir != null) {<a name="line.4602"></a>
+<span class="sourceLineNo">4603</span>        for (Path file : filesUnderRootDir) {<a name="line.4603"></a>
+<span class="sourceLineNo">4604</span>          if (!rootFS.delete(file, false)) {<a name="line.4604"></a>
+<span class="sourceLineNo">4605</span>            LOG.error("Failed delete of {} from under the root directory.", file);<a name="line.4605"></a>
+<span class="sourceLineNo">4606</span>          } else {<a name="line.4606"></a>
+<span class="sourceLineNo">4607</span>            LOG.debug("Deleted recovered.edits under root directory. file=" + file);<a name="line.4607"></a>
+<span class="sourceLineNo">4608</span>          }<a name="line.4608"></a>
+<span class="sourceLineNo">4609</span>        }<a name="line.4609"></a>
+<span class="sourceLineNo">4610</span>      }<a name="line.4610"></a>
+<span class="sourceLineNo">4611</span>      for (Path file: files) {<a name="line.4611"></a>
+<span class="sourceLineNo">4612</span>        if (!walFS.delete(file, false)) {<a name="line.4612"></a>
+<span class="sourceLineNo">4613</span>          LOG.error("Failed delete of " + file);<a name="line.4613"></a>
+<span class="sourceLineNo">4614</span>        } else {<a name="line.4614"></a>
+<span class="sourceLineNo">4615</span>          LOG.debug("Deleted recovered.edits file=" + file);<a name="line.4615"></a>
+<span class="sourceLineNo">4616</span>        }<a name="line.4616"></a>
+<span class="sourceLineNo">4617</span>      }<a name="line.4617"></a>
+<span class="sourceLineNo">4618</span>    }<a name="line.4618"></a>
+<span class="sourceLineNo">4619</span>    return seqid;<a name="line.4619"></a>
+<span class="sourceLineNo">4620</span>  }<a name="line.4620"></a>
+<span class="sourceLineNo">4621</span><a name="line.4621"></a>
+<span class="sourceLineNo">4622</span>  private long replayRecoveredEditsForPaths(long minSeqIdForTheRegion, FileSystem fs,<a name="line.4622"></a>
+<span class="sourceLineNo">4623</span>      final NavigableSet&lt;Path&gt; files, final CancelableProgressable reporter, final Path regionDir)<a name="line.4623"></a>
+<span class="sourceLineNo">4624</span>      throws IOException {<a name="line.4624"></a>
+<span class="sourceLineNo">4625</span>    long seqid = minSeqIdForTheRegion;<a name="line.4625"></a>
+<span class="sourceLineNo">4626</span>    if (LOG.isDebugEnabled()) {<a name="line.4626"></a>
+<span class="sourceLineNo">4627</span>      LOG.debug("Found " + (files == null ? 0 : files.size())<a name="line.4627"></a>
+<span class="sourceLineNo">4628</span>          + " recovered edits file(s) under " + regionDir);<a name="line.4628"></a>
+<span class="sourceLineNo">4629</span>    }<a name="line.4629"></a>
+<span class="sourceLineNo">4630</span><a name="line.4630"></a>
+<span class="sourceLineNo">4631</span>    if (files == null || files.isEmpty()) {<a name="line.4631"></a>
+<span class="sourceLineNo">4632</span>      return minSeqIdForTheRegion;<a name="line.4632"></a>
+<span class="sourceLineNo">4633</span>    }<a name="line.4633"></a>
+<span class="sourceLineNo">4634</span><a name="line.4634"></a>
+<span class="sourceLineNo">4635</span>    for (Path edits: files) {<a name="line.4635"></a>
+<span class="sourceLineNo">4636</span>      if (edits == null || !fs.exists(edits)) {<a name="line.4636"></a>
+<span class="sourceLineNo">4637</span>        LOG.warn("Null or non-existent edits file: " + edits);<a name="line.4637"></a>
+<span class="sourceLineNo">4638</span>        continue;<a name="line.4638"></a>
+<span class="sourceLineNo">4639</span>      }<a name="line.4639"></a>
+<span class="sourceLineNo">4640</span>      if (isZeroLengthThenDelete(fs, edits)) continue;<a name="line.4640"></a>
+<span class="sourceLineNo">4641</span><a name="line.4641"></a>
+<span class="sourceLineNo">4642</span>      long maxSeqId;<a name="line.4642"></a>
+<span class="sourceLineNo">4643</span>      String fileName = edits.getName();<a name="line.4643"></a>
+<span class="sourceLineNo">4644</span>      maxSeqId = Math.abs(Long.parseLong(fileName));<a name="line.4644"></a>
+<span class="sourceLineNo">4645</span>      if (maxSeqId &lt;= minSeqIdForTheRegion) {<a name="line.4645"></a>
+<span class="sourceLineNo">4646</span>        if (LOG.isDebugEnabled()) {<a name="line.4646"></a>
+<span class="sourceLineNo">4647</span>          String msg = "Maximum sequenceid for this wal is " + maxSeqId<a name="line.4647"></a>
+<span class="sourceLineNo">4648</span>              + " and minimum sequenceid for the region is " + minSeqIdForTheRegion<a name="line.4648"></a>
+<span class="sourceLineNo">4649</span>              + ", skipped the whole file, path=" + edits;<a name="line.4649"></a>
+<span class="sourceLineNo">4650</span>          LOG.debug(msg);<a name="line.4650"></a>
+<span class="sourceLineNo">4651</span>        }<a name="line.4651"></a>
+<span class="sourceLineNo">4652</span>        continue;<a name="line.4652"></a>
+<span class="sourceLineNo">4653</span>      }<a name="line.4653"></a>
+<span class="sourceLineNo">4654</span><a name="line.4654"></a>
+<span class="sourceLineNo">4655</span>      try {<a name="line.4655"></a>
+<span class="sourceLineNo">4656</span>        // replay the edits. Replay can return -1 if everything is skipped, only update<a name="line.4656"></a>
+<span class="sourceLineNo">4657</span>        // if seqId is greater<a name="line.4657"></a>
+<span class="sourceLineNo">4658</span>        seqid = Math.max(seqid, replayRecoveredEdits(edits, maxSeqIdInStores, reporter, fs));<a name="line.4658"></a>
+<span class="sourceLineNo">4659</span>      } catch (IOException e) {<a name="line.4659"></a>
+<span class="sourceLineNo">4660</span>        boolean skipErrors = conf.getBoolean(<a name="line.4660"></a>
+<span class="sourceLineNo">4661</span>            HConstants.HREGION_EDITS_REPLAY_SKIP_ERRORS,<a name="line.4661"></a>
+<span class="sourceLineNo">4662</span>            conf.getBoolean(<a name="line.4662"></a>
+<span class="sourceLineNo">4663</span>                "hbase.skip.errors",<a name="line.4663"></a>
+<span class="sourceLineNo">4664</span>                HConstants.DEFAULT_HREGION_EDITS_REPLAY_SKIP_ERRORS));<a name="line.4664"></a>
+<span class="sourceLineNo">4665</span>        if (conf.get("hbase.skip.errors") != null) {<a name="line.4665"></a>
+<span class="sourceLineNo">4666</span>          LOG.warn(<a name="line.4666"></a>
+<span class="sourceLineNo">4667</span>              "The property 'hbase.skip.errors' has been deprecated. Please use " +<a name="line.4667"></a>
+<span class="sourceLineNo">4668</span>                  HConstants.HREGION_EDITS_REPLAY_SKIP_ERRORS + " instead.");<a name="line.4668"></a>
+<span class="sourceLineNo">4669</span>        }<a name="line.4669"></a>
+<span class="sourceLineNo">4670</span>        if (skipErrors) {<a name="line.4670"></a>
+<span class="sourceLineNo">4671</span>          Path p = WALSplitter.moveAsideBadEditsFile(walFS, edits);<a name="line.4671"></a>
+<span class="sourceLineNo">4672</span>          LOG.error(HConstants.HREGION_EDITS_REPLAY_SKIP_ERRORS<a name="line.4672"></a>
+<span class="sourceLineNo">4673</span>              + "=true so continuing. Renamed " + edits +<a name="line.4673"></a>
+<span class="sourceLineNo">4674</span>              " as " + p, e);<a name="line.4674"></a>
+<span class="sourceLineNo">4675</span>        } else {<a name="line.4675"></a>
+<span class="sourceLineNo">4676</span>          throw e;<a name="line.4676"></a>
+<span class="sourceLineNo">4677</span>        }<a name="line.4677"></a>
+<span class="sourceLineNo">4678</span>      }<a name="line.4678"></a>
+<span class="sourceLineNo">4679</span>    }<a name="line.4679"></a>
+<span class="sourceLineNo">4680</span>    return seqid;<a name="line.4680"></a>
+<span class="sourceLineNo">4681</span>  }<a name="line.4681"></a>
 <span class="sourceLineNo">4682</span><a name="line.4682"></a>
-<span class="sourceLineNo">4683</span>    status.setStatus("Opening recovered edits");<a name="line.4683"></a>
-<span class="sourceLineNo">4684</span>    WAL.Reader reader = null;<a name="line.4684"></a>
-<span class="sourceLineNo">4685</span>    try {<a name="line.4685"></a>
-<span class="sourceLineNo">4686</span>      reader = WALFactory.createReader(fs, edits, conf);<a name="line.4686"></a>
-<span class="sourceLineNo">4687</span>      long currentEditSeqId = -1;<a name="line.4687"></a>
-<span class="sourceLineNo">4688</span>      long currentReplaySeqId = -1;<a name="line.4688"></a>
-<span class="sourceLineNo">4689</span>      long firstSeqIdInLog = -1;<a name="line.4689"></a>
-<span class="sourceLineNo">4690</span>      long skippedEdits = 0;<a name="line.4690"></a>
-<span class="sourceLineNo">4691</span>      long editsCount = 0;<a name="line.4691"></a>
-<span class="sourceLineNo">4692</span>      long intervalEdits = 0;<a name="line.4692"></a>
-<span class="sourceLineNo">4693</span>      WAL.Entry entry;<a name="line.4693"></a>
-<span class="sourceLineNo">4694</span>      HStore store = null;<a name="line.4694"></a>
-<span class="sourceLineNo">4695</span>      boolean reported_once = false;<a name="line.4695"></a>
-<span class="sourceLineNo">4696</span>      ServerNonceManager ng = this.rsServices == null ? null : this.rsServices.getNonceManager();<a name="line.4696"></a>
-<span class="sourceLineNo">4697</span><a name="line.4697"></a>
-<span class="sourceLineNo">4698</span>      try {<a name="line.4698"></a>
-<span class="sourceLineNo">4699</span>        // How many edits seen before we check elapsed time<a name="line.4699"></a>
-<span class="sourceLineNo">4700</span>        int interval = this.conf.getInt("hbase.hstore.report.interval.edits", 2000);<a name="line.4700"></a>
-<span class="sourceLineNo">4701</span>        // How often to send a progress report (default 1/2 master timeout)<a name="line.4701"></a>
-<span class="sourceLineNo">4702</span>        int period = this.conf.getInt("hbase.hstore.report.period", 300000);<a name="line.4702"></a>
-<span class="sourceLineNo">4703</span>        long lastReport = EnvironmentEdgeManager.currentTime();<a name="line.4703"></a>
-<span class="sourceLineNo">4704</span><a name="line.4704"></a>
-<span class="sourceLineNo">4705</span>        if (coprocessorHost != null) {<a name="line.4705"></a>
-<span class="sourceLineNo">4706</span>          coprocessorHost.preReplayWALs(this.getRegionInfo(), edits);<a name="line.4706"></a>
-<span class="sourceLineNo">4707</span>        }<a name="line.4707"></a>
-<span class="sourceLineNo">4708</span><a name="line.4708"></a>
-<span class="sourceLineNo">4709</span>        while ((entry = reader.next()) != null) {<a name="line.4709"></a>
-<span class="sourceLineNo">4710</span>          WALKey key = entry.getKey();<a name="line.4710"></a>
-<span class="sourceLineNo">4711</span>          WALEdit val = entry.getEdit();<a name="line.4711"></a>
-<span class="sourceLineNo">4712</span><a name="line.4712"></a>
-<span class="sourceLineNo">4713</span>          if (ng != null) { // some test, or nonces disabled<a name="line.4713"></a>
-<span class="sourceLineNo">4714</span>            ng.reportOperationFromWal(key.getNonceGroup(), key.getNonce(), key.getWriteTime());<a name="line.4714"></a>
-<span class="sourceLineNo">4715</span>          }<a name="line.4715"></a>
-<span class="sourceLineNo">4716</span><a name="line.4716"></a>
-<span class="sourceLineNo">4717</span>          if (reporter != null) {<a name="line.4717"></a>
-<span class="sourceLineNo">4718</span>            intervalEdits += val.size();<a name="line.4718"></a>
-<span class="sourceLineNo">4719</span>            if (intervalEdits &gt;= interval) {<a name="line.4719"></a>
-<span class="sourceLineNo">4720</span>              // Number of edits interval reached<a name="line.4720"></a>
-<span class="sourceLineNo">4721</span>              intervalEdits = 0;<a name="line.4721"></a>
-<span class="sourceLineNo">4722</span>              long cur = EnvironmentEdgeManager.currentTime();<a name="line.4722"></a>
-<span class="sourceLineNo">4723</span>              if (lastReport + period &lt;= cur) {<a name="line.4723"></a>
-<span class="sourceLineNo">4724</span>                status.setStatus("Replaying edits..." +<a name="line.4724"></a>
-<span class="sourceLineNo">4725</span>                    " skipped=" + skippedEdits +<a name="line.4725"></a>
-<span class="sourceLineNo">4726</span>                    " edits=" + editsCount);<a name="line.4726"></a>
-<span class="sourceLineNo">4727</span>                // Timeout reached<a name="line.4727"></a>
-<span class="sourceLineNo">4728</span>                if(!reporter.progress()) {<a name="line.4728"></a>
-<span class="sourceLineNo">4729</span>                  msg = "Progressable reporter failed, stopping replay";<a name="line.4729"></a>
-<span class="sourceLineNo">4730</span>                  LOG.warn(msg);<a name="line.4730"></a>
-<span class="sourceLineNo">4731</span>                  status.abort(msg);<a name="line.4731"></a>
-<span class="sourceLineNo">4732</span>                  throw new IOException(msg);<a name="line.4732"></a>
-<span class="sourceLineNo">4733</span>                }<a name="line.4733"></a>
-<span class="sourceLineNo">4734</span>                reported_once = true;<a name="line.4734"></a>
-<span class="sourceLineNo">4735</span>                lastReport = cur;<a name="line.4735"></a>
-<span class="sourceLineNo">4736</span>              }<a name="line.4736"></a>
-<span class="sourceLineNo">4737</span>            }<a name="line.4737"></a>
-<span class="sourceLineNo">4738</span>          }<a name="line.4738"></a>
-<span class="sourceLineNo">4739</span><a name="line.4739"></a>
-<span class="sourceLineNo">4740</span>          if (firstSeqIdInLog == -1) {<a name="line.4740"></a>
-<span class="sourceLineNo">4741</span>            firstSeqIdInLog = key.getSequenceId();<a name="line.4741"></a>
-<span class="sourceLineNo">4742</span>          }<a name="line.4742"></a>
-<span class="sourceLineNo">4743</span>          if (currentEditSeqId &gt; key.getSequenceId()) {<a name="line.4743"></a>
-<span class="sourceLineNo">4744</span>            // when this condition is true, it means we have a serious defect because we need to<a name="line.4744"></a>
-<span class="sourceLineNo">4745</span>            // maintain increasing SeqId for WAL edits per region<a name="line.4745"></a>
-<span class="sourceLineNo">4746</span>            LOG.error(getRegionInfo().getEncodedName() + " : "<a name="line.4746"></a>
-<span class="sourceLineNo">4747</span>                 + "Found decreasing SeqId. PreId=" + currentEditSeqId + " key=" + key<a name="line.4747"></a>
-<span class="sourceLineNo">4748</span>                + "; edit=" + val);<a name="line.4748"></a>
-<span class="sourceLineNo">4749</span>          } else {<a name="line.4749"></a>
-<span class="sourceLineNo">4750</span>            currentEditSeqId = key.getSequenceId();<a name="line.4750"></a>
-<span class="sourceLineNo">4751</span>          }<a name="line.4751"></a>
-<span class="sourceLineNo">4752</span>          currentReplaySeqId = (key.getOrigLogSeqNum() &gt; 0) ?<a name="line.4752"></a>
-<span class="sourceLineNo">4753</span>            key.getOrigLogSeqNum() : currentEditSeqId;<a name="line.4753"></a>
-<span class="sourceLineNo">4754</span><a name="line.4754"></a>
-<span class="sourceLineNo">4755</span>          // Start coprocessor replay here. The coprocessor is for each WALEdit<a name="line.4755"></a>
-<span class="sourceLineNo">4756</span>          // instead of a KeyValue.<a name="line.4756"></a>
-<span class="sourceLineNo">4757</span>          if (coprocessorHost != null) {<a name="line.4757"></a>
-<span class="sourceLineNo">4758</span>            status.setStatus("Running pre-WAL-restore hook in coprocessors");<a name="line.4758"></a>
-<span class="sourceLineNo">4759</span>            if (coprocessorHost.preWALRestore(this.getRegionInfo(), key, val)) {<a name="line.4759"></a>
-<span class="sourceLineNo">4760</span>              // if bypass this wal entry, ignore it ...<a name="line.4760"></a>
-<span class="sourceLineNo">4761</span>              continue;<a name="line.4761"></a>
-<span class="sourceLineNo">4762</span>            }<a name="line.4762"></a>
-<span class="sourceLineNo">4763</span>          }<a name="line.4763"></a>
-<span class="sourceLineNo">4764</span>          boolean checkRowWithinBoundary = false;<a name="line.4764"></a>
-<span class="sourceLineNo">4765</span>          // Check this edit is for this region.<a name="line.4765"></a>
-<span class="sourceLineNo">4766</span>          if (!Bytes.equals(key.getEncodedRegionName(),<a name="line.4766"></a>
-<span class="sourceLineNo">4767</span>              this.getRegionInfo().getEncodedNameAsBytes())) {<a name="line.4767"></a>
-<span class="sourceLineNo">4768</span>            checkRowWithinBoundary = true;<a name="line.4768"></a>
-<span class="sourceLineNo">4769</span>          }<a name="line.4769"></a>
+<span class="sourceLineNo">4683</span>  /*<a name="line.4683"></a>
+<span class="sourceLineNo">4684</span>   * @param edits File of recovered edits.<a name="line.4684"></a>
+<span class="sourceLineNo">4685</span>   * @param maxSeqIdInStores Maximum sequenceid found in each store.  Edits in wal<a name="line.4685"></a>
+<span class="sourceLineNo">4686</span>   * must be larger than this to be replayed for each store.<a name="line.4686"></a>
+<span class="sourceLineNo">4687</span>   * @param reporter<a name="line.4687"></a>
+<span class="sourceLineNo">4688</span>   * @return the sequence id of the last edit added to this region out of the<a name="line.4688"></a>
+<span class="sourceLineNo">4689</span>   * recovered edits log or &lt;code&gt;minSeqId&lt;/code&gt; if nothing added from editlogs.<a name="line.4689"></a>
+<span class="sourceLineNo">4690</span>   * @throws IOException<a name="line.4690"></a>
+<span class="sourceLineNo">4691</span>   */<a name="line.4691"></a>
+<span class="sourceLineNo">4692</span>  private long replayRecoveredEdits(final Path edits,<a name="line.4692"></a>
+<span class="sourceLineNo">4693</span>      Map&lt;byte[], Long&gt; maxSeqIdInStores, final CancelableProgressable reporter, FileSystem fs)<a name="line.4693"></a>
+<span class="sourceLineNo">4694</span>    throws IOException {<a name="line.4694"></a>
+<span class="sourceLineNo">4695</span>    String msg = "Replaying edits from " + edits;<a name="line.4695"></a>
+<span class="sourceLineNo">4696</span>    LOG.info(msg);<a name="line.4696"></a>
+<span class="sourceLineNo">4697</span>    MonitoredTask status = TaskMonitor.get().createStatus(msg);<a name="line.4697"></a>
+<span class="sourceLineNo">4698</span><a name="line.4698"></a>
+<span class="sourceLineNo">4699</span>    status.setStatus("Opening recovered edits");<a name="line.4699"></a>
+<span class="sourceLineNo">4700</span>    WAL.Reader reader = null;<a name="line.4700"></a>
+<span class="sourceLineNo">4701</span>    try {<a name="line.4701"></a>
+<span class="sourceLineNo">4702</span>      reader = WALFactory.createReader(fs, edits, conf);<a name="line.4702"></a>
+<span class="sourceLineNo">4703</span>      long currentEditSeqId = -1;<a name="line.4703"></a>
+<span class="sourceLineNo">4704</span>      long currentReplaySeqId = -1;<a name="line.4704"></a>
+<span class="sourceLineNo">4705</span>      long firstSeqIdInLog = -1;<a name="line.4705"></a>
+<span class="sourceLineNo">4706</span>      long skippedEdits = 0;<a name="line.4706"></a>
+<span class="sourceLineNo">4707</span>      long editsCount = 0;<a name="line.4707"></a>
+<span class="sourceLineNo">4708</span>      long intervalEdits = 0;<a name="line.4708"></a>
+<span class="sourceLineNo">4709</span>      WAL.Entry entry;<a name="line.4709"></a>
+<span class="sourceLineNo">4710</span>      HStore store = null;<a name="line.4710"></a>
+<span class="sourceLineNo">4711</span>      boolean reported_once = false;<a name="line.4711"></a>
+<span class="sourceLineNo">4712</span>      ServerNonceManager ng = this.rsServices == null ? null : this.rsServices.getNonceManager();<a name="line.4712"></a>
+<span class="sourceLineNo">4713</span><a name="line.4713"></a>
+<span class="sourceLineNo">4714</span>      try {<a name="line.4714"></a>
+<span class="sourceLineNo">4715</span>        // How many edits seen before we check elapsed time<a name="line.4715"></a>
+<span class="sourceLineNo">4716</span>        int interval = this.conf.getInt("hbase.hstore.report.interval.edits", 2000);<a name="line.4716"></a>
+<span class="sourceLineNo">4717</span>        // How often to send a progress report (default 1/2 master timeout)<a name="line.4717"></a>
+<span class="sourceLineNo">4718</span>        int period = this.conf.getInt("hbase.hstore.report.period", 300000);<a name="line.4718"></a>
+<span class="sourceLineNo">4719</span>        long lastReport = EnvironmentEdgeManager.currentTime();<a name="line.4719"></a>
+<span class="sourceLineNo">4720</span><a name="line.4720"></a>
+<span class="sourceLineNo">4721</span>        if (coprocessorHost != null) {<a name="line.4721"></a>
+<span class="sourceLineNo">4722</span>          coprocessorHost.preReplayWALs(this.getRegionInfo(), edits);<a name="line.4722"></a>
+<span class="sourceLineNo">4723</span>        }<a name="line.4723"></a>
+<span class="sourceLineNo">4724</span><a name="line.4724"></a>
+<span class="sourceLineNo">4725</span>        while ((entry = reader.next()) != null) {<a name="line.4725"></a>
+<span class="sourceLineNo">4726</span>          WALKey key = entry.getKey();<a name="line.4726"></a>
+<span class="sourceLineNo">4727</span>          WALEdit val = entry.getEdit();<a name="line.4727"></a>
+<span class="sourceLineNo">4728</span><a name="line.4728"></a>
+<span class="sourceLineNo">4729</span>          if (ng != null) { // some test, or nonces disabled<a name="line.4729"></a>
+<span class="sourceLineNo">4730</span>            ng.reportOperationFromWal(key.getNonceGroup(), key.getNonce(), key.getWriteTime());<a name="line.4730"></a>
+<span class="sourceLineNo">4731</span>          }<a name="line.4731"></a>
+<span class="sourceLineNo">4732</span><a name="line.4732"></a>
+<span class="sourceLineNo">4733</span>          if (reporter != null) {<a name="line.4733"></a>
+<span class="sourceLineNo">4734</span>            intervalEdits += val.size();<a name="line.4734"></a>
+<span class="sourceLineNo">4735</span>            if (intervalEdits &gt;= interval) {<a name="line.4735"></a>
+<span class="sourceLineNo">4736</span>              // Number of edits interval reached<a name="line.4736"></a>
+<span class="sourceLineNo">4737</span>              intervalEdits = 0;<a name="line.4737"></a>
+<span class="sourceLineNo">4738</span>              long cur = EnvironmentEdgeManager.currentTime();<a name="line.4738"></a>
+<span class="sourceLineNo">4739</span>              if (lastReport + period &lt;= cur) {<a name="line.4739"></a>
+<span class="sourceLineNo">4740</span>                status.setStatus("Replaying edits..." +<a name="line.4740"></a>
+<span class="sourceLineNo">4741</span>                    " skipped=" + skippedEdits +<a name="line.4741"></a>
+<span class="sourceLineNo">4742</span>                    " edits=" + editsCount);<a name="line.4742"></a>
+<span class="sourceLineNo">4743</span>                // Timeout reached<a name="line.4743"></a>
+<span class="sourceLineNo">4744</span>                if(!reporter.progress()) {<a name="line.4744"></a>
+<span class="sourceLineNo">4745</span>                  msg = "Progressable reporter failed, stopping replay";<a name="line.4745"></a>
+<span class="sourceLineNo">4746</span>                  LOG.warn(msg);<a name="line.4746"></a>
+<span class="sourceLineNo">4747</span>                  status.abort(msg);<a name="line.4747"></a>
+<span class="sourceLineNo">4748</span>                  throw new IOException(msg);<a name="line.4748"></a>
+<span class="sourceLineNo">4749</span>                }<a name="line.4749"></a>
+<span class="sourceLineNo">4750</span>                reported_once = true;<a name="line.4750"></a>
+<span class="sourceLineNo">4751</span>                lastReport = cur;<a name="line.4751"></a>
+<span class="sourceLineNo">4752</span>              }<a name="line.4752"></a>
+<span class="sourceLineNo">4753</span>            }<a name="line.4753"></a>
+<span class="sourceLineNo">4754</span>          }<a name="line.4754"></a>
+<span class="sourceLineNo">4755</span><a name="line.4755"></a>
+<span class="sourceLineNo">4756</span>          if (firstSeqIdInLog == -1) {<a name="line.4756"></a>
+<span class="sourceLineNo">4757</span>            firstSeqIdInLog = key.getSequenceId();<a name="line.4757"></a>
+<span class="sourceLineNo">4758</span>          }<a name="line.4758"></a>
+<span class="sourceLineNo">4759</span>          if (currentEditSeqId &gt; key.getSequenceId()) {<a name="line.4759"></a>
+<span class="sourceLineNo">4760</span>            // when this condition is true, it means we have a serious defect because we need to<a name="line.4760"></a>
+<span class="sourceLineNo">4761</span>            // maintain increasing SeqId for WAL edits per region<a name="line.4761"></a>
+<span class="sourceLineNo">4762</span>            LOG.error(getRegionInfo().getEncodedName() + " : "<a name="line.4762"></a>
+<span class="sourceLineNo">4763</span>                 + "Found decreasing SeqId. PreId=" + currentEditSeqId + " key=" + key<a name="line.4763"></a>
+<span class="sourceLineNo">4764</span>                + "; edit=" + val);<a name="line.4764"></a>
+<span class="sourceLineNo">4765</span>          } else {<a name="line.4765"></a>
+<span class="sourceLineNo">4766</span>            currentEditSeqId = key.getSequenceId();<a name="line.4766"></a>
+<span class="sourceLineNo">4767</span>          }<a name="line.4767"></a>
+<span class="sourceLineNo">4768</span>          currentReplaySeqId = (key.getOrigLogSeqNum() &gt; 0) ?<a name="line.4768"></a>
+<span class="sourceLineNo">4769</span>            key.getOrigLogSeqNum() : currentEditSeqId;<a name="line.4769"></a>
 <span class="sourceLineNo">4770</span><a name="line.4770"></a>
-<span class="sourceLineNo">4771</span>          boolean flush = false;<a name="line.4771"></a>
-<span class="sourceLineNo">4772</span>          MemStoreSizing memStoreSizing = new NonThreadSafeMemStoreSizing();<a name="line.4772"></a>
-<span class="sourceLineNo">4773</span>          for (Cell cell: val.getCells()) {<a name="line.4773"></a>
-<span class="sourceLineNo">4774</span>            // Check this edit is for me. Also, guard against writing the special<a name="line.4774"></a>
-<span class="sourceLineNo">4775</span>            // METACOLUMN info such as HBASE::CACHEFLUSH entries<a name="line.4775"></a>
-<span class="sourceLineNo">4776</span>            if (CellUtil.matchingFamily(cell, WALEdit.METAFAMILY)) {<a name="line.4776"></a>
-<span class="sourceLineNo">4777</span>              // if region names don't match, skipp replaying compaction marker<a name="line.4777"></a>
-<span class="sourceLineNo">4778</span>              if (!checkRowWithinBoundary) {<a name="line.4778"></a>
-<span class="sourceLineNo">4779</span>                //this is a special edit, we should handle it<a name="line.4779"></a>
-<span class="sourceLineNo">4780</span>                CompactionDescriptor compaction = WALEdit.getCompaction(cell);<a name="line.4780"></a>
-<span class="sourceLineNo">4781</span>                if (compaction != null) {<a name="line.4781"></a>
-<span class="sourceLineNo">4782</span>                  //replay the compaction<a name="line.4782"></a>
-<span class="sourceLineNo">4783</span>                  replayWALCompactionMarker(compaction, false, true, Long.MAX_VALUE);<a name="line.4783"></a>
-<span class="sourceLineNo">4784</span>                }<a name="line.4784"></a>
-<span class="sourceLineNo">4785</span>              }<a name="line.4785"></a>
-<span class="sourceLineNo">4786</span>              skippedEdits++;<a name="line.4786"></a>
-<span class="sourceLineNo">4787</span>              continue;<a name="line.4787"></a>
-<span class="sourceLineNo">4788</span>            }<a name="line.4788"></a>
-<span class="sourceLineNo">4789</span>            // Figure which store the edit is meant for.<a name="line.4789"></a>
-<span class="sourceLineNo">4790</span>            if (store == null || !CellUtil.matchingFamily(cell,<a name="line.4790"></a>
-<span class="sourceLineNo">4791</span>                store.getColumnFamilyDescriptor().getName())) {<a name="line.4791"></a>
-<span class="sourceLineNo">4792</span>              store = getStore(cell);<a name="line.4792"></a>
-<span class="sourceLineNo">4793</span>            }<a name="line.4793"></a>
-<span class="sourceLineNo">4794</span>            if (store == null) {<a name="line.4794"></a>
-<span class="sourceLineNo">4795</span>              // This should never happen.  Perhaps schema was changed between<a name="line.4795"></a>
-<span class="sourceLineNo">4796</span>              // crash and redeploy?<a name="line.4796"></a>
-<span class="sourceLineNo">4797</span>              LOG.warn("No family for " + cell);<a name="line.4797"></a>
-<span class="sourceLineNo">4798</span>              skippedEdits++;<a name="line.4798"></a>
-<span class="sourceLineNo">4799</span>              continue;<a name="line.4799"></a>
-<span class="sourceLineNo">4800</span>            }<a name="line.4800"></a>
-<span class="sourceLineNo">4801</span>            if (checkRowWithinBoundary &amp;&amp; !rowIsInRange(this.getRegionInfo(),<a name="line.4801"></a>
-<span class="sourceLineNo">4802</span>              cell.getRowArray(), cell.getRowOffset(), cell.getRowLength())) {<a name="line.4802"></a>
-<span class="sourceLineNo">4803</span>              LOG.warn("Row of " + cell + " is not within region boundary");<a name="line.4803"></a>
-<span class="sourceLineNo">4804</span>              skippedEdits++;<a name="line.4804"></a>
-<span class="sourceLineNo">4805</span>              continue;<a name="line.4805"></a>
-<span class="sourceLineNo">4806</span>            }<a name="line.4806"></a>
-<span class="sourceLineNo">4807</span>            // Now, figure if we should skip this edit.<a name="line.4807"></a>
-<span class="sourceLineNo">4808</span>            if (key.getSequenceId() &lt;= maxSeqIdInStores.get(store.getColumnFamilyDescriptor()<a name="line.4808"></a>
-<span class="sourceLineNo">4809</span>                .getName())) {<a name="line.4809"></a>
-<span class="sourceLineNo">4810</span>              skippedEdits++;<a name="line.4810"></a>
-<span class="sourceLineNo">4811</span>              continue;<a name="line.4811"></a>
-<span class="sourceLineNo">4812</span>            }<a name="line.4812"></a>
-<span class="sourceLineNo">4813</span>            PrivateCellUtil.setSequenceId(cell, currentReplaySeqId);<a name="line.4813"></a>
-<span class="sourceLineNo">4814</span><a name="line.4814"></a>
-<span class="sourceLineNo">4815</span>            restoreEdit(store, cell, memStoreSizing);<a name="line.4815"></a>
-<span class="sourceLineNo">4816</span>            editsCount++;<a name="line.4816"></a>
-<span class="sourceLineNo">4817</span>          }<a name="line.4817"></a>
-<span class="sourceLineNo">4818</span>          MemStoreSize mss = memStoreSizing.getMemStoreSize();<a name="line.4818"></a>
-<span class="sourceLineNo">4819</span>          incMemStoreSize(mss);<a name="line.4819"></a>
-<span class="sourceLineNo">4820</span>          flush = isFlushSize(this.memStoreSizing.getMemStoreSize());<a name="line.4820"></a>
-<span class="sourceLineNo">4821</span>          if (flush) {<a name="line.4821"></a>
-<span class="sourceLineNo">4822</span>            internalFlushcache(null, currentEditSeqId, stores.values(), status, false,<a name="line.4822"></a>
-<span class="sourceLineNo">4823</span>              FlushLifeCycleTracker.DUMMY);<a name="line.4823"></a>
-<span class="sourceLineNo">4824</span>          }<a name="line.4824"></a>
-<span class="sourceLineNo">4825</span><a name="line.4825"></a>
-<span class="sourceLineNo">4826</span>          if (coprocessorHost != null) {<a name="line.4826"></a>
-<span class="sourceLineNo">4827</span>            coprocessorHost.postWALRestore(this.getRegionInfo(), key, val);<a name="line.4827"></a>
-<span class="sourceLineNo">4828</span>          }<a name="line.4828"></a>
-<span class="sourceLineNo">4829</span>        }<a name="line.4829"></a>
+<span class="sourceLineNo">4771</span>          // Start coprocessor replay here. The coprocessor is for each WALEdit<a name="line.4771"></a>
+<span class="sourceLineNo">4772</span>          // instead of a KeyValue.<a name="line.4772"></a>
+<span class="sourceLineNo">4773</span>          if (coprocessorHost != null) {<a name="line.4773"></a>
+<span class="sourceLineNo">4774</span>            status.setStatus("Running pre-WAL-restore hook in coprocessors");<a name="line.4774"></a>
+<span class="sourceLineNo">4775</span>            if (coprocessorHost.preWALRestore(this.getRegionInfo(), key, val)) {<a name="line.4775"></a>
+<span class="sourceLineNo">4776</span>              // if bypass this wal entry, ignore it ...<a name="line.4776"></a>
+<span class="sourceLineNo">4777</span>              continue;<a name="line.4777"></a>
+<span class="sourceLineNo">4778</span>            }<a name="line.4778"></a>
+<span class="sourceLineNo">4779</span>          }<a name="line.4779"></a>
+<span class="sourceLineNo">4780</span>          boolean checkRowWithinBoundary = false;<a name="line.4780"></a>
+<span class="sourceLineNo">4781</span>          // Check this edit is for this region.<a name="line.4781"></a>
+<span class="sourceLineNo">4782</span>          if (!Bytes.equals(key.getEncodedRegionName(),<a name="line.4782"></a>
+<span class="sourceLineNo">4783</span>              this.getRegionInfo().getEncodedNameAsBytes())) {<a name="line.4783"></a>
+<span class="sourceLineNo">4784</span>            checkRowWithinBoundary = true;<a name="line.4784"></a>
+<span class="sourceLineNo">4785</span>          }<a name="line.4785"></a>
+<span class="sourceLineNo">4786</span><a name="line.4786"></a>
+<span class="sourceLineNo">4787</span>          boolean flush = false;<a name="line.4787"></a>
+<span class="sourceLineNo">4788</span>          MemStoreSizing memStoreSizing = new NonThreadSafeMemStoreSizing();<a name="line.4788"></a>
+<span class="sourceLineNo">4789</span>          for (Cell cell: val.getCells()) {<a name="line.4789"></a>
+<span class="sourceLineNo">4790</span>            // Check this edit is for me. Also, guard against writing the special<a name="line.4790"></a>
+<span class="sourceLineNo">4791</span>            // METACOLUMN info such as HBASE::CACHEFLUSH entries<a name="line.4791"></a>
+<span class="sourceLineNo">4792</span>            if (CellUtil.matchingFamily(cell, WALEdit.METAFAMILY)) {<a name="line.4792"></a>
+<span class="sourceLineNo">4793</span>              // if region names don't match, skipp replaying compaction marker<a name="line.4793"></a>
+<span class="sourceLineNo">4794</span>              if (!checkRowWithinBoundary) {<a name="line.4794"></a>
+<span class="sourceLineNo">4795</span>                //this is a special edit, we should handle it<a name="line.4795"></a>
+<span class="sourceLineNo">4796</span>                CompactionDescriptor compaction = WALEdit.getCompaction(cell);<a name="line.4796"></a>
+<span class="sourceLineNo">4797</span>                if (compaction != null) {<a name="line.4797"></a>
+<span class="sourceLineNo">4798</span>                  //replay the compaction<a name="line.4798"></a>
+<span class="sourceLineNo">4799</span>                  replayWALCompactionMarker(compaction, false, true, Long.MAX_VALUE);<a name="line.4799"></a>
+<span class="sourceLineNo">4800</span>                }<a name="line.4800"></a>
+<span class="sourceLineNo">4801</span>              }<a name="line.4801"></a>
+<span class="sourceLineNo">4802</span>              skippedEdits++;<a name="line.4802"></a>
+<span class="sourceLineNo">4803</span>              continue;<a name="line.4803"></a>
+<span class="sourceLineNo">4804</span>            }<a name="line.4804"></a>
+<span class="sourceLineNo">4805</span>            // Figure which store the edit is meant for.<a name="line.4805"></a>
+<span class="sourceLineNo">4806</span>            if (store == null || !CellUtil.matchingFamily(cell,<a name="line.4806"></a>
+<span class="sourceLineNo">4807</span>                store.getColumnFamilyDescriptor().getName())) {<a name="line.4807"></a>
+<span class="sourceLineNo">4808</span>              store = getStore(cell);<a name="line.4808"></a>
+<span class="sourceLineNo">4809</span>            }<a name="line.4809"></a>
+<span class="sourceLineNo">4810</span>            if (store == null) {<a name="line.4810"></a>
+<span class="sourceLineNo">4811</span>              // This should never happen.  Perhaps schema was changed between<a name="line.4811"></a>
+<span class="sourceLineNo">4812</span>              // crash and redeploy?<a name="line.4812"></a>
+<span class="sourceLineNo">4813</span>              LOG.warn("No family for " + cell);<a name="line.4813"></a>
+<span class="sourceLineNo">4814</span>              skippedEdits++;<a name="line.4814"></a>
+<span class="sourceLineNo">4815</span>              continue;<a name="line.4815"></a>
+<span class="sourceLineNo">4816</span>            }<a name="line.4816"></a>
+<span class="sourceLineNo">4817</span>            if (checkRowWithinBoundary &amp;&amp; !rowIsInRange(this.getRegionInfo(),<a name="line.4817"></a>
+<span class="sourceLineNo">4818</span>              cell.getRowArray(), cell.getRowOffset(), cell.getRowLength())) {<a name="line.4818"></a>
+<span class="sourceLineNo">4819</span>              LOG.warn("Row of " + cell + " is not within region boundary");<a name="line.4819"></a>
+<span class="sourceLineNo">4820</span>              skippedEdits++;<a name="line.4820"></a>
+<span class="sourceLineNo">4821</span>              continue;<a name="line.4821"></a>
+<span class="sourceLineNo">4822</span>            }<a name="line.4822"></a>
+<span class="sourceLineNo">4823</span>            // Now, figure if we should skip this edit.<a name="line.4823"></a>
+<span class="sourceLineNo">4824</span>            if (key.getSequenceId() &lt;= maxSeqIdInStores.get(store.getColumnFamilyDescriptor()<a name="line.4824"></a>
+<span class="sourceLineNo">4825</span>                .getName())) {<a name="line.4825"></a>
+<span class="sourceLineNo">4826</span>              skippedEdits++;<a name="line.4826"></a>
+<span class="sourceLineNo">4827</span>              continue;<a name="line.4827"></a>
+<span class="sourceLineNo">4828</span>            }<a name="line.4828"></a>
+<span class="sourceLineNo">4829</span>            PrivateCellUtil.setSequenceId(cell, currentReplaySeqId);<a name="line.4829"></a>
 <span class="sourceLineNo">4830</span><a name="line.4830"></a>
-<span class="sourceLineNo">4831</span>        if (coprocessorHost != null) {<a name="line.4831"></a>
-<span class="sourceLineNo">4832</span>          coprocessorHost.postReplayWALs(this.getRegionInfo(), edits);<a name="line.4832"></a>
-<span class="sourceLineNo">4833</span>        }<a name="line.4833"></a>
-<span class="sourceLineNo">4834</span>      } catch (EOFException eof) {<a name="line.4834"></a>
-<span class="sourceLineNo">4835</span>        Path p = WALSplitter.moveAsideBadEditsFile(walFS, edits);<a name="line.4835"></a>
-<span class="sourceLineNo">4836</span>        msg = "EnLongAddered EOF. Most likely due to Master failure during " +<a name="line.4836"></a>
-<span class="sourceLineNo">4837</span>            "wal splitting, so we have this data in another edit.  " +<a name="line.4837"></a>
-<span class="sourceLineNo">4838</span>            "Continuing, but renaming " + edits + " as " + p;<a name="line.4838"></a>
-<span class="sourceLineNo">4839</span>        LOG.warn(msg, eof);<a name="line.4839"></a>
-<span class="sourceLineNo">4840</span>        status.abort(msg);<a name="line.4840"></a>
-<span class="sourceLineNo">4841</span>      } catch (IOException ioe) {<a name="line.4841"></a>
-<span class="sourceLineNo">4842</span>        // If the IOE resulted from bad file format,<a name="line.4842"></a>
-<span class="sourceLineNo">4843</span>        // then this problem is idempotent and retrying won't help<a name="line.4843"></a>
-<span class="sourceLineNo">4844</span>        if (ioe.getCause() instanceof ParseException) {<a name="line.4844"></a>
-<span class="sourceLineNo">4845</span>          Path p = WALSplitter.moveAsideBadEditsFile(walFS, edits);<a name="line.4845"></a>
-<span class="sourceLineNo">4846</span>          msg = "File corruption enLongAddered!  " +<a name="line.4846"></a>
-<span class="sourceLineNo">4847</span>              "Continuing, but renaming " + edits + " as " + p;<a name="line.4847"></a>
-<span class="sourceLineNo">4848</span>          LOG.warn(msg, ioe);<a name="line.4848"></a>
-<span class="sourceLineNo">4849</span>          status.setStatus(msg);<a name="line.4849"></a>
-<span class="sourceLineNo">4850</span>        } else {<a name="line.4850"></a>
-<span class="sourceLineNo">4851</span>          status.abort(StringUtils.stringifyException(ioe));<a name="line.4851"></a>
-<span class="sourceLineNo">4852</span>          // other IO errors may be transient (bad network connection,<a name="line.4852"></a>
-<span class="sourceLineNo">4853</span>          // checksum exception on one datanode, etc).  throw &amp; retry<a name="line.4853"></a>
-<span class="sourceLineNo">4854</span>          throw ioe;<a name="line.4854"></a>
-<span class="sourceLineNo">4855</span>        }<a name="line.4855"></a>
-<span class="sourceLineNo">4856</span>      }<a name="line.4856"></a>
-<span class="sourceLineNo">4857</span>      if (reporter != null &amp;&amp; !reported_once) {<a name="line.4857"></a>
-<span class="sourceLineNo">4858</span>        reporter.progress();<a name="line.4858"></a>
-<span class="sourceLineNo">4859</span>      }<a name="line.4859"></a>
-<span class="sourceLineNo">4860</span>      msg = "Applied " + editsCount + ", skipped " + skippedEdits +<a name="line.4860"></a>
-<span class="sourceLineNo">4861</span>        ", firstSequenceIdInLog=" + firstSeqIdInLog +<a name="line.4861"></a>
-<span class="sourceLineNo">4862</span>        ", maxSequenceIdInLog=" + currentEditSeqId + ", path=" + edits;<a name="line.4862"></a>
-<span class="sourceLineNo">4863</span>      status.markComplete(msg);<a name="line.4863"></a>
-<span class="sourceLineNo">4864</span>      LOG.debug(msg);<a name="line.4864"></a>
-<span class="sourceLineNo">4865</span>      return currentEditSeqId;<a name="line.4865"></a>
-<span class="sourceLineNo">4866</span>    } finally {<a name="line.4866"></a>
-<span class="sourceLineNo">4867</span>      status.cleanup();<a name="line.4867"></a>
-<span class="sourceLineNo">4868</span>      if (reader != null) {<a name="line.4868"></a>
-<span class="sourceLineNo">4869</span>         reader.close();<a name="line.4869"></a>
-<span class="sourceLineNo">4870</span>      }<a name="line.4870"></a>
-<span class="sourceLineNo">4871</span>    }<a name="line.4871"></a>
-<span class="sourceLineNo">4872</span>  }<a name="line.4872"></a>
-<span class="sourceLineNo">4873</span><a name="line.4873"></a>
-<span class="sourceLineNo">4874</span>  /**<a name="line.4874"></a>
-<span class="sourceLineNo">4875</span>   * Call to complete a compaction. Its for the case where we find in the WAL a compaction<a name="line.4875"></a>
-<span class="sourceLineNo">4876</span>   * that was not finished.  We could find one recovering a WAL after a regionserver crash.<a name="line.4876"></a>
-<span class="sourceLineNo">4877</span>   * See HBASE-2331.<a name="line.4877"></a>
-<span class="sourceLineNo">4878</span>   */<a name="line.4878"></a>
-<span class="sourceLineNo">4879</span>  void replayWALCompactionMarker(CompactionDescriptor compaction, boolean pickCompactionFiles,<a name="line.4879"></a>
-<span class="sourceLineNo">4880</span>      boolean removeFiles, long replaySeqId)<a name="line.4880"></a>
-<span class="sourceLineNo">4881</span>      throws IOException {<a name="line.4881"></a>
-<span class="sourceLineNo">4882</span>    try {<a name="line.4882"></a>
-<span class="sourceLineNo">4883</span>      checkTargetRegion(compaction.getEncodedRegionName().toByteArray(),<a name="line.4883"></a>
-<span class="sourceLineNo">4884</span>        "Compaction marker from WAL ", compaction);<a name="line.4884"></a>
-<span class="sourceLineNo">4885</span>    } catch (WrongRegionException wre) {<a name="line.4885"></a>
-<span class="sourceLineNo">4886</span>      if (RegionReplicaUtil.isDefaultReplica(this.getRegionInfo())) {<a name="line.4886"></a>
-<span class="sourceLineNo">4887</span>        // skip the compaction marker since it is not for this region<a name="line.4887"></a>
-<span class="sourceLineNo">4888</span>        return;<a name="line.4888"></a>
-<span class="sourceLineNo">4889</span>      }<a name="line.4889"></a>
-<span class="sourceLineNo">4890</span>      throw wre;<a name="line.4890"></a>
-<span class="sourceLineNo">4891</span>    }<a name="line.4891"></a>
-<span class="sourceLineNo">4892</span><a name="line.4892"></a>
-<span class="sourceLineNo">4893</span>    synchronized (writestate) {<a name="line.4893"></a>
-<span class="sourceLineNo">4894</span>      if (replaySeqId &lt; lastReplayedOpenRegionSeqId) {<a name="line.4894"></a>
-<span class="sourceLineNo">4895</span>        LOG.warn(getRegionInfo().getEncodedName() + " : "<a name="line.4895"></a>
-<span class="sourceLineNo">4896</span>            + "Skipping replaying compaction event :" + TextFormat.shortDebugString(compaction)<a name="line.4896"></a>
-<span class="sourceLineNo">4897</span>            + " because its sequence id " + replaySeqId + " is smaller than this regions "<a name="line.4897"></a>
-<span class="sourceLineNo">4898</span>            + "lastReplayedOpenRegionSeqId of " + lastReplayedOpenRegionSeqId);<a name="line.4898"></a>
-<span class="sourceLineNo">4899</span>        return;<a name="line.4899"></a>
-<span class="sourceLineNo">4900</span>      }<a name="line.4900"></a>
-<span class="sourceLineNo">4901</span>      if (replaySeqId &lt; lastReplayedCompactionSeqId) {<a name="line.4901"></a>
-<span class="sourceLineNo">4902</span>        LOG.warn(getRegionInfo().getEncodedName() + " : "<a name="line.4902"></a>
-<span class="sourceLineNo">4903</span>            + "Skipping replaying compaction event :" + TextFormat.shortDebugString(compaction)<a name="line.4903"></a>
-<span class="sourceLineNo">4904</span>            + " because its sequence id " + replaySeqId + " is smaller than this regions "<a name="line.4904"></a>
-<span class="sourceLineNo">4905</span>            + "lastReplayedCompactionSeqId of " + lastReplayedCompactionSeqId);<a name="line.4905"></a>
-<span class="sourceLineNo">4906</span>        return;<a name="line.4906"></a>
-<span class="sourceLineNo">4907</span>      } else {<a name="line.4907"></a>
-<span class="sourceLineNo">4908</span>        lastReplayedCompacti

<TRUNCATED>

Mime
View raw message