hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From git-site-r...@apache.org
Subject [07/11] hbase-site git commit: Published site at a31458bdee4353d99682cb4e108e265ec45f8944.
Date Tue, 06 Nov 2018 14:54:02 GMT
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/bd4d10ee/devapidocs/src-html/org/apache/hadoop/hbase/wal/WALFactory.Providers.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/wal/WALFactory.Providers.html b/devapidocs/src-html/org/apache/hadoop/hbase/wal/WALFactory.Providers.html
index 92967f2..a20bd89 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/wal/WALFactory.Providers.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/wal/WALFactory.Providers.html
@@ -268,170 +268,170 @@
 <span class="sourceLineNo">260</span>      if (provider != null) {<a name="line.260"></a>
 <span class="sourceLineNo">261</span>        return provider;<a name="line.261"></a>
 <span class="sourceLineNo">262</span>      }<a name="line.262"></a>
-<span class="sourceLineNo">263</span>      provider = createProvider(getProviderClass(META_WAL_PROVIDER,<a name="line.263"></a>
-<span class="sourceLineNo">264</span>          conf.get(WAL_PROVIDER, DEFAULT_WAL_PROVIDER)));<a name="line.264"></a>
-<span class="sourceLineNo">265</span>      provider.init(this, conf, AbstractFSWALProvider.META_WAL_PROVIDER_ID);<a name="line.265"></a>
-<span class="sourceLineNo">266</span>      provider.addWALActionsListener(new MetricsWAL());<a name="line.266"></a>
-<span class="sourceLineNo">267</span>      if (metaProvider.compareAndSet(null, provider)) {<a name="line.267"></a>
-<span class="sourceLineNo">268</span>        return provider;<a name="line.268"></a>
-<span class="sourceLineNo">269</span>      } else {<a name="line.269"></a>
-<span class="sourceLineNo">270</span>        // someone is ahead of us, close and try again.<a name="line.270"></a>
-<span class="sourceLineNo">271</span>        provider.close();<a name="line.271"></a>
-<span class="sourceLineNo">272</span>      }<a name="line.272"></a>
-<span class="sourceLineNo">273</span>    }<a name="line.273"></a>
-<span class="sourceLineNo">274</span>  }<a name="line.274"></a>
-<span class="sourceLineNo">275</span><a name="line.275"></a>
-<span class="sourceLineNo">276</span>  /**<a name="line.276"></a>
-<span class="sourceLineNo">277</span>   * @param region the region which we want to get a WAL for it. Could be null.<a name="line.277"></a>
-<span class="sourceLineNo">278</span>   */<a name="line.278"></a>
-<span class="sourceLineNo">279</span>  public WAL getWAL(RegionInfo region) throws IOException {<a name="line.279"></a>
-<span class="sourceLineNo">280</span>    // use different WAL for hbase:meta<a name="line.280"></a>
-<span class="sourceLineNo">281</span>    if (region != null &amp;&amp; region.isMetaRegion() &amp;&amp;<a name="line.281"></a>
-<span class="sourceLineNo">282</span>      region.getReplicaId() == RegionInfo.DEFAULT_REPLICA_ID) {<a name="line.282"></a>
-<span class="sourceLineNo">283</span>      return getMetaProvider().getWAL(region);<a name="line.283"></a>
-<span class="sourceLineNo">284</span>    } else {<a name="line.284"></a>
-<span class="sourceLineNo">285</span>      return provider.getWAL(region);<a name="line.285"></a>
-<span class="sourceLineNo">286</span>    }<a name="line.286"></a>
-<span class="sourceLineNo">287</span>  }<a name="line.287"></a>
-<span class="sourceLineNo">288</span><a name="line.288"></a>
-<span class="sourceLineNo">289</span>  public Reader createReader(final FileSystem fs, final Path path) throws IOException {<a name="line.289"></a>
-<span class="sourceLineNo">290</span>    return createReader(fs, path, (CancelableProgressable)null);<a name="line.290"></a>
-<span class="sourceLineNo">291</span>  }<a name="line.291"></a>
-<span class="sourceLineNo">292</span><a name="line.292"></a>
-<span class="sourceLineNo">293</span>  /**<a name="line.293"></a>
-<span class="sourceLineNo">294</span>   * Create a reader for the WAL. If you are reading from a file that's being written to and need<a name="line.294"></a>
-<span class="sourceLineNo">295</span>   * to reopen it multiple times, use {@link WAL.Reader#reset()} instead of this method<a name="line.295"></a>
-<span class="sourceLineNo">296</span>   * then just seek back to the last known good position.<a name="line.296"></a>
-<span class="sourceLineNo">297</span>   * @return A WAL reader.  Close when done with it.<a name="line.297"></a>
-<span class="sourceLineNo">298</span>   * @throws IOException<a name="line.298"></a>
-<span class="sourceLineNo">299</span>   */<a name="line.299"></a>
-<span class="sourceLineNo">300</span>  public Reader createReader(final FileSystem fs, final Path path,<a name="line.300"></a>
-<span class="sourceLineNo">301</span>      CancelableProgressable reporter) throws IOException {<a name="line.301"></a>
-<span class="sourceLineNo">302</span>    return createReader(fs, path, reporter, true);<a name="line.302"></a>
-<span class="sourceLineNo">303</span>  }<a name="line.303"></a>
-<span class="sourceLineNo">304</span><a name="line.304"></a>
-<span class="sourceLineNo">305</span>  public Reader createReader(final FileSystem fs, final Path path, CancelableProgressable reporter,<a name="line.305"></a>
-<span class="sourceLineNo">306</span>      boolean allowCustom) throws IOException {<a name="line.306"></a>
-<span class="sourceLineNo">307</span>    Class&lt;? extends AbstractFSWALProvider.Reader&gt; lrClass =<a name="line.307"></a>
-<span class="sourceLineNo">308</span>        allowCustom ? logReaderClass : ProtobufLogReader.class;<a name="line.308"></a>
-<span class="sourceLineNo">309</span>    try {<a name="line.309"></a>
-<span class="sourceLineNo">310</span>      // A wal file could be under recovery, so it may take several<a name="line.310"></a>
-<span class="sourceLineNo">311</span>      // tries to get it open. Instead of claiming it is corrupted, retry<a name="line.311"></a>
-<span class="sourceLineNo">312</span>      // to open it up to 5 minutes by default.<a name="line.312"></a>
-<span class="sourceLineNo">313</span>      long startWaiting = EnvironmentEdgeManager.currentTime();<a name="line.313"></a>
-<span class="sourceLineNo">314</span>      long openTimeout = timeoutMillis + startWaiting;<a name="line.314"></a>
-<span class="sourceLineNo">315</span>      int nbAttempt = 0;<a name="line.315"></a>
-<span class="sourceLineNo">316</span>      AbstractFSWALProvider.Reader reader = null;<a name="line.316"></a>
-<span class="sourceLineNo">317</span>      while (true) {<a name="line.317"></a>
-<span class="sourceLineNo">318</span>        try {<a name="line.318"></a>
-<span class="sourceLineNo">319</span>          reader = lrClass.getDeclaredConstructor().newInstance();<a name="line.319"></a>
-<span class="sourceLineNo">320</span>          reader.init(fs, path, conf, null);<a name="line.320"></a>
-<span class="sourceLineNo">321</span>          return reader;<a name="line.321"></a>
-<span class="sourceLineNo">322</span>        } catch (IOException e) {<a name="line.322"></a>
-<span class="sourceLineNo">323</span>          if (reader != null) {<a name="line.323"></a>
-<span class="sourceLineNo">324</span>            try {<a name="line.324"></a>
-<span class="sourceLineNo">325</span>              reader.close();<a name="line.325"></a>
-<span class="sourceLineNo">326</span>            } catch (IOException exception) {<a name="line.326"></a>
-<span class="sourceLineNo">327</span>              LOG.warn("Could not close FSDataInputStream" + exception.getMessage());<a name="line.327"></a>
-<span class="sourceLineNo">328</span>              LOG.debug("exception details", exception);<a name="line.328"></a>
-<span class="sourceLineNo">329</span>            }<a name="line.329"></a>
-<span class="sourceLineNo">330</span>          }<a name="line.330"></a>
-<span class="sourceLineNo">331</span><a name="line.331"></a>
-<span class="sourceLineNo">332</span>          String msg = e.getMessage();<a name="line.332"></a>
-<span class="sourceLineNo">333</span>          if (msg != null<a name="line.333"></a>
-<span class="sourceLineNo">334</span>              &amp;&amp; (msg.contains("Cannot obtain block length")<a name="line.334"></a>
-<span class="sourceLineNo">335</span>                  || msg.contains("Could not obtain the last block") || msg<a name="line.335"></a>
-<span class="sourceLineNo">336</span>                    .matches("Blocklist for [^ ]* has changed.*"))) {<a name="line.336"></a>
-<span class="sourceLineNo">337</span>            if (++nbAttempt == 1) {<a name="line.337"></a>
-<span class="sourceLineNo">338</span>              LOG.warn("Lease should have recovered. This is not expected. Will retry", e);<a name="line.338"></a>
+<span class="sourceLineNo">263</span>      Class&lt;? extends WALProvider&gt; clz = null;<a name="line.263"></a>
+<span class="sourceLineNo">264</span>      if (conf.get(META_WAL_PROVIDER) == null) {<a name="line.264"></a>
+<span class="sourceLineNo">265</span>        try {<a name="line.265"></a>
+<span class="sourceLineNo">266</span>          clz = conf.getClass(WAL_PROVIDER, Providers.defaultProvider.clazz, WALProvider.class);<a name="line.266"></a>
+<span class="sourceLineNo">267</span>        } catch (Throwable t) {<a name="line.267"></a>
+<span class="sourceLineNo">268</span>          // the WAL provider should be an enum. Proceed<a name="line.268"></a>
+<span class="sourceLineNo">269</span>        }<a name="line.269"></a>
+<span class="sourceLineNo">270</span>      } <a name="line.270"></a>
+<span class="sourceLineNo">271</span>      if (clz == null){<a name="line.271"></a>
+<span class="sourceLineNo">272</span>        clz = getProviderClass(META_WAL_PROVIDER, conf.get(WAL_PROVIDER, DEFAULT_WAL_PROVIDER));<a name="line.272"></a>
+<span class="sourceLineNo">273</span>      }<a name="line.273"></a>
+<span class="sourceLineNo">274</span>      provider = createProvider(clz);<a name="line.274"></a>
+<span class="sourceLineNo">275</span>      provider.init(this, conf, AbstractFSWALProvider.META_WAL_PROVIDER_ID);<a name="line.275"></a>
+<span class="sourceLineNo">276</span>      provider.addWALActionsListener(new MetricsWAL());<a name="line.276"></a>
+<span class="sourceLineNo">277</span>      if (metaProvider.compareAndSet(null, provider)) {<a name="line.277"></a>
+<span class="sourceLineNo">278</span>        return provider;<a name="line.278"></a>
+<span class="sourceLineNo">279</span>      } else {<a name="line.279"></a>
+<span class="sourceLineNo">280</span>        // someone is ahead of us, close and try again.<a name="line.280"></a>
+<span class="sourceLineNo">281</span>        provider.close();<a name="line.281"></a>
+<span class="sourceLineNo">282</span>      }<a name="line.282"></a>
+<span class="sourceLineNo">283</span>    }<a name="line.283"></a>
+<span class="sourceLineNo">284</span>  }<a name="line.284"></a>
+<span class="sourceLineNo">285</span><a name="line.285"></a>
+<span class="sourceLineNo">286</span>  /**<a name="line.286"></a>
+<span class="sourceLineNo">287</span>   * @param region the region which we want to get a WAL for it. Could be null.<a name="line.287"></a>
+<span class="sourceLineNo">288</span>   */<a name="line.288"></a>
+<span class="sourceLineNo">289</span>  public WAL getWAL(RegionInfo region) throws IOException {<a name="line.289"></a>
+<span class="sourceLineNo">290</span>    // use different WAL for hbase:meta<a name="line.290"></a>
+<span class="sourceLineNo">291</span>    if (region != null &amp;&amp; region.isMetaRegion() &amp;&amp;<a name="line.291"></a>
+<span class="sourceLineNo">292</span>      region.getReplicaId() == RegionInfo.DEFAULT_REPLICA_ID) {<a name="line.292"></a>
+<span class="sourceLineNo">293</span>      return getMetaProvider().getWAL(region);<a name="line.293"></a>
+<span class="sourceLineNo">294</span>    } else {<a name="line.294"></a>
+<span class="sourceLineNo">295</span>      return provider.getWAL(region);<a name="line.295"></a>
+<span class="sourceLineNo">296</span>    }<a name="line.296"></a>
+<span class="sourceLineNo">297</span>  }<a name="line.297"></a>
+<span class="sourceLineNo">298</span><a name="line.298"></a>
+<span class="sourceLineNo">299</span>  public Reader createReader(final FileSystem fs, final Path path) throws IOException {<a name="line.299"></a>
+<span class="sourceLineNo">300</span>    return createReader(fs, path, (CancelableProgressable)null);<a name="line.300"></a>
+<span class="sourceLineNo">301</span>  }<a name="line.301"></a>
+<span class="sourceLineNo">302</span><a name="line.302"></a>
+<span class="sourceLineNo">303</span>  /**<a name="line.303"></a>
+<span class="sourceLineNo">304</span>   * Create a reader for the WAL. If you are reading from a file that's being written to and need<a name="line.304"></a>
+<span class="sourceLineNo">305</span>   * to reopen it multiple times, use {@link WAL.Reader#reset()} instead of this method<a name="line.305"></a>
+<span class="sourceLineNo">306</span>   * then just seek back to the last known good position.<a name="line.306"></a>
+<span class="sourceLineNo">307</span>   * @return A WAL reader.  Close when done with it.<a name="line.307"></a>
+<span class="sourceLineNo">308</span>   * @throws IOException<a name="line.308"></a>
+<span class="sourceLineNo">309</span>   */<a name="line.309"></a>
+<span class="sourceLineNo">310</span>  public Reader createReader(final FileSystem fs, final Path path,<a name="line.310"></a>
+<span class="sourceLineNo">311</span>      CancelableProgressable reporter) throws IOException {<a name="line.311"></a>
+<span class="sourceLineNo">312</span>    return createReader(fs, path, reporter, true);<a name="line.312"></a>
+<span class="sourceLineNo">313</span>  }<a name="line.313"></a>
+<span class="sourceLineNo">314</span><a name="line.314"></a>
+<span class="sourceLineNo">315</span>  public Reader createReader(final FileSystem fs, final Path path, CancelableProgressable reporter,<a name="line.315"></a>
+<span class="sourceLineNo">316</span>      boolean allowCustom) throws IOException {<a name="line.316"></a>
+<span class="sourceLineNo">317</span>    Class&lt;? extends AbstractFSWALProvider.Reader&gt; lrClass =<a name="line.317"></a>
+<span class="sourceLineNo">318</span>        allowCustom ? logReaderClass : ProtobufLogReader.class;<a name="line.318"></a>
+<span class="sourceLineNo">319</span>    try {<a name="line.319"></a>
+<span class="sourceLineNo">320</span>      // A wal file could be under recovery, so it may take several<a name="line.320"></a>
+<span class="sourceLineNo">321</span>      // tries to get it open. Instead of claiming it is corrupted, retry<a name="line.321"></a>
+<span class="sourceLineNo">322</span>      // to open it up to 5 minutes by default.<a name="line.322"></a>
+<span class="sourceLineNo">323</span>      long startWaiting = EnvironmentEdgeManager.currentTime();<a name="line.323"></a>
+<span class="sourceLineNo">324</span>      long openTimeout = timeoutMillis + startWaiting;<a name="line.324"></a>
+<span class="sourceLineNo">325</span>      int nbAttempt = 0;<a name="line.325"></a>
+<span class="sourceLineNo">326</span>      AbstractFSWALProvider.Reader reader = null;<a name="line.326"></a>
+<span class="sourceLineNo">327</span>      while (true) {<a name="line.327"></a>
+<span class="sourceLineNo">328</span>        try {<a name="line.328"></a>
+<span class="sourceLineNo">329</span>          reader = lrClass.getDeclaredConstructor().newInstance();<a name="line.329"></a>
+<span class="sourceLineNo">330</span>          reader.init(fs, path, conf, null);<a name="line.330"></a>
+<span class="sourceLineNo">331</span>          return reader;<a name="line.331"></a>
+<span class="sourceLineNo">332</span>        } catch (IOException e) {<a name="line.332"></a>
+<span class="sourceLineNo">333</span>          if (reader != null) {<a name="line.333"></a>
+<span class="sourceLineNo">334</span>            try {<a name="line.334"></a>
+<span class="sourceLineNo">335</span>              reader.close();<a name="line.335"></a>
+<span class="sourceLineNo">336</span>            } catch (IOException exception) {<a name="line.336"></a>
+<span class="sourceLineNo">337</span>              LOG.warn("Could not close FSDataInputStream" + exception.getMessage());<a name="line.337"></a>
+<span class="sourceLineNo">338</span>              LOG.debug("exception details", exception);<a name="line.338"></a>
 <span class="sourceLineNo">339</span>            }<a name="line.339"></a>
-<span class="sourceLineNo">340</span>            if (reporter != null &amp;&amp; !reporter.progress()) {<a name="line.340"></a>
-<span class="sourceLineNo">341</span>              throw new InterruptedIOException("Operation is cancelled");<a name="line.341"></a>
-<span class="sourceLineNo">342</span>            }<a name="line.342"></a>
-<span class="sourceLineNo">343</span>            if (nbAttempt &gt; 2 &amp;&amp; openTimeout &lt; EnvironmentEdgeManager.currentTime()) {<a name="line.343"></a>
-<span class="sourceLineNo">344</span>              LOG.error("Can't open after " + nbAttempt + " attempts and "<a name="line.344"></a>
-<span class="sourceLineNo">345</span>                  + (EnvironmentEdgeManager.currentTime() - startWaiting) + "ms " + " for " + path);<a name="line.345"></a>
-<span class="sourceLineNo">346</span>            } else {<a name="line.346"></a>
-<span class="sourceLineNo">347</span>              try {<a name="line.347"></a>
-<span class="sourceLineNo">348</span>                Thread.sleep(nbAttempt &lt; 3 ? 500 : 1000);<a name="line.348"></a>
-<span class="sourceLineNo">349</span>                continue; // retry<a name="line.349"></a>
-<span class="sourceLineNo">350</span>              } catch (InterruptedException ie) {<a name="line.350"></a>
-<span class="sourceLineNo">351</span>                InterruptedIOException iioe = new InterruptedIOException();<a name="line.351"></a>
-<span class="sourceLineNo">352</span>                iioe.initCause(ie);<a name="line.352"></a>
-<span class="sourceLineNo">353</span>                throw iioe;<a name="line.353"></a>
-<span class="sourceLineNo">354</span>              }<a name="line.354"></a>
-<span class="sourceLineNo">355</span>            }<a name="line.355"></a>
-<span class="sourceLineNo">356</span>            throw new LeaseNotRecoveredException(e);<a name="line.356"></a>
-<span class="sourceLineNo">357</span>          } else {<a name="line.357"></a>
-<span class="sourceLineNo">358</span>            throw e;<a name="line.358"></a>
-<span class="sourceLineNo">359</span>          }<a name="line.359"></a>
-<span class="sourceLineNo">360</span>        }<a name="line.360"></a>
-<span class="sourceLineNo">361</span>      }<a name="line.361"></a>
-<span class="sourceLineNo">362</span>    } catch (IOException ie) {<a name="line.362"></a>
-<span class="sourceLineNo">363</span>      throw ie;<a name="line.363"></a>
-<span class="sourceLineNo">364</span>    } catch (Exception e) {<a name="line.364"></a>
-<span class="sourceLineNo">365</span>      throw new IOException("Cannot get log reader", e);<a name="line.365"></a>
-<span class="sourceLineNo">366</span>    }<a name="line.366"></a>
-<span class="sourceLineNo">367</span>  }<a name="line.367"></a>
-<span class="sourceLineNo">368</span><a name="line.368"></a>
-<span class="sourceLineNo">369</span>  /**<a name="line.369"></a>
-<span class="sourceLineNo">370</span>   * Create a writer for the WAL.<a name="line.370"></a>
-<span class="sourceLineNo">371</span>   * Uses defaults.<a name="line.371"></a>
-<span class="sourceLineNo">372</span>   * &lt;p&gt;<a name="line.372"></a>
-<span class="sourceLineNo">373</span>   * Should be package-private. public only for tests and<a name="line.373"></a>
-<span class="sourceLineNo">374</span>   * {@link org.apache.hadoop.hbase.regionserver.wal.Compressor}<a name="line.374"></a>
-<span class="sourceLineNo">375</span>   * @return A WAL writer. Close when done with it.<a name="line.375"></a>
-<span class="sourceLineNo">376</span>   */<a name="line.376"></a>
-<span class="sourceLineNo">377</span>  public Writer createWALWriter(final FileSystem fs, final Path path) throws IOException {<a name="line.377"></a>
-<span class="sourceLineNo">378</span>    return FSHLogProvider.createWriter(conf, fs, path, false);<a name="line.378"></a>
-<span class="sourceLineNo">379</span>  }<a name="line.379"></a>
-<span class="sourceLineNo">380</span><a name="line.380"></a>
-<span class="sourceLineNo">381</span>  /**<a name="line.381"></a>
-<span class="sourceLineNo">382</span>   * Should be package-private, visible for recovery testing.<a name="line.382"></a>
-<span class="sourceLineNo">383</span>   * Uses defaults.<a name="line.383"></a>
-<span class="sourceLineNo">384</span>   * @return an overwritable writer for recovered edits. caller should close.<a name="line.384"></a>
-<span class="sourceLineNo">385</span>   */<a name="line.385"></a>
-<span class="sourceLineNo">386</span>  @VisibleForTesting<a name="line.386"></a>
-<span class="sourceLineNo">387</span>  public Writer createRecoveredEditsWriter(final FileSystem fs, final Path path)<a name="line.387"></a>
-<span class="sourceLineNo">388</span>      throws IOException {<a name="line.388"></a>
-<span class="sourceLineNo">389</span>    return FSHLogProvider.createWriter(conf, fs, path, true);<a name="line.389"></a>
-<span class="sourceLineNo">390</span>  }<a name="line.390"></a>
-<span class="sourceLineNo">391</span><a name="line.391"></a>
-<span class="sourceLineNo">392</span>  // These static methods are currently used where it's impractical to<a name="line.392"></a>
-<span class="sourceLineNo">393</span>  // untangle the reliance on state in the filesystem. They rely on singleton<a name="line.393"></a>
-<span class="sourceLineNo">394</span>  // WALFactory that just provides Reader / Writers.<a name="line.394"></a>
-<span class="sourceLineNo">395</span>  // For now, first Configuration object wins. Practically this just impacts the reader/writer class<a name="line.395"></a>
-<span class="sourceLineNo">396</span>  private static final AtomicReference&lt;WALFactory&gt; singleton = new AtomicReference&lt;&gt;();<a name="line.396"></a>
-<span class="sourceLineNo">397</span>  private static final String SINGLETON_ID = WALFactory.class.getName();<a name="line.397"></a>
-<span class="sourceLineNo">398</span>  <a name="line.398"></a>
-<span class="sourceLineNo">399</span>  // Public only for FSHLog<a name="line.399"></a>
-<span class="sourceLineNo">400</span>  public static WALFactory getInstance(Configuration configuration) {<a name="line.400"></a>
-<span class="sourceLineNo">401</span>    WALFactory factory = singleton.get();<a name="line.401"></a>
-<span class="sourceLineNo">402</span>    if (null == factory) {<a name="line.402"></a>
-<span class="sourceLineNo">403</span>      WALFactory temp = new WALFactory(configuration);<a name="line.403"></a>
-<span class="sourceLineNo">404</span>      if (singleton.compareAndSet(null, temp)) {<a name="line.404"></a>
-<span class="sourceLineNo">405</span>        factory = temp;<a name="line.405"></a>
-<span class="sourceLineNo">406</span>      } else {<a name="line.406"></a>
-<span class="sourceLineNo">407</span>        // someone else beat us to initializing<a name="line.407"></a>
-<span class="sourceLineNo">408</span>        try {<a name="line.408"></a>
-<span class="sourceLineNo">409</span>          temp.close();<a name="line.409"></a>
-<span class="sourceLineNo">410</span>        } catch (IOException exception) {<a name="line.410"></a>
-<span class="sourceLineNo">411</span>          LOG.debug("failed to close temporary singleton. ignoring.", exception);<a name="line.411"></a>
-<span class="sourceLineNo">412</span>        }<a name="line.412"></a>
-<span class="sourceLineNo">413</span>        factory = singleton.get();<a name="line.413"></a>
-<span class="sourceLineNo">414</span>      }<a name="line.414"></a>
-<span class="sourceLineNo">415</span>    }<a name="line.415"></a>
-<span class="sourceLineNo">416</span>    return factory;<a name="line.416"></a>
-<span class="sourceLineNo">417</span>  }<a name="line.417"></a>
-<span class="sourceLineNo">418</span><a name="line.418"></a>
-<span class="sourceLineNo">419</span>  /**<a name="line.419"></a>
-<span class="sourceLineNo">420</span>   * Create a reader for the given path, accept custom reader classes from conf.<a name="line.420"></a>
-<span class="sourceLineNo">421</span>   * If you already have a WALFactory, you should favor the instance method.<a name="line.421"></a>
-<span class="sourceLineNo">422</span>   * @return a WAL Reader, caller must close.<a name="line.422"></a>
-<span class="sourceLineNo">423</span>   */<a name="line.423"></a>
-<span class="sourceLineNo">424</span>  public static Reader createReader(final FileSystem fs, final Path path,<a name="line.424"></a>
-<span class="sourceLineNo">425</span>      final Configuration configuration) throws IOException {<a name="line.425"></a>
-<span class="sourceLineNo">426</span>    return getInstance(configuration).createReader(fs, path);<a name="line.426"></a>
+<span class="sourceLineNo">340</span>          }<a name="line.340"></a>
+<span class="sourceLineNo">341</span><a name="line.341"></a>
+<span class="sourceLineNo">342</span>          String msg = e.getMessage();<a name="line.342"></a>
+<span class="sourceLineNo">343</span>          if (msg != null<a name="line.343"></a>
+<span class="sourceLineNo">344</span>              &amp;&amp; (msg.contains("Cannot obtain block length")<a name="line.344"></a>
+<span class="sourceLineNo">345</span>                  || msg.contains("Could not obtain the last block") || msg<a name="line.345"></a>
+<span class="sourceLineNo">346</span>                    .matches("Blocklist for [^ ]* has changed.*"))) {<a name="line.346"></a>
+<span class="sourceLineNo">347</span>            if (++nbAttempt == 1) {<a name="line.347"></a>
+<span class="sourceLineNo">348</span>              LOG.warn("Lease should have recovered. This is not expected. Will retry", e);<a name="line.348"></a>
+<span class="sourceLineNo">349</span>            }<a name="line.349"></a>
+<span class="sourceLineNo">350</span>            if (reporter != null &amp;&amp; !reporter.progress()) {<a name="line.350"></a>
+<span class="sourceLineNo">351</span>              throw new InterruptedIOException("Operation is cancelled");<a name="line.351"></a>
+<span class="sourceLineNo">352</span>            }<a name="line.352"></a>
+<span class="sourceLineNo">353</span>            if (nbAttempt &gt; 2 &amp;&amp; openTimeout &lt; EnvironmentEdgeManager.currentTime()) {<a name="line.353"></a>
+<span class="sourceLineNo">354</span>              LOG.error("Can't open after " + nbAttempt + " attempts and "<a name="line.354"></a>
+<span class="sourceLineNo">355</span>                  + (EnvironmentEdgeManager.currentTime() - startWaiting) + "ms " + " for " + path);<a name="line.355"></a>
+<span class="sourceLineNo">356</span>            } else {<a name="line.356"></a>
+<span class="sourceLineNo">357</span>              try {<a name="line.357"></a>
+<span class="sourceLineNo">358</span>                Thread.sleep(nbAttempt &lt; 3 ? 500 : 1000);<a name="line.358"></a>
+<span class="sourceLineNo">359</span>                continue; // retry<a name="line.359"></a>
+<span class="sourceLineNo">360</span>              } catch (InterruptedException ie) {<a name="line.360"></a>
+<span class="sourceLineNo">361</span>                InterruptedIOException iioe = new InterruptedIOException();<a name="line.361"></a>
+<span class="sourceLineNo">362</span>                iioe.initCause(ie);<a name="line.362"></a>
+<span class="sourceLineNo">363</span>                throw iioe;<a name="line.363"></a>
+<span class="sourceLineNo">364</span>              }<a name="line.364"></a>
+<span class="sourceLineNo">365</span>            }<a name="line.365"></a>
+<span class="sourceLineNo">366</span>            throw new LeaseNotRecoveredException(e);<a name="line.366"></a>
+<span class="sourceLineNo">367</span>          } else {<a name="line.367"></a>
+<span class="sourceLineNo">368</span>            throw e;<a name="line.368"></a>
+<span class="sourceLineNo">369</span>          }<a name="line.369"></a>
+<span class="sourceLineNo">370</span>        }<a name="line.370"></a>
+<span class="sourceLineNo">371</span>      }<a name="line.371"></a>
+<span class="sourceLineNo">372</span>    } catch (IOException ie) {<a name="line.372"></a>
+<span class="sourceLineNo">373</span>      throw ie;<a name="line.373"></a>
+<span class="sourceLineNo">374</span>    } catch (Exception e) {<a name="line.374"></a>
+<span class="sourceLineNo">375</span>      throw new IOException("Cannot get log reader", e);<a name="line.375"></a>
+<span class="sourceLineNo">376</span>    }<a name="line.376"></a>
+<span class="sourceLineNo">377</span>  }<a name="line.377"></a>
+<span class="sourceLineNo">378</span><a name="line.378"></a>
+<span class="sourceLineNo">379</span>  /**<a name="line.379"></a>
+<span class="sourceLineNo">380</span>   * Create a writer for the WAL.<a name="line.380"></a>
+<span class="sourceLineNo">381</span>   * Uses defaults.<a name="line.381"></a>
+<span class="sourceLineNo">382</span>   * &lt;p&gt;<a name="line.382"></a>
+<span class="sourceLineNo">383</span>   * Should be package-private. public only for tests and<a name="line.383"></a>
+<span class="sourceLineNo">384</span>   * {@link org.apache.hadoop.hbase.regionserver.wal.Compressor}<a name="line.384"></a>
+<span class="sourceLineNo">385</span>   * @return A WAL writer. Close when done with it.<a name="line.385"></a>
+<span class="sourceLineNo">386</span>   */<a name="line.386"></a>
+<span class="sourceLineNo">387</span>  public Writer createWALWriter(final FileSystem fs, final Path path) throws IOException {<a name="line.387"></a>
+<span class="sourceLineNo">388</span>    return FSHLogProvider.createWriter(conf, fs, path, false);<a name="line.388"></a>
+<span class="sourceLineNo">389</span>  }<a name="line.389"></a>
+<span class="sourceLineNo">390</span><a name="line.390"></a>
+<span class="sourceLineNo">391</span>  /**<a name="line.391"></a>
+<span class="sourceLineNo">392</span>   * Should be package-private, visible for recovery testing.<a name="line.392"></a>
+<span class="sourceLineNo">393</span>   * Uses defaults.<a name="line.393"></a>
+<span class="sourceLineNo">394</span>   * @return an overwritable writer for recovered edits. caller should close.<a name="line.394"></a>
+<span class="sourceLineNo">395</span>   */<a name="line.395"></a>
+<span class="sourceLineNo">396</span>  @VisibleForTesting<a name="line.396"></a>
+<span class="sourceLineNo">397</span>  public Writer createRecoveredEditsWriter(final FileSystem fs, final Path path)<a name="line.397"></a>
+<span class="sourceLineNo">398</span>      throws IOException {<a name="line.398"></a>
+<span class="sourceLineNo">399</span>    return FSHLogProvider.createWriter(conf, fs, path, true);<a name="line.399"></a>
+<span class="sourceLineNo">400</span>  }<a name="line.400"></a>
+<span class="sourceLineNo">401</span><a name="line.401"></a>
+<span class="sourceLineNo">402</span>  // These static methods are currently used where it's impractical to<a name="line.402"></a>
+<span class="sourceLineNo">403</span>  // untangle the reliance on state in the filesystem. They rely on singleton<a name="line.403"></a>
+<span class="sourceLineNo">404</span>  // WALFactory that just provides Reader / Writers.<a name="line.404"></a>
+<span class="sourceLineNo">405</span>  // For now, first Configuration object wins. Practically this just impacts the reader/writer class<a name="line.405"></a>
+<span class="sourceLineNo">406</span>  private static final AtomicReference&lt;WALFactory&gt; singleton = new AtomicReference&lt;&gt;();<a name="line.406"></a>
+<span class="sourceLineNo">407</span>  private static final String SINGLETON_ID = WALFactory.class.getName();<a name="line.407"></a>
+<span class="sourceLineNo">408</span>  <a name="line.408"></a>
+<span class="sourceLineNo">409</span>  // Public only for FSHLog<a name="line.409"></a>
+<span class="sourceLineNo">410</span>  public static WALFactory getInstance(Configuration configuration) {<a name="line.410"></a>
+<span class="sourceLineNo">411</span>    WALFactory factory = singleton.get();<a name="line.411"></a>
+<span class="sourceLineNo">412</span>    if (null == factory) {<a name="line.412"></a>
+<span class="sourceLineNo">413</span>      WALFactory temp = new WALFactory(configuration);<a name="line.413"></a>
+<span class="sourceLineNo">414</span>      if (singleton.compareAndSet(null, temp)) {<a name="line.414"></a>
+<span class="sourceLineNo">415</span>        factory = temp;<a name="line.415"></a>
+<span class="sourceLineNo">416</span>      } else {<a name="line.416"></a>
+<span class="sourceLineNo">417</span>        // someone else beat us to initializing<a name="line.417"></a>
+<span class="sourceLineNo">418</span>        try {<a name="line.418"></a>
+<span class="sourceLineNo">419</span>          temp.close();<a name="line.419"></a>
+<span class="sourceLineNo">420</span>        } catch (IOException exception) {<a name="line.420"></a>
+<span class="sourceLineNo">421</span>          LOG.debug("failed to close temporary singleton. ignoring.", exception);<a name="line.421"></a>
+<span class="sourceLineNo">422</span>        }<a name="line.422"></a>
+<span class="sourceLineNo">423</span>        factory = singleton.get();<a name="line.423"></a>
+<span class="sourceLineNo">424</span>      }<a name="line.424"></a>
+<span class="sourceLineNo">425</span>    }<a name="line.425"></a>
+<span class="sourceLineNo">426</span>    return factory;<a name="line.426"></a>
 <span class="sourceLineNo">427</span>  }<a name="line.427"></a>
 <span class="sourceLineNo">428</span><a name="line.428"></a>
 <span class="sourceLineNo">429</span>  /**<a name="line.429"></a>
@@ -439,53 +439,63 @@
 <span class="sourceLineNo">431</span>   * If you already have a WALFactory, you should favor the instance method.<a name="line.431"></a>
 <span class="sourceLineNo">432</span>   * @return a WAL Reader, caller must close.<a name="line.432"></a>
 <span class="sourceLineNo">433</span>   */<a name="line.433"></a>
