hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mi...@apache.org
Subject [02/14] hbase git commit: Published site at 55087ce8887b5be38b0fda0dda3fbf2f92c13778.
Date Mon, 23 Nov 2015 23:03:19 GMT
http://git-wip-us.apache.org/repos/asf/hbase/blob/f843f57d/xref/org/apache/hadoop/hbase/io/BoundedByteBufferPool.html
----------------------------------------------------------------------
diff --git a/xref/org/apache/hadoop/hbase/io/BoundedByteBufferPool.html b/xref/org/apache/hadoop/hbase/io/BoundedByteBufferPool.html
index 4e84d86..a04e86f 100644
--- a/xref/org/apache/hadoop/hbase/io/BoundedByteBufferPool.html
+++ b/xref/org/apache/hadoop/hbase/io/BoundedByteBufferPool.html
@@ -29,13 +29,13 @@
 <a class="jxr_linenumber" name="19" href="#19">19</a>  
 <a class="jxr_linenumber" name="20" href="#20">20</a>  <strong class="jxr_keyword">import</strong> java.nio.ByteBuffer;
 <a class="jxr_linenumber" name="21" href="#21">21</a>  <strong class="jxr_keyword">import</strong> java.util.Queue;
-<a class="jxr_linenumber" name="22" href="#22">22</a>  <strong class="jxr_keyword">import</strong> java.util.concurrent.atomic.AtomicLong;
-<a class="jxr_linenumber" name="23" href="#23">23</a>  <strong class="jxr_keyword">import</strong> java.util.concurrent.locks.ReentrantLock;
-<a class="jxr_linenumber" name="24" href="#24">24</a>  
-<a class="jxr_linenumber" name="25" href="#25">25</a>  <strong class="jxr_keyword">import</strong> org.apache.commons.logging.Log;
-<a class="jxr_linenumber" name="26" href="#26">26</a>  <strong class="jxr_keyword">import</strong> org.apache.commons.logging.LogFactory;
-<a class="jxr_linenumber" name="27" href="#27">27</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.classification.InterfaceAudience;
-<a class="jxr_linenumber" name="28" href="#28">28</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.util.BoundedArrayQueue;
+<a class="jxr_linenumber" name="22" href="#22">22</a>  <strong class="jxr_keyword">import</strong> java.util.concurrent.ConcurrentLinkedQueue;
+<a class="jxr_linenumber" name="23" href="#23">23</a>  <strong class="jxr_keyword">import</strong> java.util.concurrent.atomic.AtomicInteger;
+<a class="jxr_linenumber" name="24" href="#24">24</a>  <strong class="jxr_keyword">import</strong> java.util.concurrent.atomic.AtomicLong;
+<a class="jxr_linenumber" name="25" href="#25">25</a>  
+<a class="jxr_linenumber" name="26" href="#26">26</a>  <strong class="jxr_keyword">import</strong> org.apache.commons.logging.Log;
+<a class="jxr_linenumber" name="27" href="#27">27</a>  <strong class="jxr_keyword">import</strong> org.apache.commons.logging.LogFactory;
+<a class="jxr_linenumber" name="28" href="#28">28</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.classification.InterfaceAudience;
 <a class="jxr_linenumber" name="29" href="#29">29</a>  
 <a class="jxr_linenumber" name="30" href="#30">30</a>  <strong class="jxr_keyword">import</strong> com.google.common.annotations.VisibleForTesting;
 <a class="jxr_linenumber" name="31" href="#31">31</a>  
@@ -61,86 +61,143 @@
 <a class="jxr_linenumber" name="51" href="#51">51</a>  <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../../org/apache/hadoop/hbase/io/BoundedByteBufferPool.html">BoundedByteBufferPool</a> {
 <a class="jxr_linenumber" name="52" href="#52">52</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> Log LOG = LogFactory.getLog(BoundedByteBufferPool.<strong class="jxr_keyword">class</strong>);
 <a class="jxr_linenumber" name="53" href="#53">53</a>  
-<a class="jxr_linenumber" name="54" href="#54">54</a>    @VisibleForTesting
-<a class="jxr_linenumber" name="55" href="#55">55</a>    <strong class="jxr_keyword">final</strong> Queue&lt;ByteBuffer&gt; buffers;
-<a class="jxr_linenumber" name="56" href="#56">56</a>  
-<a class="jxr_linenumber" name="57" href="#57">57</a>    <em class="jxr_comment">// Maximum size of a ByteBuffer to retain in pool</em>
-<a class="jxr_linenumber" name="58" href="#58">58</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> maxByteBufferSizeToCache;
-<a class="jxr_linenumber" name="59" href="#59">59</a>  
-<a class="jxr_linenumber" name="60" href="#60">60</a>    <em class="jxr_comment">// A running average only it only rises, it never recedes</em>
-<a class="jxr_linenumber" name="61" href="#61">61</a>    @VisibleForTesting
-<a class="jxr_linenumber" name="62" href="#62">62</a>    <strong class="jxr_keyword">volatile</strong> <strong class="jxr_keyword">int</strong> runningAverage;
-<a class="jxr_linenumber" name="63" href="#63">63</a>  
-<a class="jxr_linenumber" name="64" href="#64">64</a>    <em class="jxr_comment">// Scratch that keeps rough total size of pooled bytebuffers</em>
-<a class="jxr_linenumber" name="65" href="#65">65</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">volatile</strong> <strong class="jxr_keyword">int</strong> totalReservoirCapacity;
-<a class="jxr_linenumber" name="66" href="#66">66</a>  
-<a class="jxr_linenumber" name="67" href="#67">67</a>    <em class="jxr_comment">// For reporting</em>
-<a class="jxr_linenumber" name="68" href="#68">68</a>    <strong class="jxr_keyword">private</strong> AtomicLong allocations = <strong class="jxr_keyword">new</strong> AtomicLong(0);
-<a class="jxr_linenumber" name="69" href="#69">69</a>  
-<a class="jxr_linenumber" name="70" href="#70">70</a>    <strong class="jxr_keyword">private</strong> ReentrantLock lock =  <strong class="jxr_keyword">new</strong> ReentrantLock();
-<a class="jxr_linenumber" name="71" href="#71">71</a>  
-<a class="jxr_linenumber" name="72" href="#72">72</a>    <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="73" href="#73">73</a>  <em class="jxr_javadoccomment">   * @param maxByteBufferSizeToCache</em>
-<a class="jxr_linenumber" name="74" href="#74">74</a>  <em class="jxr_javadoccomment">   * @param initialByteBufferSize</em>
-<a class="jxr_linenumber" name="75" href="#75">75</a>  <em class="jxr_javadoccomment">   * @param maxToCache</em>
-<a class="jxr_linenumber" name="76" href="#76">76</a>  <em class="jxr_javadoccomment">   */</em>
-<a class="jxr_linenumber" name="77" href="#77">77</a>    <strong class="jxr_keyword">public</strong> <a href="../../../../../org/apache/hadoop/hbase/io/BoundedByteBufferPool.html">BoundedByteBufferPool</a>(<strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> maxByteBufferSizeToCache, <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> initialByteBufferSize,
-<a class="jxr_linenumber" name="78" href="#78">78</a>        <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> maxToCache) {
-<a class="jxr_linenumber" name="79" href="#79">79</a>      <strong class="jxr_keyword">this</strong>.maxByteBufferSizeToCache = maxByteBufferSizeToCache;
-<a class="jxr_linenumber" name="80" href="#80">80</a>      <strong class="jxr_keyword">this</strong>.runningAverage = initialByteBufferSize;
-<a class="jxr_linenumber" name="81" href="#81">81</a>      <strong class="jxr_keyword">this</strong>.buffers = <strong class="jxr_keyword">new</strong> BoundedArrayQueue&lt;ByteBuffer&gt;(maxToCache);
-<a class="jxr_linenumber" name="82" href="#82">82</a>    }
-<a class="jxr_linenumber" name="83" href="#83">83</a>  
-<a class="jxr_linenumber" name="84" href="#84">84</a>    <strong class="jxr_keyword">public</strong> ByteBuffer getBuffer() {
-<a class="jxr_linenumber" name="85" href="#85">85</a>      ByteBuffer bb = <strong class="jxr_keyword">null</strong>;
-<a class="jxr_linenumber" name="86" href="#86">86</a>      lock.lock();
-<a class="jxr_linenumber" name="87" href="#87">87</a>      <strong class="jxr_keyword">try</strong> {
-<a class="jxr_linenumber" name="88" href="#88">88</a>        bb = <strong class="jxr_keyword">this</strong>.buffers.poll();
-<a class="jxr_linenumber" name="89" href="#89">89</a>        <strong class="jxr_keyword">if</strong> (bb != <strong class="jxr_keyword">null</strong>) {
-<a class="jxr_linenumber" name="90" href="#90">90</a>          <strong class="jxr_keyword">this</strong>.totalReservoirCapacity -= bb.capacity();
-<a class="jxr_linenumber" name="91" href="#91">91</a>        }
-<a class="jxr_linenumber" name="92" href="#92">92</a>      } <strong class="jxr_keyword">finally</strong> {
-<a class="jxr_linenumber" name="93" href="#93">93</a>        lock.unlock();
-<a class="jxr_linenumber" name="94" href="#94">94</a>      }
-<a class="jxr_linenumber" name="95" href="#95">95</a>      <strong class="jxr_keyword">if</strong> (bb != <strong class="jxr_keyword">null</strong>) {
-<a class="jxr_linenumber" name="96" href="#96">96</a>        <em class="jxr_comment">// Clear sets limit == capacity. Postion == 0.</em>
-<a class="jxr_linenumber" name="97" href="#97">97</a>        bb.clear();
-<a class="jxr_linenumber" name="98" href="#98">98</a>      } <strong class="jxr_keyword">else</strong> {
-<a class="jxr_linenumber" name="99" href="#99">99</a>        bb = ByteBuffer.allocateDirect(<strong class="jxr_keyword">this</strong>.runningAverage);
-<a class="jxr_linenumber" name="100" href="#100">100</a>       <strong class="jxr_keyword">this</strong>.allocations.incrementAndGet();
-<a class="jxr_linenumber" name="101" href="#101">101</a>     }
-<a class="jxr_linenumber" name="102" href="#102">102</a>     <strong class="jxr_keyword">if</strong> (LOG.isTraceEnabled()) {
-<a class="jxr_linenumber" name="103" href="#103">103</a>       LOG.trace(<span class="jxr_string">"runningAverage="</span> + <strong class="jxr_keyword">this</strong>.runningAverage +
-<a class="jxr_linenumber" name="104" href="#104">104</a>         <span class="jxr_string">", totalCapacity="</span> + <strong class="jxr_keyword">this</strong>.totalReservoirCapacity + <span class="jxr_string">", count="</span> + <strong class="jxr_keyword">this</strong>.buffers.size() +
-<a class="jxr_linenumber" name="105" href="#105">105</a>         <span class="jxr_string">", alloctions="</span> + <strong class="jxr_keyword">this</strong>.allocations.get());
-<a class="jxr_linenumber" name="106" href="#106">106</a>     }
-<a class="jxr_linenumber" name="107" href="#107">107</a>     <strong class="jxr_keyword">return</strong> bb;
+<a class="jxr_linenumber" name="54" href="#54">54</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">final</strong> Queue&lt;ByteBuffer&gt; buffers = <strong class="jxr_keyword">new</strong> ConcurrentLinkedQueue&lt;ByteBuffer&gt;();
+<a class="jxr_linenumber" name="55" href="#55">55</a>  
+<a class="jxr_linenumber" name="56" href="#56">56</a>    @VisibleForTesting
+<a class="jxr_linenumber" name="57" href="#57">57</a>    <strong class="jxr_keyword">int</strong> getQueueSize() {
+<a class="jxr_linenumber" name="58" href="#58">58</a>      <strong class="jxr_keyword">return</strong> buffers.size();
+<a class="jxr_linenumber" name="59" href="#59">59</a>    }
+<a class="jxr_linenumber" name="60" href="#60">60</a>  
+<a class="jxr_linenumber" name="61" href="#61">61</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> maxToCache;
+<a class="jxr_linenumber" name="62" href="#62">62</a>  
+<a class="jxr_linenumber" name="63" href="#63">63</a>    <em class="jxr_comment">// Maximum size of a ByteBuffer to retain in pool</em>
+<a class="jxr_linenumber" name="64" href="#64">64</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> maxByteBufferSizeToCache;
+<a class="jxr_linenumber" name="65" href="#65">65</a>  
+<a class="jxr_linenumber" name="66" href="#66">66</a>    <em class="jxr_comment">// A running average only it only rises, it never recedes</em>
+<a class="jxr_linenumber" name="67" href="#67">67</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">final</strong> AtomicInteger runningAverageRef;
+<a class="jxr_linenumber" name="68" href="#68">68</a>  
+<a class="jxr_linenumber" name="69" href="#69">69</a>    @VisibleForTesting
+<a class="jxr_linenumber" name="70" href="#70">70</a>    <strong class="jxr_keyword">int</strong> getRunningAverage() {
+<a class="jxr_linenumber" name="71" href="#71">71</a>      <strong class="jxr_keyword">return</strong> runningAverageRef.get();
+<a class="jxr_linenumber" name="72" href="#72">72</a>    }
+<a class="jxr_linenumber" name="73" href="#73">73</a>  
+<a class="jxr_linenumber" name="74" href="#74">74</a>    <em class="jxr_comment">// Count (lower 32bit) and total capacity (upper 32bit) of pooled bytebuffers.</em>
+<a class="jxr_linenumber" name="75" href="#75">75</a>    <em class="jxr_comment">// Both are non-negative. They are equal to or larger than those of the actual</em>
+<a class="jxr_linenumber" name="76" href="#76">76</a>    <em class="jxr_comment">// queued buffers in any transition.</em>
+<a class="jxr_linenumber" name="77" href="#77">77</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">final</strong> AtomicLong stateRef = <strong class="jxr_keyword">new</strong> AtomicLong();
+<a class="jxr_linenumber" name="78" href="#78">78</a>  
+<a class="jxr_linenumber" name="79" href="#79">79</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">int</strong> toCountOfBuffers(<strong class="jxr_keyword">long</strong> state) {
+<a class="jxr_linenumber" name="80" href="#80">80</a>      <strong class="jxr_keyword">return</strong> (<strong class="jxr_keyword">int</strong>)state;
+<a class="jxr_linenumber" name="81" href="#81">81</a>    }
+<a class="jxr_linenumber" name="82" href="#82">82</a>  
+<a class="jxr_linenumber" name="83" href="#83">83</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">int</strong> toTotalCapacity(<strong class="jxr_keyword">long</strong> state) {
+<a class="jxr_linenumber" name="84" href="#84">84</a>      <strong class="jxr_keyword">return</strong> (<strong class="jxr_keyword">int</strong>)(state &gt;&gt;&gt; 32);
+<a class="jxr_linenumber" name="85" href="#85">85</a>    }
+<a class="jxr_linenumber" name="86" href="#86">86</a>  
+<a class="jxr_linenumber" name="87" href="#87">87</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">long</strong> toState(<strong class="jxr_keyword">int</strong> countOfBuffers, <strong class="jxr_keyword">int</strong> totalCapacity) {
+<a class="jxr_linenumber" name="88" href="#88">88</a>      <strong class="jxr_keyword">return</strong> ((<strong class="jxr_keyword">long</strong>)totalCapacity &lt;&lt; 32) | totalCapacity;
+<a class="jxr_linenumber" name="89" href="#89">89</a>    }
+<a class="jxr_linenumber" name="90" href="#90">90</a>  
+<a class="jxr_linenumber" name="91" href="#91">91</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">long</strong> subtractOneBufferFromState(<strong class="jxr_keyword">long</strong> state, <strong class="jxr_keyword">int</strong> capacity) {
+<a class="jxr_linenumber" name="92" href="#92">92</a>      <strong class="jxr_keyword">return</strong> state - ((<strong class="jxr_keyword">long</strong>)capacity &lt;&lt; 32) - 1;
+<a class="jxr_linenumber" name="93" href="#93">93</a>    }
+<a class="jxr_linenumber" name="94" href="#94">94</a>  
+<a class="jxr_linenumber" name="95" href="#95">95</a>    <em class="jxr_comment">// For reporting, only used in the log</em>
+<a class="jxr_linenumber" name="96" href="#96">96</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">final</strong> AtomicLong allocationsRef = <strong class="jxr_keyword">new</strong> AtomicLong();
+<a class="jxr_linenumber" name="97" href="#97">97</a>  
+<a class="jxr_linenumber" name="98" href="#98">98</a>    <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="99" href="#99">99</a>  <em class="jxr_javadoccomment">   * @param maxByteBufferSizeToCache</em>
+<a class="jxr_linenumber" name="100" href="#100">100</a> <em class="jxr_javadoccomment">   * @param initialByteBufferSize</em>
+<a class="jxr_linenumber" name="101" href="#101">101</a> <em class="jxr_javadoccomment">   * @param maxToCache</em>
+<a class="jxr_linenumber" name="102" href="#102">102</a> <em class="jxr_javadoccomment">   */</em>
+<a class="jxr_linenumber" name="103" href="#103">103</a>   <strong class="jxr_keyword">public</strong> <a href="../../../../../org/apache/hadoop/hbase/io/BoundedByteBufferPool.html">BoundedByteBufferPool</a>(<strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> maxByteBufferSizeToCache, <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> initialByteBufferSize,
+<a class="jxr_linenumber" name="104" href="#104">104</a>       <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> maxToCache) {
+<a class="jxr_linenumber" name="105" href="#105">105</a>     <strong class="jxr_keyword">this</strong>.maxByteBufferSizeToCache = maxByteBufferSizeToCache;
+<a class="jxr_linenumber" name="106" href="#106">106</a>     <strong class="jxr_keyword">this</strong>.runningAverageRef = <strong class="jxr_keyword">new</strong> AtomicInteger(initialByteBufferSize);
+<a class="jxr_linenumber" name="107" href="#107">107</a>     <strong class="jxr_keyword">this</strong>.maxToCache = maxToCache;
 <a class="jxr_linenumber" name="108" href="#108">108</a>   }
 <a class="jxr_linenumber" name="109" href="#109">109</a> 
-<a class="jxr_linenumber" name="110" href="#110">110</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> putBuffer(ByteBuffer bb) {
-<a class="jxr_linenumber" name="111" href="#111">111</a>     <em class="jxr_comment">// If buffer is larger than we want to keep around, just let it go.</em>
-<a class="jxr_linenumber" name="112" href="#112">112</a>     <strong class="jxr_keyword">if</strong> (bb.capacity() &gt; <strong class="jxr_keyword">this</strong>.maxByteBufferSizeToCache) <strong class="jxr_keyword">return</strong>;
-<a class="jxr_linenumber" name="113" href="#113">113</a>     <strong class="jxr_keyword">boolean</strong> success = false;
-<a class="jxr_linenumber" name="114" href="#114">114</a>     <strong class="jxr_keyword">int</strong> average = 0;
-<a class="jxr_linenumber" name="115" href="#115">115</a>     lock.lock();
-<a class="jxr_linenumber" name="116" href="#116">116</a>     <strong class="jxr_keyword">try</strong> {
-<a class="jxr_linenumber" name="117" href="#117">117</a>       success = <strong class="jxr_keyword">this</strong>.buffers.offer(bb);
-<a class="jxr_linenumber" name="118" href="#118">118</a>       <strong class="jxr_keyword">if</strong> (success) {
-<a class="jxr_linenumber" name="119" href="#119">119</a>         <strong class="jxr_keyword">this</strong>.totalReservoirCapacity += bb.capacity();
-<a class="jxr_linenumber" name="120" href="#120">120</a>         average = <strong class="jxr_keyword">this</strong>.totalReservoirCapacity / <strong class="jxr_keyword">this</strong>.buffers.size(); <em class="jxr_comment">// size will never be 0.</em>
-<a class="jxr_linenumber" name="121" href="#121">121</a>       }
-<a class="jxr_linenumber" name="122" href="#122">122</a>     } <strong class="jxr_keyword">finally</strong> {
-<a class="jxr_linenumber" name="123" href="#123">123</a>       lock.unlock();
-<a class="jxr_linenumber" name="124" href="#124">124</a>     }
-<a class="jxr_linenumber" name="125" href="#125">125</a>     <strong class="jxr_keyword">if</strong> (!success) {
-<a class="jxr_linenumber" name="126" href="#126">126</a>       LOG.warn(<span class="jxr_string">"At capacity: "</span> + <strong class="jxr_keyword">this</strong>.buffers.size());
-<a class="jxr_linenumber" name="127" href="#127">127</a>     } <strong class="jxr_keyword">else</strong> {
-<a class="jxr_linenumber" name="128" href="#128">128</a>       <strong class="jxr_keyword">if</strong> (average &gt; <strong class="jxr_keyword">this</strong>.runningAverage &amp;&amp; average &lt; <strong class="jxr_keyword">this</strong>.maxByteBufferSizeToCache) {
-<a class="jxr_linenumber" name="129" href="#129">129</a>         <strong class="jxr_keyword">this</strong>.runningAverage = average;
-<a class="jxr_linenumber" name="130" href="#130">130</a>       }
-<a class="jxr_linenumber" name="131" href="#131">131</a>     }
-<a class="jxr_linenumber" name="132" href="#132">132</a>   }
-<a class="jxr_linenumber" name="133" href="#133">133</a> }
+<a class="jxr_linenumber" name="110" href="#110">110</a>   <strong class="jxr_keyword">public</strong> ByteBuffer getBuffer() {
+<a class="jxr_linenumber" name="111" href="#111">111</a>     ByteBuffer bb = buffers.poll();
+<a class="jxr_linenumber" name="112" href="#112">112</a>     <strong class="jxr_keyword">if</strong> (bb != <strong class="jxr_keyword">null</strong>) {
+<a class="jxr_linenumber" name="113" href="#113">113</a>       <strong class="jxr_keyword">long</strong> state;
+<a class="jxr_linenumber" name="114" href="#114">114</a>       <strong class="jxr_keyword">while</strong> (<strong class="jxr_keyword">true</strong>) {
+<a class="jxr_linenumber" name="115" href="#115">115</a>         <strong class="jxr_keyword">long</strong> prevState = stateRef.get();
+<a class="jxr_linenumber" name="116" href="#116">116</a>         state = subtractOneBufferFromState(prevState, bb.capacity());
+<a class="jxr_linenumber" name="117" href="#117">117</a>         <strong class="jxr_keyword">if</strong> (stateRef.compareAndSet(prevState, state)) {
+<a class="jxr_linenumber" name="118" href="#118">118</a>           <strong class="jxr_keyword">break</strong>;
+<a class="jxr_linenumber" name="119" href="#119">119</a>         }
+<a class="jxr_linenumber" name="120" href="#120">120</a>       }
+<a class="jxr_linenumber" name="121" href="#121">121</a>       <em class="jxr_comment">// Clear sets limit == capacity. Postion == 0.</em>
+<a class="jxr_linenumber" name="122" href="#122">122</a>       bb.clear();
+<a class="jxr_linenumber" name="123" href="#123">123</a> 
+<a class="jxr_linenumber" name="124" href="#124">124</a>       <strong class="jxr_keyword">if</strong> (LOG.isTraceEnabled()) {
+<a class="jxr_linenumber" name="125" href="#125">125</a>         <strong class="jxr_keyword">int</strong> countOfBuffers = toCountOfBuffers(state);
+<a class="jxr_linenumber" name="126" href="#126">126</a>         <strong class="jxr_keyword">int</strong> totalCapacity = toTotalCapacity(state);
+<a class="jxr_linenumber" name="127" href="#127">127</a>         LOG.trace(<span class="jxr_string">"totalCapacity="</span> + totalCapacity + <span class="jxr_string">", count="</span> + countOfBuffers);
+<a class="jxr_linenumber" name="128" href="#128">128</a>       }
+<a class="jxr_linenumber" name="129" href="#129">129</a>       <strong class="jxr_keyword">return</strong> bb;
+<a class="jxr_linenumber" name="130" href="#130">130</a>     }
+<a class="jxr_linenumber" name="131" href="#131">131</a> 
+<a class="jxr_linenumber" name="132" href="#132">132</a>     <strong class="jxr_keyword">int</strong> runningAverage = runningAverageRef.get();
+<a class="jxr_linenumber" name="133" href="#133">133</a>     bb = ByteBuffer.allocateDirect(runningAverage);
+<a class="jxr_linenumber" name="134" href="#134">134</a> 
+<a class="jxr_linenumber" name="135" href="#135">135</a>     <strong class="jxr_keyword">if</strong> (LOG.isTraceEnabled()) {
+<a class="jxr_linenumber" name="136" href="#136">136</a>       <strong class="jxr_keyword">long</strong> allocations = allocationsRef.incrementAndGet();
+<a class="jxr_linenumber" name="137" href="#137">137</a>       LOG.trace(<span class="jxr_string">"runningAverage="</span> + runningAverage + <span class="jxr_string">", alloctions="</span> + allocations);
+<a class="jxr_linenumber" name="138" href="#138">138</a>     }
+<a class="jxr_linenumber" name="139" href="#139">139</a>     <strong class="jxr_keyword">return</strong> bb;
+<a class="jxr_linenumber" name="140" href="#140">140</a>   }
+<a class="jxr_linenumber" name="141" href="#141">141</a> 
+<a class="jxr_linenumber" name="142" href="#142">142</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> putBuffer(ByteBuffer bb) {
+<a class="jxr_linenumber" name="143" href="#143">143</a>     <em class="jxr_comment">// If buffer is larger than we want to keep around, just let it go.</em>
+<a class="jxr_linenumber" name="144" href="#144">144</a>     <strong class="jxr_keyword">if</strong> (bb.capacity() &gt; maxByteBufferSizeToCache) {
+<a class="jxr_linenumber" name="145" href="#145">145</a>       <strong class="jxr_keyword">return</strong>;
+<a class="jxr_linenumber" name="146" href="#146">146</a>     }
+<a class="jxr_linenumber" name="147" href="#147">147</a> 
+<a class="jxr_linenumber" name="148" href="#148">148</a>     <strong class="jxr_keyword">int</strong> countOfBuffers;
+<a class="jxr_linenumber" name="149" href="#149">149</a>     <strong class="jxr_keyword">int</strong> totalCapacity;
+<a class="jxr_linenumber" name="150" href="#150">150</a>     <strong class="jxr_keyword">while</strong> (<strong class="jxr_keyword">true</strong>) {
+<a class="jxr_linenumber" name="151" href="#151">151</a>       <strong class="jxr_keyword">long</strong> prevState = stateRef.get();
+<a class="jxr_linenumber" name="152" href="#152">152</a>       countOfBuffers = toCountOfBuffers(prevState);
+<a class="jxr_linenumber" name="153" href="#153">153</a>       <strong class="jxr_keyword">if</strong> (countOfBuffers &gt;= maxToCache) {
+<a class="jxr_linenumber" name="154" href="#154">154</a>         <strong class="jxr_keyword">if</strong> (LOG.isWarnEnabled()) {
+<a class="jxr_linenumber" name="155" href="#155">155</a>           LOG.warn(<span class="jxr_string">"At capacity: "</span> + countOfBuffers);
+<a class="jxr_linenumber" name="156" href="#156">156</a>         }
+<a class="jxr_linenumber" name="157" href="#157">157</a>         <strong class="jxr_keyword">return</strong>;
+<a class="jxr_linenumber" name="158" href="#158">158</a>       }
+<a class="jxr_linenumber" name="159" href="#159">159</a>       countOfBuffers++;
+<a class="jxr_linenumber" name="160" href="#160">160</a>       assert 0 &lt; countOfBuffers &amp;&amp; countOfBuffers &lt;= maxToCache;
+<a class="jxr_linenumber" name="161" href="#161">161</a> 
+<a class="jxr_linenumber" name="162" href="#162">162</a>       totalCapacity = toTotalCapacity(prevState) + bb.capacity();
+<a class="jxr_linenumber" name="163" href="#163">163</a>       <strong class="jxr_keyword">if</strong> (totalCapacity &lt; 0) {
+<a class="jxr_linenumber" name="164" href="#164">164</a>         <strong class="jxr_keyword">if</strong> (LOG.isWarnEnabled()) {
+<a class="jxr_linenumber" name="165" href="#165">165</a>           LOG.warn(<span class="jxr_string">"Overflowed total capacity."</span>);
+<a class="jxr_linenumber" name="166" href="#166">166</a>         }
+<a class="jxr_linenumber" name="167" href="#167">167</a>         <strong class="jxr_keyword">return</strong>;
+<a class="jxr_linenumber" name="168" href="#168">168</a>       }
+<a class="jxr_linenumber" name="169" href="#169">169</a> 
+<a class="jxr_linenumber" name="170" href="#170">170</a>       <strong class="jxr_keyword">long</strong> state = toState(countOfBuffers, totalCapacity);
+<a class="jxr_linenumber" name="171" href="#171">171</a>       <strong class="jxr_keyword">if</strong> (stateRef.compareAndSet(prevState, state)) {
+<a class="jxr_linenumber" name="172" href="#172">172</a>         <strong class="jxr_keyword">break</strong>;
+<a class="jxr_linenumber" name="173" href="#173">173</a>       }
+<a class="jxr_linenumber" name="174" href="#174">174</a>     }
+<a class="jxr_linenumber" name="175" href="#175">175</a> 
+<a class="jxr_linenumber" name="176" href="#176">176</a>     <em class="jxr_comment">// ConcurrentLinkQueue#offer says "this method will never return false"</em>
+<a class="jxr_linenumber" name="177" href="#177">177</a>     buffers.offer(bb);
+<a class="jxr_linenumber" name="178" href="#178">178</a> 
+<a class="jxr_linenumber" name="179" href="#179">179</a>     <strong class="jxr_keyword">int</strong> runningAverageUpdate = Math.min(
+<a class="jxr_linenumber" name="180" href="#180">180</a>         totalCapacity / countOfBuffers, <em class="jxr_comment">// size will never be 0.</em>
+<a class="jxr_linenumber" name="181" href="#181">181</a>         maxByteBufferSizeToCache);
+<a class="jxr_linenumber" name="182" href="#182">182</a>     <strong class="jxr_keyword">while</strong> (<strong class="jxr_keyword">true</strong>) {
+<a class="jxr_linenumber" name="183" href="#183">183</a>       <strong class="jxr_keyword">int</strong> prev = runningAverageRef.get();
+<a class="jxr_linenumber" name="184" href="#184">184</a>       <strong class="jxr_keyword">if</strong> (prev &gt;= runningAverageUpdate || <em class="jxr_comment">// only rises, never recedes</em>
+<a class="jxr_linenumber" name="185" href="#185">185</a>           runningAverageRef.compareAndSet(prev, runningAverageUpdate)) {
+<a class="jxr_linenumber" name="186" href="#186">186</a>         <strong class="jxr_keyword">break</strong>;
+<a class="jxr_linenumber" name="187" href="#187">187</a>       }
+<a class="jxr_linenumber" name="188" href="#188">188</a>     }
+<a class="jxr_linenumber" name="189" href="#189">189</a>   }
+<a class="jxr_linenumber" name="190" href="#190">190</a> }
 </pre>
 <hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
 </html>