-<span class="sourceLineNo">434</span>  static Reader createReader(final FileSystem fs, final Path path,<a name="line.434"></a>
-<span class="sourceLineNo">435</span>      final Configuration configuration, final CancelableProgressable reporter) throws IOException {<a name="line.435"></a>
-<span class="sourceLineNo">436</span>    return getInstance(configuration).createReader(fs, path, reporter);<a name="line.436"></a>
+<span class="sourceLineNo">434</span>  public static Reader createReader(final FileSystem fs, final Path path,<a name="line.434"></a>
+<span class="sourceLineNo">435</span>      final Configuration configuration) throws IOException {<a name="line.435"></a>
+<span class="sourceLineNo">436</span>    return getInstance(configuration).createReader(fs, path);<a name="line.436"></a>
 <span class="sourceLineNo">437</span>  }<a name="line.437"></a>
 <span class="sourceLineNo">438</span><a name="line.438"></a>
 <span class="sourceLineNo">439</span>  /**<a name="line.439"></a>
-<span class="sourceLineNo">440</span>   * Create a reader for the given path, ignore custom reader classes from conf.<a name="line.440"></a>
+<span class="sourceLineNo">440</span>   * Create a reader for the given path, accept custom reader classes from conf.<a name="line.440"></a>
 <span class="sourceLineNo">441</span>   * If you already have a WALFactory, you should favor the instance method.<a name="line.441"></a>
-<span class="sourceLineNo">442</span>   * only public pending move of {@link org.apache.hadoop.hbase.regionserver.wal.Compressor}<a name="line.442"></a>
-<span class="sourceLineNo">443</span>   * @return a WAL Reader, caller must close.<a name="line.443"></a>
-<span class="sourceLineNo">444</span>   */<a name="line.444"></a>
-<span class="sourceLineNo">445</span>  public static Reader createReaderIgnoreCustomClass(final FileSystem fs, final Path path,<a name="line.445"></a>
-<span class="sourceLineNo">446</span>      final Configuration configuration) throws IOException {<a name="line.446"></a>
-<span class="sourceLineNo">447</span>    return getInstance(configuration).createReader(fs, path, null, false);<a name="line.447"></a>
-<span class="sourceLineNo">448</span>  }<a name="line.448"></a>
-<span class="sourceLineNo">449</span><a name="line.449"></a>
-<span class="sourceLineNo">450</span>  /**<a name="line.450"></a>
+<span class="sourceLineNo">442</span>   * @return a WAL Reader, caller must close.<a name="line.442"></a>
+<span class="sourceLineNo">443</span>   */<a name="line.443"></a>
+<span class="sourceLineNo">444</span>  static Reader createReader(final FileSystem fs, final Path path,<a name="line.444"></a>
+<span class="sourceLineNo">445</span>      final Configuration configuration, final CancelableProgressable reporter) throws IOException {<a name="line.445"></a>
+<span class="sourceLineNo">446</span>    return getInstance(configuration).createReader(fs, path, reporter);<a name="line.446"></a>
+<span class="sourceLineNo">447</span>  }<a name="line.447"></a>
+<span class="sourceLineNo">448</span><a name="line.448"></a>
+<span class="sourceLineNo">449</span>  /**<a name="line.449"></a>
+<span class="sourceLineNo">450</span>   * Create a reader for the given path, ignore custom reader classes from conf.<a name="line.450"></a>
 <span class="sourceLineNo">451</span>   * If you already have a WALFactory, you should favor the instance method.<a name="line.451"></a>
-<span class="sourceLineNo">452</span>   * Uses defaults.<a name="line.452"></a>
-<span class="sourceLineNo">453</span>   * @return a Writer that will overwrite files. Caller must close.<a name="line.453"></a>
+<span class="sourceLineNo">452</span>   * only public pending move of {@link org.apache.hadoop.hbase.regionserver.wal.Compressor}<a name="line.452"></a>
+<span class="sourceLineNo">453</span>   * @return a WAL Reader, caller must close.<a name="line.453"></a>
 <span class="sourceLineNo">454</span>   */<a name="line.454"></a>
-<span class="sourceLineNo">455</span>  static Writer createRecoveredEditsWriter(final FileSystem fs, final Path path,<a name="line.455"></a>
-<span class="sourceLineNo">456</span>      final Configuration configuration)<a name="line.456"></a>
-<span class="sourceLineNo">457</span>      throws IOException {<a name="line.457"></a>
-<span class="sourceLineNo">458</span>    return FSHLogProvider.createWriter(configuration, fs, path, true);<a name="line.458"></a>
-<span class="sourceLineNo">459</span>  }<a name="line.459"></a>
-<span class="sourceLineNo">460</span><a name="line.460"></a>
-<span class="sourceLineNo">461</span>  /**<a name="line.461"></a>
-<span class="sourceLineNo">462</span>   * If you already have a WALFactory, you should favor the instance method.<a name="line.462"></a>
-<span class="sourceLineNo">463</span>   * Uses defaults.<a name="line.463"></a>
-<span class="sourceLineNo">464</span>   * @return a writer that won't overwrite files. Caller must close.<a name="line.464"></a>
-<span class="sourceLineNo">465</span>   */<a name="line.465"></a>
-<span class="sourceLineNo">466</span>  @VisibleForTesting<a name="line.466"></a>
-<span class="sourceLineNo">467</span>  public static Writer createWALWriter(final FileSystem fs, final Path path,<a name="line.467"></a>
-<span class="sourceLineNo">468</span>      final Configuration configuration)<a name="line.468"></a>
-<span class="sourceLineNo">469</span>      throws IOException {<a name="line.469"></a>
-<span class="sourceLineNo">470</span>    return FSHLogProvider.createWriter(configuration, fs, path, false);<a name="line.470"></a>
-<span class="sourceLineNo">471</span>  }<a name="line.471"></a>
-<span class="sourceLineNo">472</span><a name="line.472"></a>
-<span class="sourceLineNo">473</span>  public final WALProvider getWALProvider() {<a name="line.473"></a>
-<span class="sourceLineNo">474</span>    return this.provider;<a name="line.474"></a>
-<span class="sourceLineNo">475</span>  }<a name="line.475"></a>
-<span class="sourceLineNo">476</span><a name="line.476"></a>
-<span class="sourceLineNo">477</span>  public final WALProvider getMetaWALProvider() {<a name="line.477"></a>
-<span class="sourceLineNo">478</span>    return this.metaProvider.get();<a name="line.478"></a>
-<span class="sourceLineNo">479</span>  }<a name="line.479"></a>
-<span class="sourceLineNo">480</span>}<a name="line.480"></a>
+<span class="sourceLineNo">455</span>  public static Reader createReaderIgnoreCustomClass(final FileSystem fs, final Path path,<a name="line.455"></a>
+<span class="sourceLineNo">456</span>      final Configuration configuration) throws IOException {<a name="line.456"></a>
+<span class="sourceLineNo">457</span>    return getInstance(configuration).createReader(fs, path, null, false);<a name="line.457"></a>
+<span class="sourceLineNo">458</span>  }<a name="line.458"></a>
+<span class="sourceLineNo">459</span><a name="line.459"></a>
+<span class="sourceLineNo">460</span>  /**<a name="line.460"></a>
+<span class="sourceLineNo">461</span>   * If you already have a WALFactory, you should favor the instance method.<a name="line.461"></a>
+<span class="sourceLineNo">462</span>   * Uses defaults.<a name="line.462"></a>
+<span class="sourceLineNo">463</span>   * @return a Writer that will overwrite files. Caller must close.<a name="line.463"></a>
+<span class="sourceLineNo">464</span>   */<a name="line.464"></a>
+<span class="sourceLineNo">465</span>  static Writer createRecoveredEditsWriter(final FileSystem fs, final Path path,<a name="line.465"></a>
+<span class="sourceLineNo">466</span>      final Configuration configuration)<a name="line.466"></a>
+<span class="sourceLineNo">467</span>      throws IOException {<a name="line.467"></a>
+<span class="sourceLineNo">468</span>    return FSHLogProvider.createWriter(configuration, fs, path, true);<a name="line.468"></a>
+<span class="sourceLineNo">469</span>  }<a name="line.469"></a>
+<span class="sourceLineNo">470</span><a name="line.470"></a>
+<span class="sourceLineNo">471</span>  /**<a name="line.471"></a>
+<span class="sourceLineNo">472</span>   * If you already have a WALFactory, you should favor the instance method.<a name="line.472"></a>
+<span class="sourceLineNo">473</span>   * Uses defaults.<a name="line.473"></a>
+<span class="sourceLineNo">474</span>   * @return a writer that won't overwrite files. Caller must close.<a name="line.474"></a>
+<span class="sourceLineNo">475</span>   */<a name="line.475"></a>
+<span class="sourceLineNo">476</span>  @VisibleForTesting<a name="line.476"></a>
+<span class="sourceLineNo">477</span>  public static Writer createWALWriter(final FileSystem fs, final Path path,<a name="line.477"></a>
+<span class="sourceLineNo">478</span>      final Configuration configuration)<a name="line.478"></a>
+<span class="sourceLineNo">479</span>      throws IOException {<a name="line.479"></a>
+<span class="sourceLineNo">480</span>    return FSHLogProvider.createWriter(configuration, fs, path, false);<a name="line.480"></a>
+<span class="sourceLineNo">481</span>  }<a name="line.481"></a>
+<span class="sourceLineNo">482</span><a name="line.482"></a>
+<span class="sourceLineNo">483</span>  public final WALProvider getWALProvider() {<a name="line.483"></a>
+<span class="sourceLineNo">484</span>    return this.provider;<a name="line.484"></a>
+<span class="sourceLineNo">485</span>  }<a name="line.485"></a>
+<span class="sourceLineNo">486</span><a name="line.486"></a>
+<span class="sourceLineNo">487</span>  public final WALProvider getMetaWALProvider() {<a name="line.487"></a>
+<span class="sourceLineNo">488</span>    return this.metaProvider.get();<a name="line.488"></a>
+<span class="sourceLineNo">489</span>  }<a name="line.489"></a>
+<span class="sourceLineNo">490</span>}<a name="line.490"></a>
 
 
 

http://git-wip-us.apache.org/repos/asf/hbase-site/blob/bd4d10ee/devapidocs/src-html/org/apache/hadoop/hbase/wal/WALFactory.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/wal/WALFactory.html b/devapidocs/src-html/org/apache/hadoop/hbase/wal/WALFactory.html
index 92967f2..a20bd89 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/wal/WALFactory.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/wal/WALFactory.html
@@ -268,170 +268,170 @@
 <span class="sourceLineNo">260</span>      if (provider != null) {<a name="line.260"></a>
 <span class="sourceLineNo">261</span>        return provider;<a name="line.261"></a>
 <span class="sourceLineNo">262</span>      }<a name="line.262"></a>
-<span class="sourceLineNo">263</span>      provider = createProvider(getProviderClass(META_WAL_PROVIDER,<a name="line.263"></a>
-<span class="sourceLineNo">264</span>          conf.get(WAL_PROVIDER, DEFAULT_WAL_PROVIDER)));<a name="line.264"></a>
-<span class="sourceLineNo">265</span>      provider.init(this, conf, AbstractFSWALProvider.META_WAL_PROVIDER_ID);<a name="line.265"></a>
-<span class="sourceLineNo">266</span>      provider.addWALActionsListener(new MetricsWAL());<a name="line.266"></a>
-<span class="sourceLineNo">267</span>      if (metaProvider.compareAndSet(null, provider)) {<a name="line.267"></a>
-<span class="sourceLineNo">268</span>        return provider;<a name="line.268"></a>
-<span class="sourceLineNo">269</span>      } else {<a name="line.269"></a>
-<span class="sourceLineNo">270</span>        // someone is ahead of us, close and try again.<a name="line.270"></a>
-<span class="sourceLineNo">271</span>        provider.close();<a name="line.271"></a>
-<span class="sourceLineNo">272</span>      }<a name="line.272"></a>
-<span class="sourceLineNo">273</span>    }<a name="line.273"></a>
-<span class="sourceLineNo">274</span>  }<a name="line.274"></a>
-<span class="sourceLineNo">275</span><a name="line.275"></a>
-<span class="sourceLineNo">276</span>  /**<a name="line.276"></a>
-<span class="sourceLineNo">277</span>   * @param region the region which we want to get a WAL for it. Could be null.<a name="line.277"></a>
-<span class="sourceLineNo">278</span>   */<a name="line.278"></a>
-<span class="sourceLineNo">279</span>  public WAL getWAL(RegionInfo region) throws IOException {<a name="line.279"></a>
-<span class="sourceLineNo">280</span>    // use different WAL for hbase:meta<a name="line.280"></a>
-<span class="sourceLineNo">281</span>    if (region != null &amp;&amp; region.isMetaRegion() &amp;&amp;<a name="line.281"></a>
-<span class="sourceLineNo">282</span>      region.getReplicaId() == RegionInfo.DEFAULT_REPLICA_ID) {<a name="line.282"></a>
-<span class="sourceLineNo">283</span>      return getMetaProvider().getWAL(region);<a name="line.283"></a>
-<span class="sourceLineNo">284</span>    } else {<a name="line.284"></a>
-<span class="sourceLineNo">285</span>      return provider.getWAL(region);<a name="line.285"></a>
-<span class="sourceLineNo">286</span>    }<a name="line.286"></a>
-<span class="sourceLineNo">287</span>  }<a name="line.287"></a>
-<span class="sourceLineNo">288</span><a name="line.288"></a>
-<span class="sourceLineNo">289</span>  public Reader createReader(final FileSystem fs, final Path path) throws IOException {<a name="line.289"></a>
-<span class="sourceLineNo">290</span>    return createReader(fs, path, (CancelableProgressable)null);<a name="line.290"></a>
-<span class="sourceLineNo">291</span>  }<a name="line.291"></a>
-<span class="sourceLineNo">292</span><a name="line.292"></a>
-<span class="sourceLineNo">293</span>  /**<a name="line.293"></a>
-<span class="sourceLineNo">294</span>   * Create a reader for the WAL. If you are reading from a file that's being written to and need<a name="line.294"></a>
-<span class="sourceLineNo">295</span>   * to reopen it multiple times, use {@link WAL.Reader#reset()} instead of this method<a name="line.295"></a>
-<span class="sourceLineNo">296</span>   * then just seek back to the last known good position.<a name="line.296"></a>
-<span class="sourceLineNo">297</span>   * @return A WAL reader.  Close when done with it.<a name="line.297"></a>
-<span class="sourceLineNo">298</span>   * @throws IOException<a name="line.298"></a>
-<span class="sourceLineNo">299</span>   */<a name="line.299"></a>
-<span class="sourceLineNo">300</span>  public Reader createReader(final FileSystem fs, final Path path,<a name="line.300"></a>
-<span class="sourceLineNo">301</span>      CancelableProgressable reporter) throws IOException {<a name="line.301"></a>
-<span class="sourceLineNo">302</span>    return createReader(fs, path, reporter, true);<a name="line.302"></a>
-<span class="sourceLineNo">303</span>  }<a name="line.303"></a>
-<span class="sourceLineNo">304</span><a name="line.304"></a>
-<span class="sourceLineNo">305</span>  public Reader createReader(final FileSystem fs, final Path path, CancelableProgressable reporter,<a name="line.305"></a>
-<span class="sourceLineNo">306</span>      boolean allowCustom) throws IOException {<a name="line.306"></a>
-<span class="sourceLineNo">307</span>    Class&lt;? extends AbstractFSWALProvider.Reader&gt; lrClass =<a name="line.307"></a>
-<span class="sourceLineNo">308</span>        allowCustom ? logReaderClass : ProtobufLogReader.class;<a name="line.308"></a>
-<span class="sourceLineNo">309</span>    try {<a name="line.309"></a>
-<span class="sourceLineNo">310</span>      // A wal file could be under recovery, so it may take several<a name="line.310"></a>
-<span class="sourceLineNo">311</span>      // tries to get it open. Instead of claiming it is corrupted, retry<a name="line.311"></a>
-<span class="sourceLineNo">312</span>      // to open it up to 5 minutes by default.<a name="line.312"></a>
-<span class="sourceLineNo">313</span>      long startWaiting = EnvironmentEdgeManager.currentTime();<a name="line.313"></a>
-<span class="sourceLineNo">314</span>      long openTimeout = timeoutMillis + startWaiting;<a name="line.314"></a>
-<span class="sourceLineNo">315</span>      int nbAttempt = 0;<a name="line.315"></a>
-<span class="sourceLineNo">316</span>      AbstractFSWALProvider.Reader reader = null;<a name="line.316"></a>
-<span class="sourceLineNo">317</span>      while (true) {<a name="line.317"></a>
-<span class="sourceLineNo">318</span>        try {<a name="line.318"></a>
-<span class="sourceLineNo">319</span>          reader = lrClass.getDeclaredConstructor().newInstance();<a name="line.319"></a>
-<span class="sourceLineNo">320</span>          reader.init(fs, path, conf, null);<a name="line.320"></a>
-<span class="sourceLineNo">321</span>          return reader;<a name="line.321"></a>
-<span class="sourceLineNo">322</span>        } catch (IOException e) {<a name="line.322"></a>
-<span class="sourceLineNo">323</span>          if (reader != null) {<a name="line.323"></a>
-<span class="sourceLineNo">324</span>            try {<a name="line.324"></a>
-<span class="sourceLineNo">325</span>              reader.close();<a name="line.325"></a>
-<span class="sourceLineNo">326</span>            } catch (IOException exception) {<a name="line.326"></a>
-<span class="sourceLineNo">327</span>              LOG.warn("Could not close FSDataInputStream" + exception.getMessage());<a name="line.327"></a>
-<span class="sourceLineNo">328</span>              LOG.debug("exception details", exception);<a name="line.328"></a>
-<span class="sourceLineNo">329</span>            }<a name="line.329"></a>
-<span class="sourceLineNo">330</span>          }<a name="line.330"></a>
-<span class="sourceLineNo">331</span><a name="line.331"></a>
-<span class="sourceLineNo">332</span>          String msg = e.getMessage();<a name="line.332"></a>
-<span class="sourceLineNo">333</span>          if (msg != null<a name="line.333"></a>
-<span class="sourceLineNo">334</span>              &amp;&amp; (msg.contains("Cannot obtain block length")<a name="line.334"></a>
-<span class="sourceLineNo">335</span>                  || msg.contains("Could not obtain the last block") || msg<a name="line.335"></a>
-<span class="sourceLineNo">336</span>                    .matches("Blocklist for [^ ]* has changed.*"))) {<a name="line.336"></a>
-<span class="sourceLineNo">337</span>            if (++nbAttempt == 1) {<a name="line.337"></a>
-<span class="sourceLineNo">338</span>              LOG.warn("Lease should have recovered. This is not expected. Will retry", e);<a name="line.338"></a>
+<span class="sourceLineNo">263</span>      Class&lt;? extends WALProvider&gt; clz = null;<a name="line.263"></a>
+<span class="sourceLineNo">264</span>      if (conf.get(META_WAL_PROVIDER) == null) {<a name="line.264"></a>
+<span class="sourceLineNo">265</span>        try {<a name="line.265"></a>
+<span class="sourceLineNo">266</span>          clz = conf.getClass(WAL_PROVIDER, Providers.defaultProvider.clazz, WALProvider.class);<a name="line.266"></a>
+<span class="sourceLineNo">267</span>        } catch (Throwable t) {<a name="line.267"></a>
+<span class="sourceLineNo">268</span>          // the WAL provider should be an enum. Proceed<a name="line.268"></a>
+<span class="sourceLineNo">269</span>        }<a name="line.269"></a>
+<span class="sourceLineNo">270</span>      } <a name="line.270"></a>
+<span class="sourceLineNo">271</span>      if (clz == null){<a name="line.271"></a>
+<span class="sourceLineNo">272</span>        clz = getProviderClass(META_WAL_PROVIDER, conf.get(WAL_PROVIDER, DEFAULT_WAL_PROVIDER));<a name="line.272"></a>
+<span class="sourceLineNo">273</span>      }<a name="line.273"></a>
+<span class="sourceLineNo">274</span>      provider = createProvider(clz);<a name="line.274"></a>
+<span class="sourceLineNo">275</span>      provider.init(this, conf, AbstractFSWALProvider.META_WAL_PROVIDER_ID);<a name="line.275"></a>
+<span class="sourceLineNo">276</span>      provider.addWALActionsListener(new MetricsWAL());<a name="line.276"></a>
+<span class="sourceLineNo">277</span>      if (metaProvider.compareAndSet(null, provider)) {<a name="line.277"></a>
+<span class="sourceLineNo">278</span>        return provider;<a name="line.278"></a>
+<span class="sourceLineNo">279</span>      } else {<a name="line.279"></a>
+<span class="sourceLineNo">280</span>        // someone is ahead of us, close and try again.<a name="line.280"></a>
+<span class="sourceLineNo">281</span>        provider.close();<a name="line.281"></a>
+<span class="sourceLineNo">282</span>      }<a name="line.282"></a>
+<span class="sourceLineNo">283</span>    }<a name="line.283"></a>
+<span class="sourceLineNo">284</span>  }<a name="line.284"></a>
+<span class="sourceLineNo">285</span><a name="line.285"></a>
+<span class="sourceLineNo">286</span>  /**<a name="line.286"></a>
+<span class="sourceLineNo">287</span>   * @param region the region which we want to get a WAL for it. Could be null.<a name="line.287"></a>
+<span class="sourceLineNo">288</span>   */<a name="line.288"></a>
+<span class="sourceLineNo">289</span>  public WAL getWAL(RegionInfo region) throws IOException {<a name="line.289"></a>
+<span class="sourceLineNo">290</span>    // use different WAL for hbase:meta<a name="line.290"></a>
+<span class="sourceLineNo">291</span>    if (region != null &amp;&amp; region.isMetaRegion() &amp;&amp;<a name="line.291"></a>
+<span class="sourceLineNo">292</span>      region.getReplicaId() == RegionInfo.DEFAULT_REPLICA_ID) {<a name="line.292"></a>
+<span class="sourceLineNo">293</span>      return getMetaProvider().getWAL(region);<a name="line.293"></a>
+<span class="sourceLineNo">294</span>    } else {<a name="line.294"></a>
+<span class="sourceLineNo">295</span>      return provider.getWAL(region);<a name="line.295"></a>
+<span class="sourceLineNo">296</span>    }<a name="line.296"></a>
+<span class="sourceLineNo">297</span>  }<a name="line.297"></a>
+<span class="sourceLineNo">298</span><a name="line.298"></a>
+<span class="sourceLineNo">299</span>  public Reader createReader(final FileSystem fs, final Path path) throws IOException {<a name="line.299"></a>
+<span class="sourceLineNo">300</span>    return createReader(fs, path, (CancelableProgressable)null);<a name="line.300"></a>
+<span class="sourceLineNo">301</span>  }<a name="line.301"></a>
+<span class="sourceLineNo">302</span><a name="line.302"></a>
+<span class="sourceLineNo">303</span>  /**<a name="line.303"></a>
+<span class="sourceLineNo">304</span>   * Create a reader for the WAL. If you are reading from a file that's being written to and need<a name="line.304"></a>
+<span class="sourceLineNo">305</span>   * to reopen it multiple times, use {@link WAL.Reader#reset()} instead of this method<a name="line.305"></a>
+<span class="sourceLineNo">306</span>   * then just seek back to the last known good position.<a name="line.306"></a>
+<span class="sourceLineNo">307</span>   * @return A WAL reader.  Close when done with it.<a name="line.307"></a>
+<span class="sourceLineNo">308</span>   * @throws IOException<a name="line.308"></a>
+<span class="sourceLineNo">309</span>   */<a name="line.309"></a>
+<span class="sourceLineNo">310</span>  public Reader createReader(final FileSystem fs, final Path path,<a name="line.310"></a>
+<span class="sourceLineNo">311</span>      CancelableProgressable reporter) throws IOException {<a name="line.311"></a>
+<span class="sourceLineNo">312</span>    return createReader(fs, path, reporter, true);<a name="line.312"></a>
+<span class="sourceLineNo">313</span>  }<a name="line.313"></a>
+<span class="sourceLineNo">314</span><a name="line.314"></a>
+<span class="sourceLineNo">315</span>  public Reader createReader(final FileSystem fs, final Path path, CancelableProgressable reporter,<a name="line.315"></a>
+<span class="sourceLineNo">316</span>      boolean allowCustom) throws IOException {<a name="line.316"></a>
+<span class="sourceLineNo">317</span>    Class&lt;? extends AbstractFSWALProvider.Reader&gt; lrClass =<a name="line.317"></a>
+<span class="sourceLineNo">318</span>        allowCustom ? logReaderClass : ProtobufLogReader.class;<a name="line.318"></a>
+<span class="sourceLineNo">319</span>    try {<a name="line.319"></a>
+<span class="sourceLineNo">320</span>      // A wal file could be under recovery, so it may take several<a name="line.320"></a>
+<span class="sourceLineNo">321</span>      // tries to get it open. Instead of claiming it is corrupted, retry<a name="line.321"></a>
+<span class="sourceLineNo">322</span>      // to open it up to 5 minutes by default.<a name="line.322"></a>
+<span class="sourceLineNo">323</span>      long startWaiting = EnvironmentEdgeManager.currentTime();<a name="line.323"></a>
+<span class="sourceLineNo">324</span>      long openTimeout = timeoutMillis + startWaiting;<a name="line.324"></a>
+<span class="sourceLineNo">325</span>      int nbAttempt = 0;<a name="line.325"></a>
+<span class="sourceLineNo">326</span>      AbstractFSWALProvider.Reader reader = null;<a name="line.326"></a>
+<span class="sourceLineNo">327</span>      while (true) {<a name="line.327"></a>
+<span class="sourceLineNo">328</span>        try {<a name="line.328"></a>
+<span class="sourceLineNo">329</span>          reader = lrClass.getDeclaredConstructor().newInstance();<a name="line.329"></a>
+<span class="sourceLineNo">330</span>          reader.init(fs, path, conf, null);<a name="line.330"></a>
+<span class="sourceLineNo">331</span>          return reader;<a name="line.331"></a>
+<span class="sourceLineNo">332</span>        } catch (IOException e) {<a name="line.332"></a>
+<span class="sourceLineNo">333</span>          if (reader != null) {<a name="line.333"></a>
+<span class="sourceLineNo">334</span>            try {<a name="line.334"></a>
+<span class="sourceLineNo">335</span>              reader.close();<a name="line.335"></a>
+<span class="sourceLineNo">336</span>            } catch (IOException exception) {<a name="line.336"></a>
+<span class="sourceLineNo">337</span>              LOG.warn("Could not close FSDataInputStream" + exception.getMessage());<a name="line.337"></a>
+<span class="sourceLineNo">338</span>              LOG.debug("exception details", exception);<a name="line.338"></a>
 <span class="sourceLineNo">339</span>            }<a name="line.339"></a>
-<span class="sourceLineNo">340</span>            if (reporter != null &amp;&amp; !reporter.progress()) {<a name="line.340"></a>
-<span class="sourceLineNo">341</span>              throw new InterruptedIOException("Operation is cancelled");<a name="line.341"></a>
-<span class="sourceLineNo">342</span>            }<a name="line.342"></a>
-<span class="sourceLineNo">343</span>            if (nbAttempt &gt; 2 &amp;&amp; openTimeout &lt; EnvironmentEdgeManager.currentTime()) {<a name="line.343"></a>
-<span class="sourceLineNo">344</span>              LOG.error("Can't open after " + nbAttempt + " attempts and "<a name="line.344"></a>
-<span class="sourceLineNo">345</span>                  + (EnvironmentEdgeManager.currentTime() - startWaiting) + "ms " + " for " + path);<a name="line.345"></a>
-<span class="sourceLineNo">346</span>            } else {<a name="line.346"></a>
-<span class="sourceLineNo">347</span>              try {<a name="line.347"></a>
-<span class="sourceLineNo">348</span>                Thread.sleep(nbAttempt &lt; 3 ? 500 : 1000);<a name="line.348"></a>
-<span class="sourceLineNo">349</span>                continue; // retry<a name="line.349"></a>
-<span class="sourceLineNo">350</span>              } catch (InterruptedException ie) {<a name="line.350"></a>
-<span class="sourceLineNo">351</span>                InterruptedIOException iioe = new InterruptedIOException();<a name="line.351"></a>
-<span class="sourceLineNo">352</span>                iioe.initCause(ie);<a name="line.352"></a>
-<span class="sourceLineNo">353</span>                throw iioe;<a name="line.353"></a>
-<span class="sourceLineNo">354</span>              }<a name="line.354"></a>
-<span class="sourceLineNo">355</span>            }<a name="line.355"></a>
-<span class="sourceLineNo">356</span>            throw new LeaseNotRecoveredException(e);<a name="line.356"></a>
-<span class="sourceLineNo">357</span>          } else {<a name="line.357"></a>
-<span class="sourceLineNo">358</span>            throw e;<a name="line.358"></a>
-<span class="sourceLineNo">359</span>          }<a name="line.359"></a>
-<span class="sourceLineNo">360</span>        }<a name="line.360"></a>
-<span class="sourceLineNo">361</span>      }<a name="line.361"></a>
-<span class="sourceLineNo">362</span>    } catch (IOException ie) {<a name="line.362"></a>
-<span class="sourceLineNo">363</span>      throw ie;<a name="line.363"></a>
-<span class="sourceLineNo">364</span>    } catch (Exception e) {<a name="line.364"></a>
-<span class="sourceLineNo">365</span>      throw new IOException("Cannot get log reader", e);<a name="line.365"></a>
-<span class="sourceLineNo">366</span>    }<a name="line.366"></a>
-<span class="sourceLineNo">367</span>  }<a name="line.367"></a>
-<span class="sourceLineNo">368</span><a name="line.368"></a>
-<span class="sourceLineNo">369</span>  /**<a name="line.369"></a>
-<span class="sourceLineNo">370</span>   * Create a writer for the WAL.<a name="line.370"></a>
-<span class="sourceLineNo">371</span>   * Uses defaults.<a name="line.371"></a>
-<span class="sourceLineNo">372</span>   * &lt;p&gt;<a name="line.372"></a>
-<span class="sourceLineNo">373</span>   * Should be package-private. public only for tests and<a name="line.373"></a>
-<span class="sourceLineNo">374</span>   * {@link org.apache.hadoop.hbase.regionserver.wal.Compressor}<a name="line.374"></a>
-<span class="sourceLineNo">375</span>   * @return A WAL writer. Close when done with it.<a name="line.375"></a>
-<span class="sourceLineNo">376</span>   */<a name="line.376"></a>
-<span class="sourceLineNo">377</span>  public Writer createWALWriter(final FileSystem fs, final Path path) throws IOException {<a name="line.377"></a>
-<span class="sourceLineNo">378</span>    return FSHLogProvider.createWriter(conf, fs, path, false);<a name="line.378"></a>
-<span class="sourceLineNo">379</span>  }<a name="line.379"></a>
-<span class="sourceLineNo">380</span><a name="line.380"></a>
-<span class="sourceLineNo">381</span>  /**<a name="line.381"></a>
-<span class="sourceLineNo">382</span>   * Should be package-private, visible for recovery testing.<a name="line.382"></a>
-<span class="sourceLineNo">383</span>   * Uses defaults.<a name="line.383"></a>
-<span class="sourceLineNo">384</span>   * @return an overwritable writer for recovered edits. caller should close.<a name="line.384"></a>
-<span class="sourceLineNo">385</span>   */<a name="line.385"></a>
-<span class="sourceLineNo">386</span>  @VisibleForTesting<a name="line.386"></a>
-<span class="sourceLineNo">387</span>  public Writer createRecoveredEditsWriter(final FileSystem fs, final Path path)<a name="line.387"></a>
-<span class="sourceLineNo">388</span>      throws IOException {<a name="line.388"></a>
-<span class="sourceLineNo">389</span>    return FSHLogProvider.createWriter(conf, fs, path, true);<a name="line.389"></a>
-<span class="sourceLineNo">390</span>  }<a name="line.390"></a>
-<span class="sourceLineNo">391</span><a name="line.391"></a>
-<span class="sourceLineNo">392</span>  // These static methods are currently used where it's impractical to<a name="line.392"></a>
-<span class="sourceLineNo">393</span>  // untangle the reliance on state in the filesystem. They rely on singleton<a name="line.393"></a>
-<span class="sourceLineNo">394</span>  // WALFactory that just provides Reader / Writers.<a name="line.394"></a>
-<span class="sourceLineNo">395</span>  // For now, first Configuration object wins. Practically this just impacts the reader/writer class<a name="line.395"></a>
-<span class="sourceLineNo">396</span>  private static final AtomicReference&lt;WALFactory&gt; singleton = new AtomicReference&lt;&gt;();<a name="line.396"></a>
-<span class="sourceLineNo">397</span>  private static final String SINGLETON_ID = WALFactory.class.getName();<a name="line.397"></a>
-<span class="sourceLineNo">398</span>  <a name="line.398"></a>
-<span class="sourceLineNo">399</span>  // Public only for FSHLog<a name="line.399"></a>
-<span class="sourceLineNo">400</span>  public static WALFactory getInstance(Configuration configuration) {<a name="line.400"></a>
-<span class="sourceLineNo">401</span>    WALFactory factory = singleton.get();<a name="line.401"></a>
-<span class="sourceLineNo">402</span>    if (null == factory) {<a name="line.402"></a>
-<span class="sourceLineNo">403</span>      WALFactory temp = new WALFactory(configuration);<a name="line.403"></a>
-<span class="sourceLineNo">404</span>      if (singleton.compareAndSet(null, temp)) {<a name="line.404"></a>
-<span class="sourceLineNo">405</span>        factory = temp;<a name="line.405"></a>
-<span class="sourceLineNo">406</span>      } else {<a name="line.406"></a>
-<span class="sourceLineNo">407</span>        // someone else beat us to initializing<a name="line.407"></a>
-<span class="sourceLineNo">408</span>        try {<a name="line.408"></a>
-<span class="sourceLineNo">409</span>          temp.close();<a name="line.409"></a>
-<span class="sourceLineNo">410</span>        } catch (IOException exception) {<a name="line.410"></a>
-<span class="sourceLineNo">411</span>          LOG.debug("failed to close temporary singleton. ignoring.", exception);<a name="line.411"></a>
-<span class="sourceLineNo">412</span>        }<a name="line.412"></a>
-<span class="sourceLineNo">413</span>        factory = singleton.get();<a name="line.413"></a>
-<span class="sourceLineNo">414</span>      }<a name="line.414"></a>
-<span class="sourceLineNo">415</span>    }<a name="line.415"></a>
-<span class="sourceLineNo">416</span>    return factory;<a name="line.416"></a>
-<span class="sourceLineNo">417</span>  }<a name="line.417"></a>
-<span class="sourceLineNo">418</span><a name="line.418"></a>
-<span class="sourceLineNo">419</span>  /**<a name="line.419"></a>
-<span class="sourceLineNo">420</span>   * Create a reader for the given path, accept custom reader classes from conf.<a name="line.420"></a>
-<span class="sourceLineNo">421</span>   * If you already have a WALFactory, you should favor the instance method.<a name="line.421"></a>
-<span class="sourceLineNo">422</span>   * @return a WAL Reader, caller must close.<a name="line.422"></a>
-<span class="sourceLineNo">423</span>   */<a name="line.423"></a>
-<span class="sourceLineNo">424</span>  public static Reader createReader(final FileSystem fs, final Path path,<a name="line.424"></a>
-<span class="sourceLineNo">425</span>      final Configuration configuration) throws IOException {<a name="line.425"></a>
-<span class="sourceLineNo">426</span>    return getInstance(configuration).createReader(fs, path);<a name="line.426"></a>
+<span class="sourceLineNo">340</span>          }<a name="line.340"></a>
+<span class="sourceLineNo">341</span><a name="line.341"></a>
+<span class="sourceLineNo">342</span>          String msg = e.getMessage();<a name="line.342"></a>
+<span class="sourceLineNo">343</span>          if (msg != null<a name="line.343"></a>
+<span class="sourceLineNo">344</span>              &amp;&amp; (msg.contains("Cannot obtain block length")<a name="line.344"></a>
+<span class="sourceLineNo">345</span>                  || msg.contains("Could not obtain the last block") || msg<a name="line.345"></a>
+<span class="sourceLineNo">346</span>                    .matches("Blocklist for [^ ]* has changed.*"))) {<a name="line.346"></a>
+<span class="sourceLineNo">347</span>            if (++nbAttempt == 1) {<a name="line.347"></a>
+<span class="sourceLineNo">348</span>              LOG.warn("Lease should have recovered. This is not expected. Will retry", e);<a name="line.348"></a>
+<span class="sourceLineNo">349</span>            }<a name="line.349"></a>
+<span class="sourceLineNo">350</span>            if (reporter != null &amp;&amp; !reporter.progress()) {<a name="line.350"></a>
+<span class="sourceLineNo">351</span>              throw new InterruptedIOException("Operation is cancelled");<a name="line.351"></a>
+<span class="sourceLineNo">352</span>            }<a name="line.352"></a>
+<span class="sourceLineNo">353</span>            if (nbAttempt &gt; 2 &amp;&amp; openTimeout &lt; EnvironmentEdgeManager.currentTime()) {<a name="line.353"></a>
+<span class="sourceLineNo">354</span>              LOG.error("Can't open after " + nbAttempt + " attempts and "<a name="line.354"></a>
+<span class="sourceLineNo">355</span>                  + (EnvironmentEdgeManager.currentTime() - startWaiting) + "ms " + " for " + path);<a name="line.355"></a>
+<span class="sourceLineNo">356</span>            } else {<a name="line.356"></a>
+<span class="sourceLineNo">357</span>              try {<a name="line.357"></a>
+<span class="sourceLineNo">358</span>                Thread.sleep(nbAttempt &lt; 3 ? 500 : 1000);<a name="line.358"></a>
+<span class="sourceLineNo">359</span>                continue; // retry<a name="line.359"></a>
+<span class="sourceLineNo">360</span>              } catch (InterruptedException ie) {<a name="line.360"></a>
+<span class="sourceLineNo">361</span>                InterruptedIOException iioe = new InterruptedIOException();<a name="line.361"></a>
+<span class="sourceLineNo">362</span>                iioe.initCause(ie);<a name="line.362"></a>
+<span class="sourceLineNo">363</span>                throw iioe;<a name="line.363"></a>
+<span class="sourceLineNo">364</span>              }<a name="line.364"></a>
+<span class="sourceLineNo">365</span>            }<a name="line.365"></a>
+<span class="sourceLineNo">366</span>            throw new LeaseNotRecoveredException(e);<a name="line.366"></a>
+<span class="sourceLineNo">367</span>          } else {<a name="line.367"></a>
+<span class="sourceLineNo">368</span>            throw e;<a name="line.368"></a>
+<span class="sourceLineNo">369</span>          }<a name="line.369"></a>
+<span class="sourceLineNo">370</span>        }<a name="line.370"></a>
+<span class="sourceLineNo">371</span>      }<a name="line.371"></a>
+<span class="sourceLineNo">372</span>    } catch (IOException ie) {<a name="line.372"></a>
+<span class="sourceLineNo">373</span>      throw ie;<a name="line.373"></a>
+<span class="sourceLineNo">374</span>    } catch (Exception e) {<a name="line.374"></a>
+<span class="sourceLineNo">375</span>      throw new IOException("Cannot get log reader", e);<a name="line.375"></a>
+<span class="sourceLineNo">376</span>    }<a name="line.376"></a>
+<span class="sourceLineNo">377</span>  }<a name="line.377"></a>
+<span class="sourceLineNo">378</span><a name="line.378"></a>
+<span class="sourceLineNo">379</span>  /**<a name="line.379"></a>
+<span class="sourceLineNo">380</span>   * Create a writer for the WAL.<a name="line.380"></a>
+<span class="sourceLineNo">381</span>   * Uses defaults.<a name="line.381"></a>
+<span class="sourceLineNo">382</span>   * &lt;p&gt;<a name="line.382"></a>
+<span class="sourceLineNo">383</span>   * Should be package-private. public only for tests and<a name="line.383"></a>
+<span class="sourceLineNo">384</span>   * {@link org.apache.hadoop.hbase.regionserver.wal.Compressor}<a name="line.384"></a>
+<span class="sourceLineNo">385</span>   * @return A WAL writer. Close when done with it.<a name="line.385"></a>
+<span class="sourceLineNo">386</span>   */<a name="line.386"></a>
+<span class="sourceLineNo">387</span>  public Writer createWALWriter(final FileSystem fs, final Path path) throws IOException {<a name="line.387"></a>
+<span class="sourceLineNo">388</span>    return FSHLogProvider.createWriter(conf, fs, path, false);<a name="line.388"></a>
+<span class="sourceLineNo">389</span>  }<a name="line.389"></a>
+<span class="sourceLineNo">390</span><a name="line.390"></a>
+<span class="sourceLineNo">391</span>  /**<a name="line.391"></a>
+<span class="sourceLineNo">392</span>   * Should be package-private, visible for recovery testing.<a name="line.392"></a>
+<span class="sourceLineNo">393</span>   * Uses defaults.<a name="line.393"></a>
+<span class="sourceLineNo">394</span>   * @return an overwritable writer for recovered edits. caller should close.<a name="line.394"></a>
+<span class="sourceLineNo">395</span>   */<a name="line.395"></a>
+<span class="sourceLineNo">396</span>  @VisibleForTesting<a name="line.396"></a>
+<span class="sourceLineNo">397</span>  public Writer createRecoveredEditsWriter(final FileSystem fs, final Path path)<a name="line.397"></a>
+<span class="sourceLineNo">398</span>      throws IOException {<a name="line.398"></a>
+<span class="sourceLineNo">399</span>    return FSHLogProvider.createWriter(conf, fs, path, true);<a name="line.399"></a>
+<span class="sourceLineNo">400</span>  }<a name="line.400"></a>
+<span class="sourceLineNo">401</span><a name="line.401"></a>
+<span class="sourceLineNo">402</span>  // These static methods are currently used where it's impractical to<a name="line.402"></a>
+<span class="sourceLineNo">403</span>  // untangle the reliance on state in the filesystem. They rely on singleton<a name="line.403"></a>
+<span class="sourceLineNo">404</span>  // WALFactory that just provides Reader / Writers.<a name="line.404"></a>
+<span class="sourceLineNo">405</span>  // For now, first Configuration object wins. Practically this just impacts the reader/writer class<a name="line.405"></a>
+<span class="sourceLineNo">406</span>  private static final AtomicReference&lt;WALFactory&gt; singleton = new AtomicReference&lt;&gt;();<a name="line.406"></a>
+<span class="sourceLineNo">407</span>  private static final String SINGLETON_ID = WALFactory.class.getName();<a name="line.407"></a>
+<span class="sourceLineNo">408</span>  <a name="line.408"></a>
+<span class="sourceLineNo">409</span>  // Public only for FSHLog<a name="line.409"></a>
+<span class="sourceLineNo">410</span>  public static WALFactory getInstance(Configuration configuration) {<a name="line.410"></a>
+<span class="sourceLineNo">411</span>    WALFactory factory = singleton.get();<a name="line.411"></a>
+<span class="sourceLineNo">412</span>    if (null == factory) {<a name="line.412"></a>
+<span class="sourceLineNo">413</span>      WALFactory temp = new WALFactory(configuration);<a name="line.413"></a>
+<span class="sourceLineNo">414</span>      if (singleton.compareAndSet(null, temp)) {<a name="line.414"></a>
+<span class="sourceLineNo">415</span>        factory = temp;<a name="line.415"></a>
+<span class="sourceLineNo">416</span>      } else {<a name="line.416"></a>
+<span class="sourceLineNo">417</span>        // someone else beat us to initializing<a name="line.417"></a>
+<span class="sourceLineNo">418</span>        try {<a name="line.418"></a>
+<span class="sourceLineNo">419</span>          temp.close();<a name="line.419"></a>
+<span class="sourceLineNo">420</span>        } catch (IOException exception) {<a name="line.420"></a>
+<span class="sourceLineNo">421</span>          LOG.debug("failed to close temporary singleton. ignoring.", exception);<a name="line.421"></a>
+<span class="sourceLineNo">422</span>        }<a name="line.422"></a>
+<span class="sourceLineNo">423</span>        factory = singleton.get();<a name="line.423"></a>
+<span class="sourceLineNo">424</span>      }<a name="line.424"></a>
+<span class="sourceLineNo">425</span>    }<a name="line.425"></a>
+<span class="sourceLineNo">426</span>    return factory;<a name="line.426"></a>
 <span class="sourceLineNo">427</span>  }<a name="line.427"></a>
 <span class="sourceLineNo">428</span><a name="line.428"></a>
 <span class="sourceLineNo">429</span>  /**<a name="line.429"></a>
@@ -439,53 +439,63 @@
 <span class="sourceLineNo">431</span>   * If you already have a WALFactory, you should favor the instance method.<a name="line.431"></a>
 <span class="sourceLineNo">432</span>   * @return a WAL Reader, caller must close.<a name="line.432"></a>
 <span class="sourceLineNo">433</span>   */<a name="line.433"></a>