http://git-wip-us.apache.org/repos/asf/hbase/blob/f843f57d/xref/org/apache/hadoop/hbase/regionserver/wal/FSHLog.html
----------------------------------------------------------------------
diff --git a/xref/org/apache/hadoop/hbase/regionserver/wal/FSHLog.html b/xref/org/apache/hadoop/hbase/regionserver/wal/FSHLog.html
index fcd490c..e8d4c9f 100644
--- a/xref/org/apache/hadoop/hbase/regionserver/wal/FSHLog.html
+++ b/xref/org/apache/hadoop/hbase/regionserver/wal/FSHLog.html
@@ -1763,222 +1763,216 @@
 <a class="jxr_linenumber" name="1753" href="#1753">1753</a>         }
 <a class="jxr_linenumber" name="1754" href="#1754">1754</a> 
 <a class="jxr_linenumber" name="1755" href="#1755">1755</a>         <em class="jxr_comment">// TODO: Check size and if big go ahead and call a sync if we have enough data.</em>
-<a class="jxr_linenumber" name="1756" href="#1756">1756</a> 
-<a class="jxr_linenumber" name="1757" href="#1757">1757</a>         <em class="jxr_comment">// If not a batch, return to consume more events from the ring buffer before proceeding;</em>
-<a class="jxr_linenumber" name="1758" href="#1758">1758</a>         <em class="jxr_comment">// we want to get up a batch of syncs and appends before we go do a filesystem sync.</em>
-<a class="jxr_linenumber" name="1759" href="#1759">1759</a>         <strong class="jxr_keyword">if</strong> (!endOfBatch || <strong class="jxr_keyword">this</strong>.syncFuturesCount &lt;= 0) <strong class="jxr_keyword">return</strong>;
-<a class="jxr_linenumber" name="1760" href="#1760">1760</a> 
-<a class="jxr_linenumber" name="1761" href="#1761">1761</a>         <em class="jxr_comment">// Now we have a batch.</em>
-<a class="jxr_linenumber" name="1762" href="#1762">1762</a> 
-<a class="jxr_linenumber" name="1763" href="#1763">1763</a>         <strong class="jxr_keyword">if</strong> (LOG.isTraceEnabled()) {
-<a class="jxr_linenumber" name="1764" href="#1764">1764</a>           LOG.trace(<span class="jxr_string">"Sequence="</span> + sequence + <span class="jxr_string">", syncCount="</span> + <strong class="jxr_keyword">this</strong>.syncFuturesCount);
-<a class="jxr_linenumber" name="1765" href="#1765">1765</a>         }
-<a class="jxr_linenumber" name="1766" href="#1766">1766</a> 
-<a class="jxr_linenumber" name="1767" href="#1767">1767</a>         <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">this</strong>.exception == <strong class="jxr_keyword">null</strong>) {
-<a class="jxr_linenumber" name="1768" href="#1768">1768</a>           <em class="jxr_comment">// Below expects that the offer 'transfers' responsibility for the outstanding syncs to</em>
-<a class="jxr_linenumber" name="1769" href="#1769">1769</a>           <em class="jxr_comment">// the syncRunner. We should never get an exception in here.</em>
-<a class="jxr_linenumber" name="1770" href="#1770">1770</a>           <strong class="jxr_keyword">this</strong>.syncRunnerIndex = (<strong class="jxr_keyword">this</strong>.syncRunnerIndex + 1) % <strong class="jxr_keyword">this</strong>.syncRunners.length;
-<a class="jxr_linenumber" name="1771" href="#1771">1771</a>           <strong class="jxr_keyword">try</strong> {
-<a class="jxr_linenumber" name="1772" href="#1772">1772</a>             <strong class="jxr_keyword">this</strong>.syncRunners[<strong class="jxr_keyword">this</strong>.syncRunnerIndex].offer(sequence, <strong class="jxr_keyword">this</strong>.syncFutures,
-<a class="jxr_linenumber" name="1773" href="#1773">1773</a>               <strong class="jxr_keyword">this</strong>.syncFuturesCount);
-<a class="jxr_linenumber" name="1774" href="#1774">1774</a>           } <strong class="jxr_keyword">catch</strong> (Exception e) {
-<a class="jxr_linenumber" name="1775" href="#1775">1775</a>             <em class="jxr_comment">// Should NEVER get here.</em>
-<a class="jxr_linenumber" name="1776" href="#1776">1776</a>             requestLogRoll();
-<a class="jxr_linenumber" name="1777" href="#1777">1777</a>             <strong class="jxr_keyword">this</strong>.exception = <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/hadoop/hbase/regionserver/wal/DamagedWALException.html">DamagedWALException</a>(<span class="jxr_string">"Failed offering sync"</span>, e);
-<a class="jxr_linenumber" name="1778" href="#1778">1778</a>           }
+<a class="jxr_linenumber" name="1756" href="#1756">1756</a>         <em class="jxr_comment">// This is a sync. If existing exception, fall through. Else look to see if batch.</em>
+<a class="jxr_linenumber" name="1757" href="#1757">1757</a>         <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">this</strong>.exception == <strong class="jxr_keyword">null</strong>) {
+<a class="jxr_linenumber" name="1758" href="#1758">1758</a>           <em class="jxr_comment">// If not a batch, return to consume more events from the ring buffer before proceeding;</em>
+<a class="jxr_linenumber" name="1759" href="#1759">1759</a>           <em class="jxr_comment">// we want to get up a batch of syncs and appends before we go do a filesystem sync.</em>
+<a class="jxr_linenumber" name="1760" href="#1760">1760</a>           <strong class="jxr_keyword">if</strong> (!endOfBatch || <strong class="jxr_keyword">this</strong>.syncFuturesCount &lt;= 0) <strong class="jxr_keyword">return</strong>;
+<a class="jxr_linenumber" name="1761" href="#1761">1761</a>           <em class="jxr_comment">// Below expects that the offer 'transfers' responsibility for the outstanding syncs to</em>
+<a class="jxr_linenumber" name="1762" href="#1762">1762</a>           <em class="jxr_comment">// the syncRunner. We should never get an exception in here.</em>
+<a class="jxr_linenumber" name="1763" href="#1763">1763</a>           <strong class="jxr_keyword">this</strong>.syncRunnerIndex = (<strong class="jxr_keyword">this</strong>.syncRunnerIndex + 1) % <strong class="jxr_keyword">this</strong>.syncRunners.length;
+<a class="jxr_linenumber" name="1764" href="#1764">1764</a>           <strong class="jxr_keyword">try</strong> {
+<a class="jxr_linenumber" name="1765" href="#1765">1765</a>             <strong class="jxr_keyword">this</strong>.syncRunners[<strong class="jxr_keyword">this</strong>.syncRunnerIndex].offer(sequence, <strong class="jxr_keyword">this</strong>.syncFutures,
+<a class="jxr_linenumber" name="1766" href="#1766">1766</a>               <strong class="jxr_keyword">this</strong>.syncFuturesCount);
+<a class="jxr_linenumber" name="1767" href="#1767">1767</a>           } <strong class="jxr_keyword">catch</strong> (Exception e) {
+<a class="jxr_linenumber" name="1768" href="#1768">1768</a>             <em class="jxr_comment">// Should NEVER get here.</em>
+<a class="jxr_linenumber" name="1769" href="#1769">1769</a>             requestLogRoll();
+<a class="jxr_linenumber" name="1770" href="#1770">1770</a>             <strong class="jxr_keyword">this</strong>.exception = <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/hadoop/hbase/regionserver/wal/DamagedWALException.html">DamagedWALException</a>(<span class="jxr_string">"Failed offering sync"</span>, e);
+<a class="jxr_linenumber" name="1771" href="#1771">1771</a>           }
+<a class="jxr_linenumber" name="1772" href="#1772">1772</a>         }
+<a class="jxr_linenumber" name="1773" href="#1773">1773</a>         <em class="jxr_comment">// We may have picked up an exception above trying to offer sync</em>
+<a class="jxr_linenumber" name="1774" href="#1774">1774</a>         <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">this</strong>.exception != <strong class="jxr_keyword">null</strong>) {
+<a class="jxr_linenumber" name="1775" href="#1775">1775</a>           cleanupOutstandingSyncsOnException(sequence,
+<a class="jxr_linenumber" name="1776" href="#1776">1776</a>             <strong class="jxr_keyword">this</strong>.exception instanceof DamagedWALException?
+<a class="jxr_linenumber" name="1777" href="#1777">1777</a>               <strong class="jxr_keyword">this</strong>.exception:
+<a class="jxr_linenumber" name="1778" href="#1778">1778</a>               <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/hadoop/hbase/regionserver/wal/DamagedWALException.html">DamagedWALException</a>(<span class="jxr_string">"On sync"</span>, <strong class="jxr_keyword">this</strong>.exception));
 <a class="jxr_linenumber" name="1779" href="#1779">1779</a>         }