-<span class="sourceLineNo">434</span>  static Reader createReader(final FileSystem fs, final Path path,<a name="line.434"></a>
-<span class="sourceLineNo">435</span>      final Configuration configuration, final CancelableProgressable reporter) throws IOException {<a name="line.435"></a>
-<span class="sourceLineNo">436</span>    return getInstance(configuration).createReader(fs, path, reporter);<a name="line.436"></a>
+<span class="sourceLineNo">434</span>  public static Reader createReader(final FileSystem fs, final Path path,<a name="line.434"></a>
+<span class="sourceLineNo">435</span>      final Configuration configuration) throws IOException {<a name="line.435"></a>
+<span class="sourceLineNo">436</span>    return getInstance(configuration).createReader(fs, path);<a name="line.436"></a>
 <span class="sourceLineNo">437</span>  }<a name="line.437"></a>
 <span class="sourceLineNo">438</span><a name="line.438"></a>
 <span class="sourceLineNo">439</span>  /**<a name="line.439"></a>
-<span class="sourceLineNo">440</span>   * Create a reader for the given path, ignore custom reader classes from conf.<a name="line.440"></a>
+<span class="sourceLineNo">440</span>   * Create a reader for the given path, accept custom reader classes from conf.<a name="line.440"></a>
 <span class="sourceLineNo">441</span>   * If you already have a WALFactory, you should favor the instance method.<a name="line.441"></a>
-<span class="sourceLineNo">442</span>   * only public pending move of {@link org.apache.hadoop.hbase.regionserver.wal.Compressor}<a name="line.442"></a>
-<span class="sourceLineNo">443</span>   * @return a WAL Reader, caller must close.<a name="line.443"></a>
-<span class="sourceLineNo">444</span>   */<a name="line.444"></a>
-<span class="sourceLineNo">445</span>  public static Reader createReaderIgnoreCustomClass(final FileSystem fs, final Path path,<a name="line.445"></a>
-<span class="sourceLineNo">446</span>      final Configuration configuration) throws IOException {<a name="line.446"></a>
-<span class="sourceLineNo">447</span>    return getInstance(configuration).createReader(fs, path, null, false);<a name="line.447"></a>
-<span class="sourceLineNo">448</span>  }<a name="line.448"></a>
-<span class="sourceLineNo">449</span><a name="line.449"></a>
-<span class="sourceLineNo">450</span>  /**<a name="line.450"></a>
+<span class="sourceLineNo">442</span>   * @return a WAL Reader, caller must close.<a name="line.442"></a>
+<span class="sourceLineNo">443</span>   */<a name="line.443"></a>
+<span class="sourceLineNo">444</span>  static Reader createReader(final FileSystem fs, final Path path,<a name="line.444"></a>
+<span class="sourceLineNo">445</span>      final Configuration configuration, final CancelableProgressable reporter) throws IOException {<a name="line.445"></a>
+<span class="sourceLineNo">446</span>    return getInstance(configuration).createReader(fs, path, reporter);<a name="line.446"></a>
+<span class="sourceLineNo">447</span>  }<a name="line.447"></a>
+<span class="sourceLineNo">448</span><a name="line.448"></a>
+<span class="sourceLineNo">449</span>  /**<a name="line.449"></a>
+<span class="sourceLineNo">450</span>   * Create a reader for the given path, ignore custom reader classes from conf.<a name="line.450"></a>
 <span class="sourceLineNo">451</span>   * If you already have a WALFactory, you should favor the instance method.<a name="line.451"></a>
-<span class="sourceLineNo">452</span>   * Uses defaults.<a name="line.452"></a>
-<span class="sourceLineNo">453</span>   * @return a Writer that will overwrite files. Caller must close.<a name="line.453"></a>
+<span class="sourceLineNo">452</span>   * only public pending move of {@link org.apache.hadoop.hbase.regionserver.wal.Compressor}<a name="line.452"></a>
+<span class="sourceLineNo">453</span>   * @return a WAL Reader, caller must close.<a name="line.453"></a>
 <span class="sourceLineNo">454</span>   */<a name="line.454"></a>
-<span class="sourceLineNo">455</span>  static Writer createRecoveredEditsWriter(final FileSystem fs, final Path path,<a name="line.455"></a>
-<span class="sourceLineNo">456</span>      final Configuration configuration)<a name="line.456"></a>
-<span class="sourceLineNo">457</span>      throws IOException {<a name="line.457"></a>
-<span class="sourceLineNo">458</span>    return FSHLogProvider.createWriter(configuration, fs, path, true);<a name="line.458"></a>
-<span class="sourceLineNo">459</span>  }<a name="line.459"></a>
-<span class="sourceLineNo">460</span><a name="line.460"></a>
-<span class="sourceLineNo">461</span>  /**<a name="line.461"></a>
-<span class="sourceLineNo">462</span>   * If you already have a WALFactory, you should favor the instance method.<a name="line.462"></a>
-<span class="sourceLineNo">463</span>   * Uses defaults.<a name="line.463"></a>
-<span class="sourceLineNo">464</span>   * @return a writer that won't overwrite files. Caller must close.<a name="line.464"></a>
-<span class="sourceLineNo">465</span>   */<a name="line.465"></a>
-<span class="sourceLineNo">466</span>  @VisibleForTesting<a name="line.466"></a>
-<span class="sourceLineNo">467</span>  public static Writer createWALWriter(final FileSystem fs, final Path path,<a name="line.467"></a>
-<span class="sourceLineNo">468</span>      final Configuration configuration)<a name="line.468"></a>
-<span class="sourceLineNo">469</span>      throws IOException {<a name="line.469"></a>
-<span class="sourceLineNo">470</span>    return FSHLogProvider.createWriter(configuration, fs, path, false);<a name="line.470"></a>
-<span class="sourceLineNo">471</span>  }<a name="line.471"></a>
-<span class="sourceLineNo">472</span><a name="line.472"></a>
-<span class="sourceLineNo">473</span>  public final WALProvider getWALProvider() {<a name="line.473"></a>
-<span class="sourceLineNo">474</span>    return this.provider;<a name="line.474"></a>
-<span class="sourceLineNo">475</span>  }<a name="line.475"></a>
-<span class="sourceLineNo">476</span><a name="line.476"></a>
-<span class="sourceLineNo">477</span>  public final WALProvider getMetaWALProvider() {<a name="line.477"></a>
-<span class="sourceLineNo">478</span>    return this.metaProvider.get();<a name="line.478"></a>
-<span class="sourceLineNo">479</span>  }<a name="line.479"></a>
-<span class="sourceLineNo">480</span>}<a name="line.480"></a>
+<span class="sourceLineNo">455</span>  public static Reader createReaderIgnoreCustomClass(final FileSystem fs, final Path path,<a name="line.455"></a>
+<span class="sourceLineNo">456</span>      final Configuration configuration) throws IOException {<a name="line.456"></a>
+<span class="sourceLineNo">457</span>    return getInstance(configuration).createReader(fs, path, null, false);<a name="line.457"></a>
+<span class="sourceLineNo">458</span>  }<a name="line.458"></a>
+<span class="sourceLineNo">459</span><a name="line.459"></a>
+<span class="sourceLineNo">460</span>  /**<a name="line.460"></a>
+<span class="sourceLineNo">461</span>   * If you already have a WALFactory, you should favor the instance method.<a name="line.461"></a>
+<span class="sourceLineNo">462</span>   * Uses defaults.<a name="line.462"></a>
+<span class="sourceLineNo">463</span>   * @return a Writer that will overwrite files. Caller must close.<a name="line.463"></a>
+<span class="sourceLineNo">464</span>   */<a name="line.464"></a>
+<span class="sourceLineNo">465</span>  static Writer createRecoveredEditsWriter(final FileSystem fs, final Path path,<a name="line.465"></a>
+<span class="sourceLineNo">466</span>      final Configuration configuration)<a name="line.466"></a>
+<span class="sourceLineNo">467</span>      throws IOException {<a name="line.467"></a>
+<span class="sourceLineNo">468</span>    return FSHLogProvider.createWriter(configuration, fs, path, true);<a name="line.468"></a>
+<span class="sourceLineNo">469</span>  }<a name="line.469"></a>
+<span class="sourceLineNo">470</span><a name="line.470"></a>
+<span class="sourceLineNo">471</span>  /**<a name="line.471"></a>
+<span class="sourceLineNo">472</span>   * If you already have a WALFactory, you should favor the instance method.<a name="line.472"></a>
+<span class="sourceLineNo">473</span>   * Uses defaults.<a name="line.473"></a>
+<span class="sourceLineNo">474</span>   * @return a writer that won't overwrite files. Caller must close.<a name="line.474"></a>
+<span class="sourceLineNo">475</span>   */<a name="line.475"></a>
+<span class="sourceLineNo">476</span>  @VisibleForTesting<a name="line.476"></a>
+<span class="sourceLineNo">477</span>  public static Writer createWALWriter(final FileSystem fs, final Path path,<a name="line.477"></a>
+<span class="sourceLineNo">478</span>      final Configuration configuration)<a name="line.478"></a>
+<span class="sourceLineNo">479</span>      throws IOException {<a name="line.479"></a>
+<span class="sourceLineNo">480</span>    return FSHLogProvider.createWriter(configuration, fs, path, false);<a name="line.480"></a>
+<span class="sourceLineNo">481</span>  }<a name="line.481"></a>
+<span class="sourceLineNo">482</span><a name="line.482"></a>
+<span class="sourceLineNo">483</span>  public final WALProvider getWALProvider() {<a name="line.483"></a>
+<span class="sourceLineNo">484</span>    return this.provider;<a name="line.484"></a>
+<span class="sourceLineNo">485</span>  }<a name="line.485"></a>
+<span class="sourceLineNo">486</span><a name="line.486"></a>
+<span class="sourceLineNo">487</span>  public final WALProvider getMetaWALProvider() {<a name="line.487"></a>
+<span class="sourceLineNo">488</span>    return this.metaProvider.get();<a name="line.488"></a>
+<span class="sourceLineNo">489</span>  }<a name="line.489"></a>
+<span class="sourceLineNo">490</span>}<a name="line.490"></a>
 
 
 

http://git-wip-us.apache.org/repos/asf/hbase-site/blob/bd4d10ee/downloads.html
----------------------------------------------------------------------
diff --git a/downloads.html b/downloads.html
index 423eb47..4e0f681 100644
--- a/downloads.html
+++ b/downloads.html
@@ -7,7 +7,7 @@
   <head>
     <meta charset="UTF-8" />
     <meta name="viewport" content="width=device-width, initial-scale=1.0" />
-    <meta name="Date-Revision-yyyymmdd" content="20181105" />
+    <meta name="Date-Revision-yyyymmdd" content="20181106" />
     <meta http-equiv="Content-Language" content="en" />
     <title>Apache HBase &#x2013; Apache HBase Downloads</title>
     <link rel="stylesheet" href="./css/apache-maven-fluido-1.4-HBase.min.css" />
@@ -461,7 +461,7 @@ under the License. -->
                         <a href="https://www.apache.org/">The Apache Software Foundation</a>.
             All rights reserved.      
                     
-                  <li id="publishDate" class="pull-right">Last Published: 2018-11-05</li>
+                  <li id="publishDate" class="pull-right">Last Published: 2018-11-06</li>
             </p>
                 </div>
 


Mime
View raw message