-<a class="jxr_linenumber" name="1780" href="#1780">1780</a>         <em class="jxr_comment">// We may have picked up an exception above trying to offer sync</em>
-<a class="jxr_linenumber" name="1781" href="#1781">1781</a>         <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">this</strong>.exception != <strong class="jxr_keyword">null</strong>) {
-<a class="jxr_linenumber" name="1782" href="#1782">1782</a>           cleanupOutstandingSyncsOnException(sequence,
-<a class="jxr_linenumber" name="1783" href="#1783">1783</a>             <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/hadoop/hbase/regionserver/wal/DamagedWALException.html">DamagedWALException</a>(<span class="jxr_string">"On sync"</span>, <strong class="jxr_keyword">this</strong>.exception));
-<a class="jxr_linenumber" name="1784" href="#1784">1784</a>         }
-<a class="jxr_linenumber" name="1785" href="#1785">1785</a>         attainSafePoint(sequence);
-<a class="jxr_linenumber" name="1786" href="#1786">1786</a>         <strong class="jxr_keyword">this</strong>.syncFuturesCount = 0;
-<a class="jxr_linenumber" name="1787" href="#1787">1787</a>       } <strong class="jxr_keyword">catch</strong> (Throwable t) {
-<a class="jxr_linenumber" name="1788" href="#1788">1788</a>         LOG.error(<span class="jxr_string">"UNEXPECTED!!! syncFutures.length="</span> + <strong class="jxr_keyword">this</strong>.syncFutures.length, t);
-<a class="jxr_linenumber" name="1789" href="#1789">1789</a>       }
+<a class="jxr_linenumber" name="1780" href="#1780">1780</a>         attainSafePoint(sequence);
+<a class="jxr_linenumber" name="1781" href="#1781">1781</a>         <strong class="jxr_keyword">this</strong>.syncFuturesCount = 0;
+<a class="jxr_linenumber" name="1782" href="#1782">1782</a>       } <strong class="jxr_keyword">catch</strong> (Throwable t) {
+<a class="jxr_linenumber" name="1783" href="#1783">1783</a>         LOG.error(<span class="jxr_string">"UNEXPECTED!!! syncFutures.length="</span> + <strong class="jxr_keyword">this</strong>.syncFutures.length, t);
+<a class="jxr_linenumber" name="1784" href="#1784">1784</a>       }
+<a class="jxr_linenumber" name="1785" href="#1785">1785</a>     }
+<a class="jxr_linenumber" name="1786" href="#1786">1786</a> 
+<a class="jxr_linenumber" name="1787" href="#1787">1787</a>     <a href="../../../../../../org/apache/hadoop/hbase/regionserver/wal/FSHLog.html">SafePointZigZagLatch</a> attainSafePoint() {
+<a class="jxr_linenumber" name="1788" href="#1788">1788</a>       <strong class="jxr_keyword">this</strong>.zigzagLatch = <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/hadoop/hbase/regionserver/wal/FSHLog.html">SafePointZigZagLatch</a>();
+<a class="jxr_linenumber" name="1789" href="#1789">1789</a>       <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">this</strong>.zigzagLatch;
 <a class="jxr_linenumber" name="1790" href="#1790">1790</a>     }
 <a class="jxr_linenumber" name="1791" href="#1791">1791</a> 
-<a class="jxr_linenumber" name="1792" href="#1792">1792</a>     <a href="../../../../../../org/apache/hadoop/hbase/regionserver/wal/FSHLog.html">SafePointZigZagLatch</a> attainSafePoint() {
-<a class="jxr_linenumber" name="1793" href="#1793">1793</a>       <strong class="jxr_keyword">this</strong>.zigzagLatch = <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/hadoop/hbase/regionserver/wal/FSHLog.html">SafePointZigZagLatch</a>();
-<a class="jxr_linenumber" name="1794" href="#1794">1794</a>       <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">this</strong>.zigzagLatch;
-<a class="jxr_linenumber" name="1795" href="#1795">1795</a>     }
-<a class="jxr_linenumber" name="1796" href="#1796">1796</a> 
-<a class="jxr_linenumber" name="1797" href="#1797">1797</a>     <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="1798" href="#1798">1798</a> <em class="jxr_javadoccomment">     * Check if we should attain safe point.  If so, go there and then wait till signalled before</em>
-<a class="jxr_linenumber" name="1799" href="#1799">1799</a> <em class="jxr_javadoccomment">     * we proceeding.</em>
-<a class="jxr_linenumber" name="1800" href="#1800">1800</a> <em class="jxr_javadoccomment">     */</em>
-<a class="jxr_linenumber" name="1801" href="#1801">1801</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">void</strong> attainSafePoint(<strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">long</strong> currentSequence) {
-<a class="jxr_linenumber" name="1802" href="#1802">1802</a>       <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">this</strong>.zigzagLatch == <strong class="jxr_keyword">null</strong> || !<strong class="jxr_keyword">this</strong>.zigzagLatch.isCocked()) <strong class="jxr_keyword">return</strong>;
-<a class="jxr_linenumber" name="1803" href="#1803">1803</a>       <em class="jxr_comment">// If here, another thread is waiting on us to get to safe point.  Don't leave it hanging.</em>
-<a class="jxr_linenumber" name="1804" href="#1804">1804</a>       beforeWaitOnSafePoint();
-<a class="jxr_linenumber" name="1805" href="#1805">1805</a>       <strong class="jxr_keyword">try</strong> {
-<a class="jxr_linenumber" name="1806" href="#1806">1806</a>         <em class="jxr_comment">// Wait on outstanding syncers; wait for them to finish syncing (unless we've been</em>
-<a class="jxr_linenumber" name="1807" href="#1807">1807</a>         <em class="jxr_comment">// shutdown or unless our latch has been thrown because we have been aborted or unless</em>
-<a class="jxr_linenumber" name="1808" href="#1808">1808</a>         <em class="jxr_comment">// this WAL is broken and we can't get a sync/append to complete).</em>
-<a class="jxr_linenumber" name="1809" href="#1809">1809</a>         <strong class="jxr_keyword">while</strong> (!<strong class="jxr_keyword">this</strong>.shutdown &amp;&amp; <strong class="jxr_keyword">this</strong>.zigzagLatch.isCocked() &amp;&amp;
-<a class="jxr_linenumber" name="1810" href="#1810">1810</a>             highestSyncedSequence.get() &lt; currentSequence &amp;&amp;
-<a class="jxr_linenumber" name="1811" href="#1811">1811</a>             <em class="jxr_comment">// We could be in here and all syncs are failing or failed. Check for this. Otherwise</em>
-<a class="jxr_linenumber" name="1812" href="#1812">1812</a>             <em class="jxr_comment">// we'll just be stuck here for ever. In other words, ensure there syncs running.</em>
-<a class="jxr_linenumber" name="1813" href="#1813">1813</a>             isOutstandingSyncs()) {
-<a class="jxr_linenumber" name="1814" href="#1814">1814</a>           <strong class="jxr_keyword">synchronized</strong> (<strong class="jxr_keyword">this</strong>.safePointWaiter) {
-<a class="jxr_linenumber" name="1815" href="#1815">1815</a>             <strong class="jxr_keyword">this</strong>.safePointWaiter.wait(0, 1);
-<a class="jxr_linenumber" name="1816" href="#1816">1816</a>           }
-<a class="jxr_linenumber" name="1817" href="#1817">1817</a>         }
-<a class="jxr_linenumber" name="1818" href="#1818">1818</a>         <em class="jxr_comment">// Tell waiting thread we've attained safe point. Can clear this.throwable if set here</em>
-<a class="jxr_linenumber" name="1819" href="#1819">1819</a>         <em class="jxr_comment">// because we know that next event through the ringbuffer will be going to a new WAL</em>
-<a class="jxr_linenumber" name="1820" href="#1820">1820</a>         <em class="jxr_comment">// after we do the zigzaglatch dance.</em>
-<a class="jxr_linenumber" name="1821" href="#1821">1821</a>         <strong class="jxr_keyword">this</strong>.exception = <strong class="jxr_keyword">null</strong>;
-<a class="jxr_linenumber" name="1822" href="#1822">1822</a>         <strong class="jxr_keyword">this</strong>.zigzagLatch.safePointAttained();
-<a class="jxr_linenumber" name="1823" href="#1823">1823</a>       } <strong class="jxr_keyword">catch</strong> (InterruptedException e) {
-<a class="jxr_linenumber" name="1824" href="#1824">1824</a>         LOG.warn(<span class="jxr_string">"Interrupted "</span>, e);
-<a class="jxr_linenumber" name="1825" href="#1825">1825</a>         Thread.currentThread().interrupt();
-<a class="jxr_linenumber" name="1826" href="#1826">1826</a>       }
-<a class="jxr_linenumber" name="1827" href="#1827">1827</a>     }
-<a class="jxr_linenumber" name="1828" href="#1828">1828</a> 
-<a class="jxr_linenumber" name="1829" href="#1829">1829</a>     <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="1830" href="#1830">1830</a> <em class="jxr_javadoccomment">     * Append to the WAL.  Does all CP and WAL listener calls.</em>
-<a class="jxr_linenumber" name="1831" href="#1831">1831</a> <em class="jxr_javadoccomment">     * @param entry</em>
-<a class="jxr_linenumber" name="1832" href="#1832">1832</a> <em class="jxr_javadoccomment">     * @throws Exception</em>
-<a class="jxr_linenumber" name="1833" href="#1833">1833</a> <em class="jxr_javadoccomment">     */</em>
-<a class="jxr_linenumber" name="1834" href="#1834">1834</a>     <strong class="jxr_keyword">void</strong> append(<strong class="jxr_keyword">final</strong> <a href="../../../../../../org/apache/hadoop/hbase/regionserver/wal/FSWALEntry.html">FSWALEntry</a> entry) <strong class="jxr_keyword">throws</strong> Exception {
-<a class="jxr_linenumber" name="1835" href="#1835">1835</a>       <em class="jxr_comment">// TODO: WORK ON MAKING THIS APPEND FASTER. DOING WAY TOO MUCH WORK WITH CPs, PBing, etc.</em>
-<a class="jxr_linenumber" name="1836" href="#1836">1836</a>       atHeadOfRingBufferEventHandlerAppend();
-<a class="jxr_linenumber" name="1837" href="#1837">1837</a> 
-<a class="jxr_linenumber" name="1838" href="#1838">1838</a>       <strong class="jxr_keyword">long</strong> start = EnvironmentEdgeManager.currentTime();
-<a class="jxr_linenumber" name="1839" href="#1839">1839</a>       byte [] encodedRegionName = entry.getKey().getEncodedRegionName();
-<a class="jxr_linenumber" name="1840" href="#1840">1840</a>       <strong class="jxr_keyword">long</strong> regionSequenceId = WALKey.NO_SEQUENCE_ID;
-<a class="jxr_linenumber" name="1841" href="#1841">1841</a>       <strong class="jxr_keyword">try</strong> {
-<a class="jxr_linenumber" name="1842" href="#1842">1842</a>         <em class="jxr_comment">// We are about to append this edit; update the region-scoped sequence number.  Do it</em>
-<a class="jxr_linenumber" name="1843" href="#1843">1843</a>         <em class="jxr_comment">// here inside this single appending/writing thread.  Events are ordered on the ringbuffer</em>
-<a class="jxr_linenumber" name="1844" href="#1844">1844</a>         <em class="jxr_comment">// so region sequenceids will also be in order.</em>
-<a class="jxr_linenumber" name="1845" href="#1845">1845</a>         regionSequenceId = entry.stampRegionSequenceId();
-<a class="jxr_linenumber" name="1846" href="#1846">1846</a>         <em class="jxr_comment">// Edits are empty, there is nothing to append.  Maybe empty when we are looking for a</em>
-<a class="jxr_linenumber" name="1847" href="#1847">1847</a>         <em class="jxr_comment">// region sequence id only, a region edit/sequence id that is not associated with an actual</em>
-<a class="jxr_linenumber" name="1848" href="#1848">1848</a>         <em class="jxr_comment">// edit. It has to go through all the rigmarole to be sure we have the right ordering.</em>
-<a class="jxr_linenumber" name="1849" href="#1849">1849</a>         <strong class="jxr_keyword">if</strong> (entry.getEdit().isEmpty()) {
-<a class="jxr_linenumber" name="1850" href="#1850">1850</a>           <strong class="jxr_keyword">return</strong>;
-<a class="jxr_linenumber" name="1851" href="#1851">1851</a>         }
-<a class="jxr_linenumber" name="1852" href="#1852">1852</a> 
-<a class="jxr_linenumber" name="1853" href="#1853">1853</a>         <em class="jxr_comment">// Coprocessor hook.</em>
-<a class="jxr_linenumber" name="1854" href="#1854">1854</a>         <strong class="jxr_keyword">if</strong> (!coprocessorHost.preWALWrite(entry.getHRegionInfo(), entry.getKey(),
-<a class="jxr_linenumber" name="1855" href="#1855">1855</a>             entry.getEdit())) {
-<a class="jxr_linenumber" name="1856" href="#1856">1856</a>           <strong class="jxr_keyword">if</strong> (entry.getEdit().isReplay()) {
-<a class="jxr_linenumber" name="1857" href="#1857">1857</a>             <em class="jxr_comment">// Set replication scope null so that this won't be replicated</em>
-<a class="jxr_linenumber" name="1858" href="#1858">1858</a>             entry.getKey().setScopes(<strong class="jxr_keyword">null</strong>);
-<a class="jxr_linenumber" name="1859" href="#1859">1859</a>           }
-<a class="jxr_linenumber" name="1860" href="#1860">1860</a>         }
-<a class="jxr_linenumber" name="1861" href="#1861">1861</a>         <strong class="jxr_keyword">if</strong> (!listeners.isEmpty()) {
-<a class="jxr_linenumber" name="1862" href="#1862">1862</a>           <strong class="jxr_keyword">for</strong> (WALActionsListener i: listeners) {
-<a class="jxr_linenumber" name="1863" href="#1863">1863</a>             <em class="jxr_comment">// TODO: Why does listener take a table description and CPs take a regioninfo?  Fix.</em>
-<a class="jxr_linenumber" name="1864" href="#1864">1864</a>             i.visitLogEntryBeforeWrite(entry.getHTableDescriptor(), entry.getKey(),
-<a class="jxr_linenumber" name="1865" href="#1865">1865</a>               entry.getEdit());
-<a class="jxr_linenumber" name="1866" href="#1866">1866</a>           }
-<a class="jxr_linenumber" name="1867" href="#1867">1867</a>         }
-<a class="jxr_linenumber" name="1868" href="#1868">1868</a> 
-<a class="jxr_linenumber" name="1869" href="#1869">1869</a>         writer.append(entry);
-<a class="jxr_linenumber" name="1870" href="#1870">1870</a>         assert highestUnsyncedSequence &lt; entry.getSequence();
-<a class="jxr_linenumber" name="1871" href="#1871">1871</a>         highestUnsyncedSequence = entry.getSequence();
-<a class="jxr_linenumber" name="1872" href="#1872">1872</a>         sequenceIdAccounting.update(encodedRegionName, entry.getFamilyNames(), regionSequenceId,
-<a class="jxr_linenumber" name="1873" href="#1873">1873</a>           entry.isInMemstore());
-<a class="jxr_linenumber" name="1874" href="#1874">1874</a>         coprocessorHost.postWALWrite(entry.getHRegionInfo(), entry.getKey(), entry.getEdit());
-<a class="jxr_linenumber" name="1875" href="#1875">1875</a>         <em class="jxr_comment">// Update metrics.</em>
-<a class="jxr_linenumber" name="1876" href="#1876">1876</a>         postAppend(entry, EnvironmentEdgeManager.currentTime() - start);
-<a class="jxr_linenumber" name="1877" href="#1877">1877</a>       } <strong class="jxr_keyword">catch</strong> (Exception e) {
-<a class="jxr_linenumber" name="1878" href="#1878">1878</a>         String msg = <span class="jxr_string">"Append sequenceId="</span> + regionSequenceId +
-<a class="jxr_linenumber" name="1879" href="#1879">1879</a>           <span class="jxr_string">", requesting roll of WAL"</span>;
-<a class="jxr_linenumber" name="1880" href="#1880">1880</a>         LOG.warn(msg, e);
-<a class="jxr_linenumber" name="1881" href="#1881">1881</a>         requestLogRoll();
-<a class="jxr_linenumber" name="1882" href="#1882">1882</a>         <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/hadoop/hbase/regionserver/wal/DamagedWALException.html">DamagedWALException</a>(msg, e);
-<a class="jxr_linenumber" name="1883" href="#1883">1883</a>       }
-<a class="jxr_linenumber" name="1884" href="#1884">1884</a>       numEntries.incrementAndGet();
-<a class="jxr_linenumber" name="1885" href="#1885">1885</a>     }
-<a class="jxr_linenumber" name="1886" href="#1886">1886</a> 
-<a class="jxr_linenumber" name="1887" href="#1887">1887</a>     @Override
-<a class="jxr_linenumber" name="1888" href="#1888">1888</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> onStart() {
-<a class="jxr_linenumber" name="1889" href="#1889">1889</a>       <strong class="jxr_keyword">for</strong> (SyncRunner syncRunner: <strong class="jxr_keyword">this</strong>.syncRunners) syncRunner.start();
-<a class="jxr_linenumber" name="1890" href="#1890">1890</a>     }
+<a class="jxr_linenumber" name="1792" href="#1792">1792</a>     <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="1793" href="#1793">1793</a> <em class="jxr_javadoccomment">     * Check if we should attain safe point.  If so, go there and then wait till signalled before</em>
+<a class="jxr_linenumber" name="1794" href="#1794">1794</a> <em class="jxr_javadoccomment">     * we proceeding.</em>
+<a class="jxr_linenumber" name="1795" href="#1795">1795</a> <em class="jxr_javadoccomment">     */</em>
+<a class="jxr_linenumber" name="1796" href="#1796">1796</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">void</strong> attainSafePoint(<strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">long</strong> currentSequence) {
+<a class="jxr_linenumber" name="1797" href="#1797">1797</a>       <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">this</strong>.zigzagLatch == <strong class="jxr_keyword">null</strong> || !<strong class="jxr_keyword">this</strong>.zigzagLatch.isCocked()) <strong class="jxr_keyword">return</strong>;
+<a class="jxr_linenumber" name="1798" href="#1798">1798</a>       <em class="jxr_comment">// If here, another thread is waiting on us to get to safe point.  Don't leave it hanging.</em>
+<a class="jxr_linenumber" name="1799" href="#1799">1799</a>       beforeWaitOnSafePoint();
+<a class="jxr_linenumber" name="1800" href="#1800">1800</a>       <strong class="jxr_keyword">try</strong> {
+<a class="jxr_linenumber" name="1801" href="#1801">1801</a>         <em class="jxr_comment">// Wait on outstanding syncers; wait for them to finish syncing (unless we've been</em>
+<a class="jxr_linenumber" name="1802" href="#1802">1802</a>         <em class="jxr_comment">// shutdown or unless our latch has been thrown because we have been aborted or unless</em>
+<a class="jxr_linenumber" name="1803" href="#1803">1803</a>         <em class="jxr_comment">// this WAL is broken and we can't get a sync/append to complete).</em>
+<a class="jxr_linenumber" name="1804" href="#1804">1804</a>         <strong class="jxr_keyword">while</strong> (!<strong class="jxr_keyword">this</strong>.shutdown &amp;&amp; <strong class="jxr_keyword">this</strong>.zigzagLatch.isCocked() &amp;&amp;
+<a class="jxr_linenumber" name="1805" href="#1805">1805</a>             highestSyncedSequence.get() &lt; currentSequence &amp;&amp;
+<a class="jxr_linenumber" name="1806" href="#1806">1806</a>             <em class="jxr_comment">// We could be in here and all syncs are failing or failed. Check for this. Otherwise</em>
+<a class="jxr_linenumber" name="1807" href="#1807">1807</a>             <em class="jxr_comment">// we'll just be stuck here for ever. In other words, ensure there syncs running.</em>
+<a class="jxr_linenumber" name="1808" href="#1808">1808</a>             isOutstandingSyncs()) {
+<a class="jxr_linenumber" name="1809" href="#1809">1809</a>           <strong class="jxr_keyword">synchronized</strong> (<strong class="jxr_keyword">this</strong>.safePointWaiter) {
+<a class="jxr_linenumber" name="1810" href="#1810">1810</a>             <strong class="jxr_keyword">this</strong>.safePointWaiter.wait(0, 1);
+<a class="jxr_linenumber" name="1811" href="#1811">1811</a>           }
+<a class="jxr_linenumber" name="1812" href="#1812">1812</a>         }
+<a class="jxr_linenumber" name="1813" href="#1813">1813</a>         <em class="jxr_comment">// Tell waiting thread we've attained safe point. Can clear this.throwable if set here</em>
+<a class="jxr_linenumber" name="1814" href="#1814">1814</a>         <em class="jxr_comment">// because we know that next event through the ringbuffer will be going to a new WAL</em>
+<a class="jxr_linenumber" name="1815" href="#1815">1815</a>         <em class="jxr_comment">// after we do the zigzaglatch dance.</em>
+<a class="jxr_linenumber" name="1816" href="#1816">1816</a>         <strong class="jxr_keyword">this</strong>.exception = <strong class="jxr_keyword">null</strong>;
+<a class="jxr_linenumber" name="1817" href="#1817">1817</a>         <strong class="jxr_keyword">this</strong>.zigzagLatch.safePointAttained();
+<a class="jxr_linenumber" name="1818" href="#1818">1818</a>       } <strong class="jxr_keyword">catch</strong> (InterruptedException e) {
+<a class="jxr_linenumber" name="1819" href="#1819">1819</a>         LOG.warn(<span class="jxr_string">"Interrupted "</span>, e);
+<a class="jxr_linenumber" name="1820" href="#1820">1820</a>         Thread.currentThread().interrupt();
+<a class="jxr_linenumber" name="1821" href="#1821">1821</a>       }
+<a class="jxr_linenumber" name="1822" href="#1822">1822</a>     }
+<a class="jxr_linenumber" name="1823" href="#1823">1823</a> 
+<a class="jxr_linenumber" name="1824" href="#1824">1824</a>     <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="1825" href="#1825">1825</a> <em class="jxr_javadoccomment">     * Append to the WAL.  Does all CP and WAL listener calls.</em>
+<a class="jxr_linenumber" name="1826" href="#1826">1826</a> <em class="jxr_javadoccomment">     * @param entry</em>
+<a class="jxr_linenumber" name="1827" href="#1827">1827</a> <em class="jxr_javadoccomment">     * @throws Exception</em>
+<a class="jxr_linenumber" name="1828" href="#1828">1828</a> <em class="jxr_javadoccomment">     */</em>
+<a class="jxr_linenumber" name="1829" href="#1829">1829</a>     <strong class="jxr_keyword">void</strong> append(<strong class="jxr_keyword">final</strong> <a href="../../../../../../org/apache/hadoop/hbase/regionserver/wal/FSWALEntry.html">FSWALEntry</a> entry) <strong class="jxr_keyword">throws</strong> Exception {
+<a class="jxr_linenumber" name="1830" href="#1830">1830</a>       <em class="jxr_comment">// TODO: WORK ON MAKING THIS APPEND FASTER. DOING WAY TOO MUCH WORK WITH CPs, PBing, etc.</em>
+<a class="jxr_linenumber" name="1831" href="#1831">1831</a>       atHeadOfRingBufferEventHandlerAppend();
+<a class="jxr_linenumber" name="1832" href="#1832">1832</a> 
+<a class="jxr_linenumber" name="1833" href="#1833">1833</a>       <strong class="jxr_keyword">long</strong> start = EnvironmentEdgeManager.currentTime();
+<a class="jxr_linenumber" name="1834" href="#1834">1834</a>       byte [] encodedRegionName = entry.getKey().getEncodedRegionName();
+<a class="jxr_linenumber" name="1835" href="#1835">1835</a>       <strong class="jxr_keyword">long</strong> regionSequenceId = WALKey.NO_SEQUENCE_ID;
+<a class="jxr_linenumber" name="1836" href="#1836">1836</a>       <strong class="jxr_keyword">try</strong> {
+<a class="jxr_linenumber" name="1837" href="#1837">1837</a>         <em class="jxr_comment">// We are about to append this edit; update the region-scoped sequence number.  Do it</em>
+<a class="jxr_linenumber" name="1838" href="#1838">1838</a>         <em class="jxr_comment">// here inside this single appending/writing thread.  Events are ordered on the ringbuffer</em>
+<a class="jxr_linenumber" name="1839" href="#1839">1839</a>         <em class="jxr_comment">// so region sequenceids will also be in order.</em>
+<a class="jxr_linenumber" name="1840" href="#1840">1840</a>         regionSequenceId = entry.stampRegionSequenceId();
+<a class="jxr_linenumber" name="1841" href="#1841">1841</a>         <em class="jxr_comment">// Edits are empty, there is nothing to append.  Maybe empty when we are looking for a</em>
+<a class="jxr_linenumber" name="1842" href="#1842">1842</a>         <em class="jxr_comment">// region sequence id only, a region edit/sequence id that is not associated with an actual</em>
+<a class="jxr_linenumber" name="1843" href="#1843">1843</a>         <em class="jxr_comment">// edit. It has to go through all the rigmarole to be sure we have the right ordering.</em>
+<a class="jxr_linenumber" name="1844" href="#1844">1844</a>         <strong class="jxr_keyword">if</strong> (entry.getEdit().isEmpty()) {
+<a class="jxr_linenumber" name="1845" href="#1845">1845</a>           <strong class="jxr_keyword">return</strong>;
+<a class="jxr_linenumber" name="1846" href="#1846">1846</a>         }
+<a class="jxr_linenumber" name="1847" href="#1847">1847</a> 
+<a class="jxr_linenumber" name="1848" href="#1848">1848</a>         <em class="jxr_comment">// Coprocessor hook.</em>
+<a class="jxr_linenumber" name="1849" href="#1849">1849</a>         <strong class="jxr_keyword">if</strong> (!coprocessorHost.preWALWrite(entry.getHRegionInfo(), entry.getKey(),
+<a class="jxr_linenumber" name="1850" href="#1850">1850</a>             entry.getEdit())) {
+<a class="jxr_linenumber" name="1851" href="#1851">1851</a>           <strong class="jxr_keyword">if</strong> (entry.getEdit().isReplay()) {
+<a class="jxr_linenumber" name="1852" href="#1852">1852</a>             <em class="jxr_comment">// Set replication scope null so that this won't be replicated</em>
+<a class="jxr_linenumber" name="1853" href="#1853">1853</a>             entry.getKey().setScopes(<strong class="jxr_keyword">null</strong>);
+<a class="jxr_linenumber" name="1854" href="#1854">1854</a>           }
+<a class="jxr_linenumber" name="1855" href="#1855">1855</a>         }
+<a class="jxr_linenumber" name="1856" href="#1856">1856</a>         <strong class="jxr_keyword">if</strong> (!listeners.isEmpty()) {
+<a class="jxr_linenumber" name="1857" href="#1857">1857</a>           <strong class="jxr_keyword">for</strong> (WALActionsListener i: listeners) {
+<a class="jxr_linenumber" name="1858" href="#1858">1858</a>             <em class="jxr_comment">// TODO: Why does listener take a table description and CPs take a regioninfo?  Fix.</em>
+<a class="jxr_linenumber" name="1859" href="#1859">1859</a>             i.visitLogEntryBeforeWrite(entry.getHTableDescriptor(), entry.getKey(),
+<a class="jxr_linenumber" name="1860" href="#1860">1860</a>               entry.getEdit());
+<a class="jxr_linenumber" name="1861" href="#1861">1861</a>           }
+<a class="jxr_linenumber" name="1862" href="#1862">1862</a>         }
+<a class="jxr_linenumber" name="1863" href="#1863">1863</a> 
+<a class="jxr_linenumber" name="1864" href="#1864">1864</a>         writer.append(entry);
+<a class="jxr_linenumber" name="1865" href="#1865">1865</a>         assert highestUnsyncedSequence &lt; entry.getSequence();
+<a class="jxr_linenumber" name="1866" href="#1866">1866</a>         highestUnsyncedSequence = entry.getSequence();
+<a class="jxr_linenumber" name="1867" href="#1867">1867</a>         sequenceIdAccounting.update(encodedRegionName, entry.getFamilyNames(), regionSequenceId,
+<a class="jxr_linenumber" name="1868" href="#1868">1868</a>           entry.isInMemstore());
+<a class="jxr_linenumber" name="1869" href="#1869">1869</a>         coprocessorHost.postWALWrite(entry.getHRegionInfo(), entry.getKey(), entry.getEdit());
+<a class="jxr_linenumber" name="1870" href="#1870">1870</a>         <em class="jxr_comment">// Update metrics.</em>
+<a class="jxr_linenumber" name="1871" href="#1871">1871</a>         postAppend(entry, EnvironmentEdgeManager.currentTime() - start);
+<a class="jxr_linenumber" name="1872" href="#1872">1872</a>       } <strong class="jxr_keyword">catch</strong> (Exception e) {
+<a class="jxr_linenumber" name="1873" href="#1873">1873</a>         String msg = <span class="jxr_string">"Append sequenceId="</span> + regionSequenceId + <span class="jxr_string">", requesting roll of WAL"</span>;
+<a class="jxr_linenumber" name="1874" href="#1874">1874</a>         LOG.warn(msg, e);
+<a class="jxr_linenumber" name="1875" href="#1875">1875</a>         requestLogRoll();
+<a class="jxr_linenumber" name="1876" href="#1876">1876</a>         <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/hadoop/hbase/regionserver/wal/DamagedWALException.html">DamagedWALException</a>(msg, e);
+<a class="jxr_linenumber" name="1877" href="#1877">1877</a>       }
+<a class="jxr_linenumber" name="1878" href="#1878">1878</a>       numEntries.incrementAndGet();
+<a class="jxr_linenumber" name="1879" href="#1879">1879</a>     }
+<a class="jxr_linenumber" name="1880" href="#1880">1880</a> 
+<a class="jxr_linenumber" name="1881" href="#1881">1881</a>     @Override
+<a class="jxr_linenumber" name="1882" href="#1882">1882</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> onStart() {
+<a class="jxr_linenumber" name="1883" href="#1883">1883</a>       <strong class="jxr_keyword">for</strong> (SyncRunner syncRunner: <strong class="jxr_keyword">this</strong>.syncRunners) syncRunner.start();
+<a class="jxr_linenumber" name="1884" href="#1884">1884</a>     }
+<a class="jxr_linenumber" name="1885" href="#1885">1885</a> 
+<a class="jxr_linenumber" name="1886" href="#1886">1886</a>     @Override
+<a class="jxr_linenumber" name="1887" href="#1887">1887</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> onShutdown() {
+<a class="jxr_linenumber" name="1888" href="#1888">1888</a>       <strong class="jxr_keyword">for</strong> (SyncRunner syncRunner: <strong class="jxr_keyword">this</strong>.syncRunners) syncRunner.interrupt();
+<a class="jxr_linenumber" name="1889" href="#1889">1889</a>     }
+<a class="jxr_linenumber" name="1890" href="#1890">1890</a>   }
 <a class="jxr_linenumber" name="1891" href="#1891">1891</a> 
-<a class="jxr_linenumber" name="1892" href="#1892">1892</a>     @Override
-<a class="jxr_linenumber" name="1893" href="#1893">1893</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> onShutdown() {
-<a class="jxr_linenumber" name="1894" href="#1894">1894</a>       <strong class="jxr_keyword">for</strong> (SyncRunner syncRunner: <strong class="jxr_keyword">this</strong>.syncRunners) syncRunner.interrupt();
-<a class="jxr_linenumber" name="1895" href="#1895">1895</a>     }
-<a class="jxr_linenumber" name="1896" href="#1896">1896</a>   }
-<a class="jxr_linenumber" name="1897" href="#1897">1897</a> 
-<a class="jxr_linenumber" name="1898" href="#1898">1898</a>   <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="1899" href="#1899">1899</a> <em class="jxr_javadoccomment">   * Exposed for testing only.  Use to tricks like halt the ring buffer appending.</em>
-<a class="jxr_linenumber" name="1900" href="#1900">1900</a> <em class="jxr_javadoccomment">   */</em>
-<a class="jxr_linenumber" name="1901" href="#1901">1901</a>   @VisibleForTesting
-<a class="jxr_linenumber" name="1902" href="#1902">1902</a>   <strong class="jxr_keyword">void</strong> atHeadOfRingBufferEventHandlerAppend() {
-<a class="jxr_linenumber" name="1903" href="#1903">1903</a>     <em class="jxr_comment">// Noop</em>
-<a class="jxr_linenumber" name="1904" href="#1904">1904</a>   }
-<a class="jxr_linenumber" name="1905" href="#1905">1905</a> 
-<a class="jxr_linenumber" name="1906" href="#1906">1906</a>   <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> IOException ensureIOException(<strong class="jxr_keyword">final</strong> Throwable t) {
-<a class="jxr_linenumber" name="1907" href="#1907">1907</a>     <strong class="jxr_keyword">return</strong> (t instanceof IOException)? (IOException)t: <strong class="jxr_keyword">new</strong> IOException(t);
-<a class="jxr_linenumber" name="1908" href="#1908">1908</a>   }
-<a class="jxr_linenumber" name="1909" href="#1909">1909</a> 
-<a class="jxr_linenumber" name="1910" href="#1910">1910</a>   <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">void</strong> usage() {
-<a class="jxr_linenumber" name="1911" href="#1911">1911</a>     System.err.println(<span class="jxr_string">"Usage: FSHLog &lt;ARGS&gt;"</span>);
-<a class="jxr_linenumber" name="1912" href="#1912">1912</a>     System.err.println(<span class="jxr_string">"Arguments:"</span>);
-<a class="jxr_linenumber" name="1913" href="#1913">1913</a>     System.err.println(<span class="jxr_string">" --dump  Dump textual representation of passed one or more files"</span>);
-<a class="jxr_linenumber" name="1914" href="#1914">1914</a>     System.err.println(<span class="jxr_string">"         For example: "</span> +
-<a class="jxr_linenumber" name="1915" href="#1915">1915</a>       <span class="jxr_string">"FSHLog --dump hdfs://example.com:9000/hbase/.logs/MACHINE/LOGFILE"</span>);
-<a class="jxr_linenumber" name="1916" href="#1916">1916</a>     System.err.println(<span class="jxr_string">" --split Split the passed directory of WAL logs"</span>);
-<a class="jxr_linenumber" name="1917" href="#1917">1917</a>     System.err.println(<span class="jxr_string">"         For example: "</span> +
-<a class="jxr_linenumber" name="1918" href="#1918">1918</a>       <span class="jxr_string">"FSHLog --split hdfs://example.com:9000/hbase/.logs/DIR"</span>);
-<a class="jxr_linenumber" name="1919" href="#1919">1919</a>   }
-<a class="jxr_linenumber" name="1920" href="#1920">1920</a> 
-<a class="jxr_linenumber" name="1921" href="#1921">1921</a>   <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="1922" href="#1922">1922</a> <em class="jxr_javadoccomment">   * Pass one or more log file names and it will either dump out a text version</em>
-<a class="jxr_linenumber" name="1923" href="#1923">1923</a> <em class="jxr_javadoccomment">   * on &lt;code&gt;stdout&lt;/code&gt; or split the specified log files.</em>
-<a class="jxr_linenumber" name="1924" href="#1924">1924</a> <em class="jxr_javadoccomment">   *</em>
-<a class="jxr_linenumber" name="1925" href="#1925">1925</a> <em class="jxr_javadoccomment">   * @param args</em>
-<a class="jxr_linenumber" name="1926" href="#1926">1926</a> <em class="jxr_javadoccomment">   * @throws IOException</em>
-<a class="jxr_linenumber" name="1927" href="#1927">1927</a> <em class="jxr_javadoccomment">   */</em>
-<a class="jxr_linenumber" name="1928" href="#1928">1928</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">void</strong> main(String[] args) <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="1929" href="#1929">1929</a>     <strong class="jxr_keyword">if</strong> (args.length &lt; 2) {
-<a class="jxr_linenumber" name="1930" href="#1930">1930</a>       usage();
-<a class="jxr_linenumber" name="1931" href="#1931">1931</a>       System.exit(-1);
-<a class="jxr_linenumber" name="1932" href="#1932">1932</a>     }
-<a class="jxr_linenumber" name="1933" href="#1933">1933</a>     <em class="jxr_comment">// either dump using the WALPrettyPrinter or split, depending on args</em>
-<a class="jxr_linenumber" name="1934" href="#1934">1934</a>     <strong class="jxr_keyword">if</strong> (args[0].compareTo(<span class="jxr_string">"--dump"</span>) == 0) {
-<a class="jxr_linenumber" name="1935" href="#1935">1935</a>       WALPrettyPrinter.run(Arrays.copyOfRange(args, 1, args.length));
-<a class="jxr_linenumber" name="1936" href="#1936">1936</a>     } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (args[0].compareTo(<span class="jxr_string">"--perf"</span>) == 0) {
-<a class="jxr_linenumber" name="1937" href="#1937">1937</a>       LOG.fatal(<span class="jxr_string">"Please use the WALPerformanceEvaluation tool instead. i.e.:"</span>);
-<a class="jxr_linenumber" name="1938" href="#1938">1938</a>       LOG.fatal(<span class="jxr_string">"\thbase org.apache.hadoop.hbase.wal.WALPerformanceEvaluation --iterations "</span> +
-<a class="jxr_linenumber" name="1939" href="#1939">1939</a>           args[1]);
-<a class="jxr_linenumber" name="1940" href="#1940">1940</a>       System.exit(-1);
-<a class="jxr_linenumber" name="1941" href="#1941">1941</a>     } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (args[0].compareTo(<span class="jxr_string">"--split"</span>) == 0) {
-<a class="jxr_linenumber" name="1942" href="#1942">1942</a>       Configuration conf = HBaseConfiguration.create();
-<a class="jxr_linenumber" name="1943" href="#1943">1943</a>       <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 1; i &lt; args.length; i++) {
-<a class="jxr_linenumber" name="1944" href="#1944">1944</a>         <strong class="jxr_keyword">try</strong> {
-<a class="jxr_linenumber" name="1945" href="#1945">1945</a>           Path logPath = <strong class="jxr_keyword">new</strong> Path(args[i]);
-<a class="jxr_linenumber" name="1946" href="#1946">1946</a>           FSUtils.setFsDefault(conf, logPath);
-<a class="jxr_linenumber" name="1947" href="#1947">1947</a>           split(conf, logPath);
-<a class="jxr_linenumber" name="1948" href="#1948">1948</a>         } <strong class="jxr_keyword">catch</strong> (IOException t) {
-<a class="jxr_linenumber" name="1949" href="#1949">1949</a>           t.printStackTrace(System.err);
-<a class="jxr_linenumber" name="1950" href="#1950">1950</a>           System.exit(-1);
-<a class="jxr_linenumber" name="1951" href="#1951">1951</a>         }
-<a class="jxr_linenumber" name="1952" href="#1952">1952</a>       }
-<a class="jxr_linenumber" name="1953" href="#1953">1953</a>     } <strong class="jxr_keyword">else</strong> {
-<a class="jxr_linenumber" name="1954" href="#1954">1954</a>       usage();
-<a class="jxr_linenumber" name="1955" href="#1955">1955</a>       System.exit(-1);
-<a class="jxr_linenumber" name="1956" href="#1956">1956</a>     }
-<a class="jxr_linenumber" name="1957" href="#1957">1957</a>   }
-<a class="jxr_linenumber" name="1958" href="#1958">1958</a> 
-<a class="jxr_linenumber" name="1959" href="#1959">1959</a>   <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="1960" href="#1960">1960</a> <em class="jxr_javadoccomment">   * This method gets the pipeline for the current WAL.</em>
-<a class="jxr_linenumber" name="1961" href="#1961">1961</a> <em class="jxr_javadoccomment">   */</em>
-<a class="jxr_linenumber" name="1962" href="#1962">1962</a>   @VisibleForTesting
-<a class="jxr_linenumber" name="1963" href="#1963">1963</a>   DatanodeInfo[] getPipeLine() {
-<a class="jxr_linenumber" name="1964" href="#1964">1964</a>     <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">this</strong>.hdfs_out != <strong class="jxr_keyword">null</strong>) {
-<a class="jxr_linenumber" name="1965" href="#1965">1965</a>       <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">this</strong>.hdfs_out.getWrappedStream() instanceof DFSOutputStream) {
-<a class="jxr_linenumber" name="1966" href="#1966">1966</a>         <strong class="jxr_keyword">return</strong> ((DFSOutputStream) <strong class="jxr_keyword">this</strong>.hdfs_out.getWrappedStream()).getPipeline();
-<a class="jxr_linenumber" name="1967" href="#1967">1967</a>       }
-<a class="jxr_linenumber" name="1968" href="#1968">1968</a>     }
-<a class="jxr_linenumber" name="1969" href="#1969">1969</a>     <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">new</strong> DatanodeInfo[0];
-<a class="jxr_linenumber" name="1970" href="#1970">1970</a>   }
-<a class="jxr_linenumber" name="1971" href="#1971">1971</a> }
+<a class="jxr_linenumber" name="1892" href="#1892">1892</a>   <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="1893" href="#1893">1893</a> <em class="jxr_javadoccomment">   * Exposed for testing only.  Use to tricks like halt the ring buffer appending.</em>
+<a class="jxr_linenumber" name="1894" href="#1894">1894</a> <em class="jxr_javadoccomment">   */</em>
+<a class="jxr_linenumber" name="1895" href="#1895">1895</a>   @VisibleForTesting
+<a class="jxr_linenumber" name="1896" href="#1896">1896</a>   <strong class="jxr_keyword">void</strong> atHeadOfRingBufferEventHandlerAppend() {
+<a class="jxr_linenumber" name="1897" href="#1897">1897</a>     <em class="jxr_comment">// Noop</em>
+<a class="jxr_linenumber" name="1898" href="#1898">1898</a>   }
+<a class="jxr_linenumber" name="1899" href="#1899">1899</a> 
+<a class="jxr_linenumber" name="1900" href="#1900">1900</a>   <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> IOException ensureIOException(<strong class="jxr_keyword">final</strong> Throwable t) {
+<a class="jxr_linenumber" name="1901" href="#1901">1901</a>     <strong class="jxr_keyword">return</strong> (t instanceof IOException)? (IOException)t: <strong class="jxr_keyword">new</strong> IOException(t);
+<a class="jxr_linenumber" name="1902" href="#1902">1902</a>   }
+<a class="jxr_linenumber" name="1903" href="#1903">1903</a> 
+<a class="jxr_linenumber" name="1904" href="#1904">1904</a>   <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">void</strong> usage() {
+<a class="jxr_linenumber" name="1905" href="#1905">1905</a>     System.err.println(<span class="jxr_string">"Usage: FSHLog &lt;ARGS&gt;"</span>);
+<a class="jxr_linenumber" name="1906" href="#1906">1906</a>     System.err.println(<span class="jxr_string">"Arguments:"</span>);
+<a class="jxr_linenumber" name="1907" href="#1907">1907</a>     System.err.println(<span class="jxr_string">" --dump  Dump textual representation of passed one or more files"</span>);
+<a class="jxr_linenumber" name="1908" href="#1908">1908</a>     System.err.println(<span class="jxr_string">"         For example: "</span> +
+<a class="jxr_linenumber" name="1909" href="#1909">1909</a>       <span class="jxr_string">"FSHLog --dump hdfs://example.com:9000/hbase/.logs/MACHINE/LOGFILE"</span>);
+<a class="jxr_linenumber" name="1910" href="#1910">1910</a>     System.err.println(<span class="jxr_string">" --split Split the passed directory of WAL logs"</span>);
+<a class="jxr_linenumber" name="1911" href="#1911">1911</a>     System.err.println(<span class="jxr_string">"         For example: "</span> +
+<a class="jxr_linenumber" name="1912" href="#1912">1912</a>       <span class="jxr_string">"FSHLog --split hdfs://example.com:9000/hbase/.logs/DIR"</span>);
+<a class="jxr_linenumber" name="1913" href="#1913">1913</a>   }
+<a class="jxr_linenumber" name="1914" href="#1914">1914</a> 
+<a class="jxr_linenumber" name="1915" href="#1915">1915</a>   <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="1916" href="#1916">1916</a> <em class="jxr_javadoccomment">   * Pass one or more log file names and it will either dump out a text version</em>
+<a class="jxr_linenumber" name="1917" href="#1917">1917</a> <em class="jxr_javadoccomment">   * on &lt;code&gt;stdout&lt;/code&gt; or split the specified log files.</em>
+<a class="jxr_linenumber" name="1918" href="#1918">1918</a> <em class="jxr_javadoccomment">   *</em>
+<a class="jxr_linenumber" name="1919" href="#1919">1919</a> <em class="jxr_javadoccomment">   * @param args</em>
+<a class="jxr_linenumber" name="1920" href="#1920">1920</a> <em class="jxr_javadoccomment">   * @throws IOException</em>
+<a class="jxr_linenumber" name="1921" href="#1921">1921</a> <em class="jxr_javadoccomment">   */</em>
+<a class="jxr_linenumber" name="1922" href="#1922">1922</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">void</strong> main(String[] args) <strong class="jxr_keyword">throws</strong> IOException {
+<a class="jxr_linenumber" name="1923" href="#1923">1923</a>     <strong class="jxr_keyword">if</strong> (args.length &lt; 2) {
+<a class="jxr_linenumber" name="1924" href="#1924">1924</a>       usage();
+<a class="jxr_linenumber" name="1925" href="#1925">1925</a>       System.exit(-1);
+<a class="jxr_linenumber" name="1926" href="#1926">1926</a>     }
+<a class="jxr_linenumber" name="1927" href="#1927">1927</a>     <em class="jxr_comment">// either dump using the WALPrettyPrinter or split, depending on args</em>
+<a class="jxr_linenumber" name="1928" href="#1928">1928</a>     <strong class="jxr_keyword">if</strong> (args[0].compareTo(<span class="jxr_string">"--dump"</span>) == 0) {
+<a class="jxr_linenumber" name="1929" href="#1929">1929</a>       WALPrettyPrinter.run(Arrays.copyOfRange(args, 1, args.length));
+<a class="jxr_linenumber" name="1930" href="#1930">1930</a>     } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (args[0].compareTo(<span class="jxr_string">"--perf"</span>) == 0) {
+<a class="jxr_linenumber" name="1931" href="#1931">1931</a>       LOG.fatal(<span class="jxr_string">"Please use the WALPerformanceEvaluation tool instead. i.e.:"</span>);
+<a class="jxr_linenumber" name="1932" href="#1932">1932</a>       LOG.fatal(<span class="jxr_string">"\thbase org.apache.hadoop.hbase.wal.WALPerformanceEvaluation --iterations "</span> +
+<a class="jxr_linenumber" name="1933" href="#1933">1933</a>           args[1]);
+<a class="jxr_linenumber" name="1934" href="#1934">1934</a>       System.exit(-1);
+<a class="jxr_linenumber" name="1935" href="#1935">1935</a>     } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (args[0].compareTo(<span class="jxr_string">"--split"</span>) == 0) {
+<a class="jxr_linenumber" name="1936" href="#1936">1936</a>       Configuration conf = HBaseConfiguration.create();
+<a class="jxr_linenumber" name="1937" href="#1937">1937</a>       <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 1; i &lt; args.length; i++) {
+<a class="jxr_linenumber" name="1938" href="#1938">1938</a>         <strong class="jxr_keyword">try</strong> {
+<a class="jxr_linenumber" name="1939" href="#1939">1939</a>           Path logPath = <strong class="jxr_keyword">new</strong> Path(args[i]);
+<a class="jxr_linenumber" name="1940" href="#1940">1940</a>           FSUtils.setFsDefault(conf, logPath);
+<a class="jxr_linenumber" name="1941" href="#1941">1941</a>           split(conf, logPath);
+<a class="jxr_linenumber" name="1942" href="#1942">1942</a>         } <strong class="jxr_keyword">catch</strong> (IOException t) {
+<a class="jxr_linenumber" name="1943" href="#1943">1943</a>           t.printStackTrace(System.err);
+<a class="jxr_linenumber" name="1944" href="#1944">1944</a>           System.exit(-1);
+<a class="jxr_linenumber" name="1945" href="#1945">1945</a>         }
+<a class="jxr_linenumber" name="1946" href="#1946">1946</a>       }
+<a class="jxr_linenumber" name="1947" href="#1947">1947</a>     } <strong class="jxr_keyword">else</strong> {
+<a class="jxr_linenumber" name="1948" href="#1948">1948</a>       usage();
+<a class="jxr_linenumber" name="1949" href="#1949">1949</a>       System.exit(-1);
+<a class="jxr_linenumber" name="1950" href="#1950">1950</a>     }
+<a class="jxr_linenumber" name="1951" href="#1951">1951</a>   }
+<a class="jxr_linenumber" name="1952" href="#1952">1952</a> 
+<a class="jxr_linenumber" name="1953" href="#1953">1953</a>   <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="1954" href="#1954">1954</a> <em class="jxr_javadoccomment">   * This method gets the pipeline for the current WAL.</em>
+<a class="jxr_linenumber" name="1955" href="#1955">1955</a> <em class="jxr_javadoccomment">   */</em>
+<a class="jxr_linenumber" name="1956" href="#1956">1956</a>   @VisibleForTesting
+<a class="jxr_linenumber" name="1957" href="#1957">1957</a>   DatanodeInfo[] getPipeLine() {
+<a class="jxr_linenumber" name="1958" href="#1958">1958</a>     <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">this</strong>.hdfs_out != <strong class="jxr_keyword">null</strong>) {
+<a class="jxr_linenumber" name="1959" href="#1959">1959</a>       <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">this</strong>.hdfs_out.getWrappedStream() instanceof DFSOutputStream) {
+<a class="jxr_linenumber" name="1960" href="#1960">1960</a>         <strong class="jxr_keyword">return</strong> ((DFSOutputStream) <strong class="jxr_keyword">this</strong>.hdfs_out.getWrappedStream()).getPipeline();
+<a class="jxr_linenumber" name="1961" href="#1961">1961</a>       }
+<a class="jxr_linenumber" name="1962" href="#1962">1962</a>     }
+<a class="jxr_linenumber" name="1963" href="#1963">1963</a>     <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">new</strong> DatanodeInfo[0];
+<a class="jxr_linenumber" name="1964" href="#1964">1964</a>   }
+<a class="jxr_linenumber" name="1965" href="#1965">1965</a> }
 </pre>
 <hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
 </html>


Mime
View raw message