http://git-wip-us.apache.org/repos/asf/hbase-site/blob/c91fafb4/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/CompactingMemStore.html
----------------------------------------------------------------------
diff --git 
a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/CompactingMemStore.html
 
b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/CompactingMemStore.html
index 55e9af2..bf6738e 100644
--- 
a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/CompactingMemStore.html
+++ 
b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/CompactingMemStore.html
@@ -248,388 +248,395 @@
 <span class="sourceLineNo">240</span>    return mss.getDataSize() &gt; 0? mss: 
getActive().getMemStoreSize();<a name="line.240"></a>
 <span class="sourceLineNo">241</span>  }<a name="line.241"></a>
 <span class="sourceLineNo">242</span><a name="line.242"></a>
-<span class="sourceLineNo">243</span>  @Override<a name="line.243"></a>
-<span class="sourceLineNo">244</span>  protected long keySize() {<a 
name="line.244"></a>
-<span class="sourceLineNo">245</span>    // Need to consider dataSize/keySize 
of all segments in pipeline and active<a name="line.245"></a>
-<span class="sourceLineNo">246</span>    long keySize = 
getActive().getDataSize();<a name="line.246"></a>
-<span class="sourceLineNo">247</span>    for (Segment segment : 
this.pipeline.getSegments()) {<a name="line.247"></a>
-<span class="sourceLineNo">248</span>      keySize += segment.getDataSize();<a 
name="line.248"></a>
-<span class="sourceLineNo">249</span>    }<a name="line.249"></a>
-<span class="sourceLineNo">250</span>    return keySize;<a name="line.250"></a>
-<span class="sourceLineNo">251</span>  }<a name="line.251"></a>
-<span class="sourceLineNo">252</span><a name="line.252"></a>
-<span class="sourceLineNo">253</span>  @Override<a name="line.253"></a>
-<span class="sourceLineNo">254</span>  protected long heapSize() {<a 
name="line.254"></a>
-<span class="sourceLineNo">255</span>    // Need to consider heapOverhead of 
all segments in pipeline and active<a name="line.255"></a>
-<span class="sourceLineNo">256</span>    long h = getActive().getHeapSize();<a 
name="line.256"></a>
-<span class="sourceLineNo">257</span>    for (Segment segment : 
this.pipeline.getSegments()) {<a name="line.257"></a>
-<span class="sourceLineNo">258</span>      h += segment.getHeapSize();<a 
name="line.258"></a>
-<span class="sourceLineNo">259</span>    }<a name="line.259"></a>
-<span class="sourceLineNo">260</span>    return h;<a name="line.260"></a>
-<span class="sourceLineNo">261</span>  }<a name="line.261"></a>
-<span class="sourceLineNo">262</span><a name="line.262"></a>
-<span class="sourceLineNo">263</span>  @Override<a name="line.263"></a>
-<span class="sourceLineNo">264</span>  public void 
updateLowestUnflushedSequenceIdInWAL(boolean onlyIfGreater) {<a 
name="line.264"></a>
-<span class="sourceLineNo">265</span>    long minSequenceId = 
pipeline.getMinSequenceId();<a name="line.265"></a>
-<span class="sourceLineNo">266</span>    if(minSequenceId != Long.MAX_VALUE) 
{<a name="line.266"></a>
-<span class="sourceLineNo">267</span>      byte[] encodedRegionName = 
getRegionServices().getRegionInfo().getEncodedNameAsBytes();<a 
name="line.267"></a>
-<span class="sourceLineNo">268</span>      byte[] familyName = 
getFamilyNameInBytes();<a name="line.268"></a>
-<span class="sourceLineNo">269</span>      WAL WAL = 
getRegionServices().getWAL();<a name="line.269"></a>
-<span class="sourceLineNo">270</span>      if (WAL != null) {<a 
name="line.270"></a>
-<span class="sourceLineNo">271</span>        
WAL.updateStore(encodedRegionName, familyName, minSequenceId, onlyIfGreater);<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>   * This message intends to inform the 
MemStore that next coming updates<a name="line.277"></a>
-<span class="sourceLineNo">278</span>   * are going to be part of the 
replaying edits from WAL<a name="line.278"></a>
-<span class="sourceLineNo">279</span>   */<a name="line.279"></a>
-<span class="sourceLineNo">280</span>  @Override<a name="line.280"></a>
-<span class="sourceLineNo">281</span>  public void startReplayingFromWAL() {<a 
name="line.281"></a>
-<span class="sourceLineNo">282</span>    inWalReplay = true;<a 
name="line.282"></a>
+<span class="sourceLineNo">243</span><a name="line.243"></a>
+<span class="sourceLineNo">244</span>  public void 
setInMemoryCompactionCompleted() {<a name="line.244"></a>
+<span class="sourceLineNo">245</span>    
inMemoryCompactionInProgress.set(false);<a name="line.245"></a>
+<span class="sourceLineNo">246</span>  }<a name="line.246"></a>
+<span class="sourceLineNo">247</span><a name="line.247"></a>
+<span class="sourceLineNo">248</span>  protected boolean 
setInMemoryCompactionFlag() {<a name="line.248"></a>
+<span class="sourceLineNo">249</span>    return 
inMemoryCompactionInProgress.compareAndSet(false, true);<a name="line.249"></a>
+<span class="sourceLineNo">250</span>  }<a name="line.250"></a>
+<span class="sourceLineNo">251</span><a name="line.251"></a>
+<span class="sourceLineNo">252</span>  @Override<a name="line.252"></a>
+<span class="sourceLineNo">253</span>  protected long keySize() {<a 
name="line.253"></a>
+<span class="sourceLineNo">254</span>    // Need to consider dataSize/keySize 
of all segments in pipeline and active<a name="line.254"></a>
+<span class="sourceLineNo">255</span>    long keySize = 
getActive().getDataSize();<a name="line.255"></a>
+<span class="sourceLineNo">256</span>    for (Segment segment : 
this.pipeline.getSegments()) {<a name="line.256"></a>
+<span class="sourceLineNo">257</span>      keySize += segment.getDataSize();<a 
name="line.257"></a>
+<span class="sourceLineNo">258</span>    }<a name="line.258"></a>
+<span class="sourceLineNo">259</span>    return keySize;<a name="line.259"></a>
+<span class="sourceLineNo">260</span>  }<a name="line.260"></a>
+<span class="sourceLineNo">261</span><a name="line.261"></a>
+<span class="sourceLineNo">262</span>  @Override<a name="line.262"></a>
+<span class="sourceLineNo">263</span>  protected long heapSize() {<a 
name="line.263"></a>
+<span class="sourceLineNo">264</span>    // Need to consider heapOverhead of 
all segments in pipeline and active<a name="line.264"></a>
+<span class="sourceLineNo">265</span>    long h = getActive().getHeapSize();<a 
name="line.265"></a>
+<span class="sourceLineNo">266</span>    for (Segment segment : 
this.pipeline.getSegments()) {<a name="line.266"></a>
+<span class="sourceLineNo">267</span>      h += segment.getHeapSize();<a 
name="line.267"></a>
+<span class="sourceLineNo">268</span>    }<a name="line.268"></a>
+<span class="sourceLineNo">269</span>    return h;<a name="line.269"></a>
+<span class="sourceLineNo">270</span>  }<a name="line.270"></a>
+<span class="sourceLineNo">271</span><a name="line.271"></a>
+<span class="sourceLineNo">272</span>  @Override<a name="line.272"></a>
+<span class="sourceLineNo">273</span>  public void 
updateLowestUnflushedSequenceIdInWAL(boolean onlyIfGreater) {<a 
name="line.273"></a>
+<span class="sourceLineNo">274</span>    long minSequenceId = 
pipeline.getMinSequenceId();<a name="line.274"></a>
+<span class="sourceLineNo">275</span>    if(minSequenceId != Long.MAX_VALUE) 
{<a name="line.275"></a>
+<span class="sourceLineNo">276</span>      byte[] encodedRegionName = 
getRegionServices().getRegionInfo().getEncodedNameAsBytes();<a 
name="line.276"></a>
+<span class="sourceLineNo">277</span>      byte[] familyName = 
getFamilyNameInBytes();<a name="line.277"></a>
+<span class="sourceLineNo">278</span>      WAL WAL = 
getRegionServices().getWAL();<a name="line.278"></a>
+<span class="sourceLineNo">279</span>      if (WAL != null) {<a 
name="line.279"></a>
+<span class="sourceLineNo">280</span>        
WAL.updateStore(encodedRegionName, familyName, minSequenceId, onlyIfGreater);<a 
name="line.280"></a>
+<span class="sourceLineNo">281</span>      }<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>   * This message intends to inform the 
MemStore that the replaying edits from WAL<a name="line.286"></a>
-<span class="sourceLineNo">287</span>   * are done<a name="line.287"></a>
+<span class="sourceLineNo">286</span>   * This message intends to inform the 
MemStore that next coming updates<a name="line.286"></a>
+<span class="sourceLineNo">287</span>   * are going to be part of the 
replaying edits from WAL<a name="line.287"></a>
 <span class="sourceLineNo">288</span>   */<a name="line.288"></a>
 <span class="sourceLineNo">289</span>  @Override<a name="line.289"></a>
-<span class="sourceLineNo">290</span>  public void stopReplayingFromWAL() {<a 
name="line.290"></a>
-<span class="sourceLineNo">291</span>    inWalReplay = false;<a 
name="line.291"></a>
+<span class="sourceLineNo">290</span>  public void startReplayingFromWAL() {<a 
name="line.290"></a>
+<span class="sourceLineNo">291</span>    inWalReplay = true;<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>  /**<a name="line.294"></a>
-<span class="sourceLineNo">295</span>   * Issue any synchronization and test 
needed before applying the update<a name="line.295"></a>
-<span class="sourceLineNo">296</span>   * For compacting memstore this means 
checking the update can increase the size without<a name="line.296"></a>
-<span class="sourceLineNo">297</span>   * overflow<a name="line.297"></a>
-<span class="sourceLineNo">298</span>   * @param currentActive the segment to 
be updated<a name="line.298"></a>
-<span class="sourceLineNo">299</span>   * @param cell the cell to be added<a 
name="line.299"></a>
-<span class="sourceLineNo">300</span>   * @param memstoreSizing object to 
accumulate region size changes<a name="line.300"></a>
-<span class="sourceLineNo">301</span>   * @return true iff can proceed with 
applying the update<a name="line.301"></a>
-<span class="sourceLineNo">302</span>   */<a name="line.302"></a>
-<span class="sourceLineNo">303</span>  @Override protected boolean 
preUpdate(MutableSegment currentActive, Cell cell,<a name="line.303"></a>
-<span class="sourceLineNo">304</span>      MemStoreSizing memstoreSizing) {<a 
name="line.304"></a>
-<span class="sourceLineNo">305</span>    if(currentActive.sharedLock()) {<a 
name="line.305"></a>
-<span class="sourceLineNo">306</span>      if 
(checkAndAddToActiveSize(currentActive, cell, memstoreSizing)) {<a 
name="line.306"></a>
-<span class="sourceLineNo">307</span>        return true;<a 
name="line.307"></a>
-<span class="sourceLineNo">308</span>      }<a name="line.308"></a>
-<span class="sourceLineNo">309</span>      currentActive.sharedUnlock();<a 
name="line.309"></a>
-<span class="sourceLineNo">310</span>    }<a name="line.310"></a>
-<span class="sourceLineNo">311</span>    return false;<a name="line.311"></a>
-<span class="sourceLineNo">312</span>  }<a name="line.312"></a>
-<span class="sourceLineNo">313</span><a name="line.313"></a>
-<span class="sourceLineNo">314</span>  @Override protected void 
postUpdate(MutableSegment currentActive) {<a name="line.314"></a>
-<span class="sourceLineNo">315</span>    currentActive.sharedUnlock();<a 
name="line.315"></a>
-<span class="sourceLineNo">316</span>  }<a name="line.316"></a>
-<span class="sourceLineNo">317</span><a name="line.317"></a>
-<span class="sourceLineNo">318</span>  @Override protected boolean 
sizeAddedPreOperation() {<a name="line.318"></a>
-<span class="sourceLineNo">319</span>    return true;<a name="line.319"></a>
-<span class="sourceLineNo">320</span>  }<a name="line.320"></a>
-<span class="sourceLineNo">321</span><a name="line.321"></a>
-<span class="sourceLineNo">322</span>  // the getSegments() method is used for 
tests only<a name="line.322"></a>
-<span class="sourceLineNo">323</span>  @VisibleForTesting<a 
name="line.323"></a>
-<span class="sourceLineNo">324</span>  @Override<a name="line.324"></a>
-<span class="sourceLineNo">325</span>  protected List&lt;Segment&gt; 
getSegments() {<a name="line.325"></a>
-<span class="sourceLineNo">326</span>    List&lt;? extends Segment&gt; 
pipelineList = pipeline.getSegments();<a name="line.326"></a>
-<span class="sourceLineNo">327</span>    List&lt;Segment&gt; list = new 
ArrayList&lt;&gt;(pipelineList.size() + 2);<a name="line.327"></a>
-<span class="sourceLineNo">328</span>    list.add(getActive());<a 
name="line.328"></a>
-<span class="sourceLineNo">329</span>    list.addAll(pipelineList);<a 
name="line.329"></a>
-<span class="sourceLineNo">330</span>    
list.addAll(snapshot.getAllSegments());<a name="line.330"></a>
-<span class="sourceLineNo">331</span><a name="line.331"></a>
-<span class="sourceLineNo">332</span>    return list;<a name="line.332"></a>
-<span class="sourceLineNo">333</span>  }<a name="line.333"></a>
-<span class="sourceLineNo">334</span><a name="line.334"></a>
-<span class="sourceLineNo">335</span>  // the following three methods allow to 
manipulate the settings of composite snapshot<a name="line.335"></a>
-<span class="sourceLineNo">336</span>  public void 
setCompositeSnapshot(boolean useCompositeSnapshot) {<a name="line.336"></a>
-<span class="sourceLineNo">337</span>    this.compositeSnapshot = 
useCompositeSnapshot;<a name="line.337"></a>
-<span class="sourceLineNo">338</span>  }<a name="line.338"></a>
-<span class="sourceLineNo">339</span><a name="line.339"></a>
-<span class="sourceLineNo">340</span>  public boolean 
swapCompactedSegments(VersionedSegmentsList versionedList, ImmutableSegment 
result,<a name="line.340"></a>
-<span class="sourceLineNo">341</span>      boolean merge) {<a 
name="line.341"></a>
-<span class="sourceLineNo">342</span>    // last true stands for updating the 
region size<a name="line.342"></a>
-<span class="sourceLineNo">343</span>    return pipeline.swap(versionedList, 
result, !merge, true);<a name="line.343"></a>
-<span class="sourceLineNo">344</span>  }<a name="line.344"></a>
-<span class="sourceLineNo">345</span><a name="line.345"></a>
-<span class="sourceLineNo">346</span>  /**<a name="line.346"></a>
-<span class="sourceLineNo">347</span>   * @param requesterVersion The caller 
must hold the VersionedList of the pipeline<a name="line.347"></a>
-<span class="sourceLineNo">348</span>   *           with version taken 
earlier. This version must be passed as a parameter here.<a name="line.348"></a>
-<span class="sourceLineNo">349</span>   *           The flattening happens 
only if versions match.<a name="line.349"></a>
-<span class="sourceLineNo">350</span>   */<a name="line.350"></a>
-<span class="sourceLineNo">351</span>  public void flattenOneSegment(long 
requesterVersion,  MemStoreCompactionStrategy.Action action) {<a 
name="line.351"></a>
-<span class="sourceLineNo">352</span>    
pipeline.flattenOneSegment(requesterVersion, indexType, action);<a 
name="line.352"></a>
+<span class="sourceLineNo">295</span>   * This message intends to inform the 
MemStore that the replaying edits from WAL<a name="line.295"></a>
+<span class="sourceLineNo">296</span>   * are done<a name="line.296"></a>
+<span class="sourceLineNo">297</span>   */<a name="line.297"></a>
+<span class="sourceLineNo">298</span>  @Override<a name="line.298"></a>
+<span class="sourceLineNo">299</span>  public void stopReplayingFromWAL() {<a 
name="line.299"></a>
+<span class="sourceLineNo">300</span>    inWalReplay = false;<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>   * Issue any synchronization and test 
needed before applying the update<a name="line.304"></a>
+<span class="sourceLineNo">305</span>   * For compacting memstore this means 
checking the update can increase the size without<a name="line.305"></a>
+<span class="sourceLineNo">306</span>   * overflow<a name="line.306"></a>
+<span class="sourceLineNo">307</span>   * @param currentActive the segment to 
be updated<a name="line.307"></a>
+<span class="sourceLineNo">308</span>   * @param cell the cell to be added<a 
name="line.308"></a>
+<span class="sourceLineNo">309</span>   * @param memstoreSizing object to 
accumulate region size changes<a name="line.309"></a>
+<span class="sourceLineNo">310</span>   * @return true iff can proceed with 
applying the update<a name="line.310"></a>
+<span class="sourceLineNo">311</span>   */<a name="line.311"></a>
+<span class="sourceLineNo">312</span>  @Override protected boolean 
preUpdate(MutableSegment currentActive, Cell cell,<a name="line.312"></a>
+<span class="sourceLineNo">313</span>      MemStoreSizing memstoreSizing) {<a 
name="line.313"></a>
+<span class="sourceLineNo">314</span>    if(currentActive.sharedLock()) {<a 
name="line.314"></a>
+<span class="sourceLineNo">315</span>      if 
(checkAndAddToActiveSize(currentActive, cell, memstoreSizing)) {<a 
name="line.315"></a>
+<span class="sourceLineNo">316</span>        return true;<a 
name="line.316"></a>
+<span class="sourceLineNo">317</span>      }<a name="line.317"></a>
+<span class="sourceLineNo">318</span>      currentActive.sharedUnlock();<a 
name="line.318"></a>
+<span class="sourceLineNo">319</span>    }<a name="line.319"></a>
+<span class="sourceLineNo">320</span>    return false;<a name="line.320"></a>
+<span class="sourceLineNo">321</span>  }<a name="line.321"></a>
+<span class="sourceLineNo">322</span><a name="line.322"></a>
+<span class="sourceLineNo">323</span>  @Override protected void 
postUpdate(MutableSegment currentActive) {<a name="line.323"></a>
+<span class="sourceLineNo">324</span>    currentActive.sharedUnlock();<a 
name="line.324"></a>
+<span class="sourceLineNo">325</span>  }<a name="line.325"></a>
+<span class="sourceLineNo">326</span><a name="line.326"></a>
+<span class="sourceLineNo">327</span>  @Override protected boolean 
sizeAddedPreOperation() {<a name="line.327"></a>
+<span class="sourceLineNo">328</span>    return true;<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>  // the getSegments() method is used for 
tests only<a name="line.331"></a>
+<span class="sourceLineNo">332</span>  @VisibleForTesting<a 
name="line.332"></a>
+<span class="sourceLineNo">333</span>  @Override<a name="line.333"></a>
+<span class="sourceLineNo">334</span>  protected List&lt;Segment&gt; 
getSegments() {<a name="line.334"></a>
+<span class="sourceLineNo">335</span>    List&lt;? extends Segment&gt; 
pipelineList = pipeline.getSegments();<a name="line.335"></a>
+<span class="sourceLineNo">336</span>    List&lt;Segment&gt; list = new 
ArrayList&lt;&gt;(pipelineList.size() + 2);<a name="line.336"></a>
+<span class="sourceLineNo">337</span>    list.add(getActive());<a 
name="line.337"></a>
+<span class="sourceLineNo">338</span>    list.addAll(pipelineList);<a 
name="line.338"></a>
+<span class="sourceLineNo">339</span>    
list.addAll(snapshot.getAllSegments());<a name="line.339"></a>
+<span class="sourceLineNo">340</span><a name="line.340"></a>
+<span class="sourceLineNo">341</span>    return list;<a name="line.341"></a>
+<span class="sourceLineNo">342</span>  }<a name="line.342"></a>
+<span class="sourceLineNo">343</span><a name="line.343"></a>
+<span class="sourceLineNo">344</span>  // the following three methods allow to 
manipulate the settings of composite snapshot<a name="line.344"></a>
+<span class="sourceLineNo">345</span>  public void 
setCompositeSnapshot(boolean useCompositeSnapshot) {<a name="line.345"></a>
+<span class="sourceLineNo">346</span>    this.compositeSnapshot = 
useCompositeSnapshot;<a name="line.346"></a>
+<span class="sourceLineNo">347</span>  }<a name="line.347"></a>
+<span class="sourceLineNo">348</span><a name="line.348"></a>
+<span class="sourceLineNo">349</span>  public boolean 
swapCompactedSegments(VersionedSegmentsList versionedList, ImmutableSegment 
result,<a name="line.349"></a>
+<span class="sourceLineNo">350</span>      boolean merge) {<a 
name="line.350"></a>
+<span class="sourceLineNo">351</span>    // last true stands for updating the 
region size<a name="line.351"></a>
+<span class="sourceLineNo">352</span>    return pipeline.swap(versionedList, 
result, !merge, true);<a name="line.352"></a>
 <span class="sourceLineNo">353</span>  }<a name="line.353"></a>
 <span class="sourceLineNo">354</span><a name="line.354"></a>
-<span class="sourceLineNo">355</span>  // setter is used only for 
testability<a name="line.355"></a>
-<span class="sourceLineNo">356</span>  @VisibleForTesting<a 
name="line.356"></a>
-<span class="sourceLineNo">357</span>  void setIndexType(IndexType type) {<a 
name="line.357"></a>
-<span class="sourceLineNo">358</span>    indexType = type;<a 
name="line.358"></a>
-<span class="sourceLineNo">359</span>    // Because this functionality is for 
testing only and tests are setting in-memory flush size<a name="line.359"></a>
-<span class="sourceLineNo">360</span>    // according to their need, there is 
no setting of in-memory flush size, here.<a name="line.360"></a>
-<span class="sourceLineNo">361</span>    // If it is needed, please change 
in-memory flush size explicitly<a name="line.361"></a>
+<span class="sourceLineNo">355</span>  /**<a name="line.355"></a>
+<span class="sourceLineNo">356</span>   * @param requesterVersion The caller 
must hold the VersionedList of the pipeline<a name="line.356"></a>
+<span class="sourceLineNo">357</span>   *           with version taken 
earlier. This version must be passed as a parameter here.<a name="line.357"></a>
+<span class="sourceLineNo">358</span>   *           The flattening happens 
only if versions match.<a name="line.358"></a>
+<span class="sourceLineNo">359</span>   */<a name="line.359"></a>
+<span class="sourceLineNo">360</span>  public void flattenOneSegment(long 
requesterVersion,  MemStoreCompactionStrategy.Action action) {<a 
name="line.360"></a>
+<span class="sourceLineNo">361</span>    
pipeline.flattenOneSegment(requesterVersion, indexType, action);<a 
name="line.361"></a>
 <span class="sourceLineNo">362</span>  }<a name="line.362"></a>
 <span class="sourceLineNo">363</span><a name="line.363"></a>
-<span class="sourceLineNo">364</span>  public IndexType getIndexType() {<a 
name="line.364"></a>
-<span class="sourceLineNo">365</span>    return indexType;<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>  public boolean hasImmutableSegments() 
{<a name="line.368"></a>
-<span class="sourceLineNo">369</span>    return !pipeline.isEmpty();<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>  public VersionedSegmentsList 
getImmutableSegments() {<a name="line.372"></a>
-<span class="sourceLineNo">373</span>    return pipeline.getVersionedList();<a 
name="line.373"></a>
-<span class="sourceLineNo">374</span>  }<a name="line.374"></a>
-<span class="sourceLineNo">375</span><a name="line.375"></a>
-<span class="sourceLineNo">376</span>  public long getSmallestReadPoint() {<a 
name="line.376"></a>
-<span class="sourceLineNo">377</span>    return 
store.getSmallestReadPoint();<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>  public HStore getStore() {<a 
name="line.380"></a>
-<span class="sourceLineNo">381</span>    return store;<a name="line.381"></a>
-<span class="sourceLineNo">382</span>  }<a name="line.382"></a>
-<span class="sourceLineNo">383</span><a name="line.383"></a>
-<span class="sourceLineNo">384</span>  public String getFamilyName() {<a 
name="line.384"></a>
-<span class="sourceLineNo">385</span>    return 
Bytes.toString(getFamilyNameInBytes());<a name="line.385"></a>
-<span class="sourceLineNo">386</span>  }<a name="line.386"></a>
-<span class="sourceLineNo">387</span><a name="line.387"></a>
-<span class="sourceLineNo">388</span>  @Override<a name="line.388"></a>
-<span class="sourceLineNo">389</span>  public List&lt;KeyValueScanner&gt; 
getScanners(long readPt) throws IOException {<a name="line.389"></a>
-<span class="sourceLineNo">390</span>    MutableSegment activeTmp = 
getActive();<a name="line.390"></a>
-<span class="sourceLineNo">391</span>    List&lt;? extends Segment&gt; 
pipelineList = pipeline.getSegments();<a name="line.391"></a>
-<span class="sourceLineNo">392</span>    List&lt;? extends Segment&gt; 
snapshotList = snapshot.getAllSegments();<a name="line.392"></a>
-<span class="sourceLineNo">393</span>    long numberOfSegments = 1L + 
pipelineList.size() + snapshotList.size();<a name="line.393"></a>
-<span class="sourceLineNo">394</span>    // The list of elements in pipeline + 
the active element + the snapshot segment<a name="line.394"></a>
-<span class="sourceLineNo">395</span>    List&lt;KeyValueScanner&gt; list = 
createList((int) numberOfSegments);<a name="line.395"></a>
-<span class="sourceLineNo">396</span>    addToScanners(activeTmp, readPt, 
list);<a name="line.396"></a>
-<span class="sourceLineNo">397</span>    addToScanners(pipelineList, readPt, 
list);<a name="line.397"></a>
-<span class="sourceLineNo">398</span>    addToScanners(snapshotList, readPt, 
list);<a name="line.398"></a>
-<span class="sourceLineNo">399</span>    return list;<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>  @VisibleForTesting<a 
name="line.402"></a>
-<span class="sourceLineNo">403</span>  protected List&lt;KeyValueScanner&gt; 
createList(int capacity) {<a name="line.403"></a>
-<span class="sourceLineNo">404</span>    return new 
ArrayList&lt;&gt;(capacity);<a name="line.404"></a>
-<span class="sourceLineNo">405</span>  }<a name="line.405"></a>
-<span class="sourceLineNo">406</span><a name="line.406"></a>
-<span class="sourceLineNo">407</span>  /**<a name="line.407"></a>
-<span class="sourceLineNo">408</span>   * Check whether anything need to be 
done based on the current active set size.<a name="line.408"></a>
-<span class="sourceLineNo">409</span>   * The method is invoked upon every 
addition to the active set.<a name="line.409"></a>
-<span class="sourceLineNo">410</span>   * For CompactingMemStore, flush the 
active set to the read-only memory if it's<a name="line.410"></a>
-<span class="sourceLineNo">411</span>   * size is above threshold<a 
name="line.411"></a>
-<span class="sourceLineNo">412</span>   * @param currActive intended segment 
to update<a name="line.412"></a>
-<span class="sourceLineNo">413</span>   * @param cellToAdd cell to be added to 
the segment<a name="line.413"></a>
-<span class="sourceLineNo">414</span>   * @param memstoreSizing object to 
accumulate changed size<a name="line.414"></a>
-<span class="sourceLineNo">415</span>   * @return true if the cell can be 
added to the<a name="line.415"></a>
-<span class="sourceLineNo">416</span>   */<a name="line.416"></a>
-<span class="sourceLineNo">417</span>  private boolean 
checkAndAddToActiveSize(MutableSegment currActive, Cell cellToAdd,<a 
name="line.417"></a>
-<span class="sourceLineNo">418</span>      MemStoreSizing memstoreSizing) {<a 
name="line.418"></a>
-<span class="sourceLineNo">419</span>    if (shouldFlushInMemory(currActive, 
cellToAdd, memstoreSizing)) {<a name="line.419"></a>
-<span class="sourceLineNo">420</span>      if 
(currActive.setInMemoryFlushed()) {<a name="line.420"></a>
-<span class="sourceLineNo">421</span>        flushInMemory(currActive);<a 
name="line.421"></a>
-<span class="sourceLineNo">422</span>        if 
(inMemoryCompactionInProgress.compareAndSet(false, true)) {<a 
name="line.422"></a>
-<span class="sourceLineNo">423</span>          // The thread is dispatched to 
do in-memory compaction in the background<a name="line.423"></a>
-<span class="sourceLineNo">424</span>          InMemoryCompactionRunnable 
runnable = new InMemoryCompactionRunnable();<a name="line.424"></a>
-<span class="sourceLineNo">425</span>          if (LOG.isTraceEnabled()) {<a 
name="line.425"></a>
-<span class="sourceLineNo">426</span>            LOG.trace("Dispatching the 
MemStore in-memory flush for store " + store<a name="line.426"></a>
-<span class="sourceLineNo">427</span>                
.getColumnFamilyName());<a name="line.427"></a>
-<span class="sourceLineNo">428</span>          }<a name="line.428"></a>
-<span class="sourceLineNo">429</span>          getPool().execute(runnable);<a 
name="line.429"></a>
-<span class="sourceLineNo">430</span>        }<a name="line.430"></a>
-<span class="sourceLineNo">431</span>      }<a name="line.431"></a>
-<span class="sourceLineNo">432</span>      return false;<a name="line.432"></a>
-<span class="sourceLineNo">433</span>    }<a name="line.433"></a>
-<span class="sourceLineNo">434</span>    return true;<a name="line.434"></a>
-<span class="sourceLineNo">435</span> }<a name="line.435"></a>
-<span class="sourceLineNo">436</span><a name="line.436"></a>
-<span class="sourceLineNo">437</span>  // externally visible only for tests<a 
name="line.437"></a>
-<span class="sourceLineNo">438</span>  // when invoked directly from tests it 
must be verified that the caller doesn't hold updatesLock,<a 
name="line.438"></a>
-<span class="sourceLineNo">439</span>  // otherwise there is a deadlock<a 
name="line.439"></a>
-<span class="sourceLineNo">440</span>  @VisibleForTesting<a 
name="line.440"></a>
-<span class="sourceLineNo">441</span>  void flushInMemory() {<a 
name="line.441"></a>
-<span class="sourceLineNo">442</span>    MutableSegment currActive = 
getActive();<a name="line.442"></a>
-<span class="sourceLineNo">443</span>    if(currActive.setInMemoryFlushed()) 
{<a name="line.443"></a>
-<span class="sourceLineNo">444</span>      flushInMemory(currActive);<a 
name="line.444"></a>
-<span class="sourceLineNo">445</span>    }<a name="line.445"></a>
-<span class="sourceLineNo">446</span>    inMemoryCompaction();<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>  private void 
flushInMemory(MutableSegment currActive) {<a name="line.449"></a>
-<span class="sourceLineNo">450</span>    LOG.trace("IN-MEMORY FLUSH: Pushing 
active segment into compaction pipeline");<a name="line.450"></a>
-<span class="sourceLineNo">451</span>    pushActiveToPipeline(currActive);<a 
name="line.451"></a>
-<span class="sourceLineNo">452</span>  }<a name="line.452"></a>
-<span class="sourceLineNo">453</span><a name="line.453"></a>
-<span class="sourceLineNo">454</span>  void inMemoryCompaction() {<a 
name="line.454"></a>
-<span class="sourceLineNo">455</span>    // setting the 
inMemoryCompactionInProgress flag again for the case this method is invoked<a 
name="line.455"></a>
-<span class="sourceLineNo">456</span>    // directly (only in tests) in the 
common path setting from true to true is idempotent<a name="line.456"></a>
-<span class="sourceLineNo">457</span>    
inMemoryCompactionInProgress.set(true);<a name="line.457"></a>
-<span class="sourceLineNo">458</span>    try {<a name="line.458"></a>
-<span class="sourceLineNo">459</span>      // Used by tests<a 
name="line.459"></a>
-<span class="sourceLineNo">460</span>      if (!allowCompaction.get()) {<a 
name="line.460"></a>
-<span class="sourceLineNo">461</span>        return;<a name="line.461"></a>
-<span class="sourceLineNo">462</span>      }<a name="line.462"></a>
-<span class="sourceLineNo">463</span>      try {<a name="line.463"></a>
-<span class="sourceLineNo">464</span>        // Speculative compaction 
execution, may be interrupted if flush is forced while<a name="line.464"></a>
-<span class="sourceLineNo">465</span>        // compaction is in progress<a 
name="line.465"></a>
-<span class="sourceLineNo">466</span>        compactor.start();<a 
name="line.466"></a>
-<span class="sourceLineNo">467</span>      } catch (IOException e) {<a 
name="line.467"></a>
-<span class="sourceLineNo">468</span>        LOG.warn("Unable to run in-memory 
compaction on {}/{}; exception={}",<a name="line.468"></a>
-<span class="sourceLineNo">469</span>            
getRegionServices().getRegionInfo().getEncodedName(), getFamilyName(), e);<a 
name="line.469"></a>
-<span class="sourceLineNo">470</span>      }<a name="line.470"></a>
-<span class="sourceLineNo">471</span>    } finally {<a name="line.471"></a>
-<span class="sourceLineNo">472</span>      
inMemoryCompactionInProgress.set(false);<a name="line.472"></a>
-<span class="sourceLineNo">473</span>    }<a name="line.473"></a>
-<span class="sourceLineNo">474</span>  }<a name="line.474"></a>
-<span class="sourceLineNo">475</span><a name="line.475"></a>
-<span class="sourceLineNo">476</span>  private Segment getLastSegment() {<a 
name="line.476"></a>
-<span class="sourceLineNo">477</span>    Segment localActive = getActive();<a 
name="line.477"></a>
-<span class="sourceLineNo">478</span>    Segment tail = pipeline.getTail();<a 
name="line.478"></a>
-<span class="sourceLineNo">479</span>    return tail == null ? localActive : 
tail;<a name="line.479"></a>
-<span class="sourceLineNo">480</span>  }<a name="line.480"></a>
-<span class="sourceLineNo">481</span><a name="line.481"></a>
-<span class="sourceLineNo">482</span>  private byte[] getFamilyNameInBytes() 
{<a name="line.482"></a>
-<span class="sourceLineNo">483</span>    return 
store.getColumnFamilyDescriptor().getName();<a name="line.483"></a>
-<span class="sourceLineNo">484</span>  }<a name="line.484"></a>
-<span class="sourceLineNo">485</span><a name="line.485"></a>
-<span class="sourceLineNo">486</span>  private ThreadPoolExecutor getPool() 
{<a name="line.486"></a>
-<span class="sourceLineNo">487</span>    return 
getRegionServices().getInMemoryCompactionPool();<a name="line.487"></a>
-<span class="sourceLineNo">488</span>  }<a name="line.488"></a>
-<span class="sourceLineNo">489</span><a name="line.489"></a>
-<span class="sourceLineNo">490</span>  @VisibleForTesting<a 
name="line.490"></a>
-<span class="sourceLineNo">491</span>  protected boolean 
shouldFlushInMemory(MutableSegment currActive, Cell cellToAdd,<a 
name="line.491"></a>
-<span class="sourceLineNo">492</span>      MemStoreSizing memstoreSizing) {<a 
name="line.492"></a>
-<span class="sourceLineNo">493</span>    long cellSize = 
currActive.getCellLength(cellToAdd);<a name="line.493"></a>
-<span class="sourceLineNo">494</span>    long segmentDataSize = 
currActive.getDataSize();<a name="line.494"></a>
-<span class="sourceLineNo">495</span>    while (segmentDataSize + cellSize 
&lt; inmemoryFlushSize || inWalReplay) {<a name="line.495"></a>
-<span class="sourceLineNo">496</span>      // when replaying edits from WAL 
there is no need in in-memory flush regardless the size<a name="line.496"></a>
-<span class="sourceLineNo">497</span>      // otherwise size below flush 
threshold try to update atomically<a name="line.497"></a>
-<span class="sourceLineNo">498</span>      
if(currActive.compareAndSetDataSize(segmentDataSize, segmentDataSize + 
cellSize)) {<a name="line.498"></a>
-<span class="sourceLineNo">499</span>        if(memstoreSizing != null){<a 
name="line.499"></a>
-<span class="sourceLineNo">500</span>          
memstoreSizing.incMemStoreSize(cellSize, 0, 0);<a name="line.500"></a>
-<span class="sourceLineNo">501</span>        }<a name="line.501"></a>
-<span class="sourceLineNo">502</span>        //enough space for cell - no need 
to flush<a name="line.502"></a>
-<span class="sourceLineNo">503</span>        return false;<a 
name="line.503"></a>
-<span class="sourceLineNo">504</span>      }<a name="line.504"></a>
-<span class="sourceLineNo">505</span>      segmentDataSize = 
currActive.getDataSize();<a name="line.505"></a>
-<span class="sourceLineNo">506</span>    }<a name="line.506"></a>
-<span class="sourceLineNo">507</span>    // size above flush threshold<a 
name="line.507"></a>
-<span class="sourceLineNo">508</span>    return true;<a name="line.508"></a>
-<span class="sourceLineNo">509</span>  }<a name="line.509"></a>
-<span class="sourceLineNo">510</span><a name="line.510"></a>
-<span class="sourceLineNo">511</span>  /**<a name="line.511"></a>
-<span class="sourceLineNo">512</span>   * The request to cancel the compaction 
asynchronous task (caused by in-memory flush)<a name="line.512"></a>
-<span class="sourceLineNo">513</span>   * The compaction may still happen if 
the request was sent too late<a name="line.513"></a>
-<span class="sourceLineNo">514</span>   * Non-blocking request<a 
name="line.514"></a>
-<span class="sourceLineNo">515</span>   */<a name="line.515"></a>
-<span class="sourceLineNo">516</span>  private void stopCompaction() {<a 
name="line.516"></a>
-<span class="sourceLineNo">517</span>    if 
(inMemoryCompactionInProgress.get()) {<a name="line.517"></a>
-<span class="sourceLineNo">518</span>      compactor.stop();<a 
name="line.518"></a>
-<span class="sourceLineNo">519</span>    }<a name="line.519"></a>
-<span class="sourceLineNo">520</span>  }<a name="line.520"></a>
-<span class="sourceLineNo">521</span><a name="line.521"></a>
-<span class="sourceLineNo">522</span>  protected void 
pushActiveToPipeline(MutableSegment currActive) {<a name="line.522"></a>
-<span class="sourceLineNo">523</span>    if (!currActive.isEmpty()) {<a 
name="line.523"></a>
-<span class="sourceLineNo">524</span>      pipeline.pushHead(currActive);<a 
name="line.524"></a>
-<span class="sourceLineNo">525</span>      resetActive();<a 
name="line.525"></a>
+<span class="sourceLineNo">364</span>  // setter is used only for 
testability<a name="line.364"></a>
+<span class="sourceLineNo">365</span>  @VisibleForTesting<a 
name="line.365"></a>
+<span class="sourceLineNo">366</span>  void setIndexType(IndexType type) {<a 
name="line.366"></a>
+<span class="sourceLineNo">367</span>    indexType = type;<a 
name="line.367"></a>
+<span class="sourceLineNo">368</span>    // Because this functionality is for 
testing only and tests are setting in-memory flush size<a name="line.368"></a>
+<span class="sourceLineNo">369</span>    // according to their need, there is 
no setting of in-memory flush size, here.<a name="line.369"></a>
+<span class="sourceLineNo">370</span>    // If it is needed, please change 
in-memory flush size explicitly<a name="line.370"></a>
+<span class="sourceLineNo">371</span>  }<a name="line.371"></a>
+<span class="sourceLineNo">372</span><a name="line.372"></a>
+<span class="sourceLineNo">373</span>  public IndexType getIndexType() {<a 
name="line.373"></a>
+<span class="sourceLineNo">374</span>    return indexType;<a 
name="line.374"></a>
+<span class="sourceLineNo">375</span>  }<a name="line.375"></a>
+<span class="sourceLineNo">376</span><a name="line.376"></a>
+<span class="sourceLineNo">377</span>  public boolean hasImmutableSegments() 
{<a name="line.377"></a>
+<span class="sourceLineNo">378</span>    return !pipeline.isEmpty();<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>  public VersionedSegmentsList 
getImmutableSegments() {<a name="line.381"></a>
+<span class="sourceLineNo">382</span>    return pipeline.getVersionedList();<a 
name="line.382"></a>
+<span class="sourceLineNo">383</span>  }<a name="line.383"></a>
+<span class="sourceLineNo">384</span><a name="line.384"></a>
+<span class="sourceLineNo">385</span>  public long getSmallestReadPoint() {<a 
name="line.385"></a>
+<span class="sourceLineNo">386</span>    return 
store.getSmallestReadPoint();<a name="line.386"></a>
+<span class="sourceLineNo">387</span>  }<a name="line.387"></a>
+<span class="sourceLineNo">388</span><a name="line.388"></a>
+<span class="sourceLineNo">389</span>  public HStore getStore() {<a 
name="line.389"></a>
+<span class="sourceLineNo">390</span>    return store;<a name="line.390"></a>
+<span class="sourceLineNo">391</span>  }<a name="line.391"></a>
+<span class="sourceLineNo">392</span><a name="line.392"></a>
+<span class="sourceLineNo">393</span>  public String getFamilyName() {<a 
name="line.393"></a>
+<span class="sourceLineNo">394</span>    return 
Bytes.toString(getFamilyNameInBytes());<a name="line.394"></a>
+<span class="sourceLineNo">395</span>  }<a name="line.395"></a>
+<span class="sourceLineNo">396</span><a name="line.396"></a>
+<span class="sourceLineNo">397</span>  @Override<a name="line.397"></a>
+<span class="sourceLineNo">398</span>  public List&lt;KeyValueScanner&gt; 
getScanners(long readPt) throws IOException {<a name="line.398"></a>
+<span class="sourceLineNo">399</span>    MutableSegment activeTmp = 
getActive();<a name="line.399"></a>
+<span class="sourceLineNo">400</span>    List&lt;? extends Segment&gt; 
pipelineList = pipeline.getSegments();<a name="line.400"></a>
+<span class="sourceLineNo">401</span>    List&lt;? extends Segment&gt; 
snapshotList = snapshot.getAllSegments();<a name="line.401"></a>
+<span class="sourceLineNo">402</span>    long numberOfSegments = 1L + 
pipelineList.size() + snapshotList.size();<a name="line.402"></a>
+<span class="sourceLineNo">403</span>    // The list of elements in pipeline + 
the active element + the snapshot segment<a name="line.403"></a>
+<span class="sourceLineNo">404</span>    List&lt;KeyValueScanner&gt; list = 
createList((int) numberOfSegments);<a name="line.404"></a>
+<span class="sourceLineNo">405</span>    addToScanners(activeTmp, readPt, 
list);<a name="line.405"></a>
+<span class="sourceLineNo">406</span>    addToScanners(pipelineList, readPt, 
list);<a name="line.406"></a>
+<span class="sourceLineNo">407</span>    addToScanners(snapshotList, readPt, 
list);<a name="line.407"></a>
+<span class="sourceLineNo">408</span>    return list;<a name="line.408"></a>
+<span class="sourceLineNo">409</span>  }<a name="line.409"></a>
+<span class="sourceLineNo">410</span><a name="line.410"></a>
+<span class="sourceLineNo">411</span>  @VisibleForTesting<a 
name="line.411"></a>
+<span class="sourceLineNo">412</span>  protected List&lt;KeyValueScanner&gt; 
createList(int capacity) {<a name="line.412"></a>
+<span class="sourceLineNo">413</span>    return new 
ArrayList&lt;&gt;(capacity);<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>  /**<a name="line.416"></a>
+<span class="sourceLineNo">417</span>   * Check whether anything need to be 
done based on the current active set size.<a name="line.417"></a>
+<span class="sourceLineNo">418</span>   * The method is invoked upon every 
addition to the active set.<a name="line.418"></a>
+<span class="sourceLineNo">419</span>   * For CompactingMemStore, flush the 
active set to the read-only memory if it's<a name="line.419"></a>
+<span class="sourceLineNo">420</span>   * size is above threshold<a 
name="line.420"></a>
+<span class="sourceLineNo">421</span>   * @param currActive intended segment 
to update<a name="line.421"></a>
+<span class="sourceLineNo">422</span>   * @param cellToAdd cell to be added to 
the segment<a name="line.422"></a>
+<span class="sourceLineNo">423</span>   * @param memstoreSizing object to 
accumulate changed size<a name="line.423"></a>
+<span class="sourceLineNo">424</span>   * @return true if the cell can be 
added to the<a name="line.424"></a>
+<span class="sourceLineNo">425</span>   */<a name="line.425"></a>
+<span class="sourceLineNo">426</span>  private boolean 
checkAndAddToActiveSize(MutableSegment currActive, Cell cellToAdd,<a 
name="line.426"></a>
+<span class="sourceLineNo">427</span>      MemStoreSizing memstoreSizing) {<a 
name="line.427"></a>
+<span class="sourceLineNo">428</span>    if (shouldFlushInMemory(currActive, 
cellToAdd, memstoreSizing)) {<a name="line.428"></a>
+<span class="sourceLineNo">429</span>      if 
(currActive.setInMemoryFlushed()) {<a name="line.429"></a>
+<span class="sourceLineNo">430</span>        flushInMemory(currActive);<a 
name="line.430"></a>
+<span class="sourceLineNo">431</span>        if (setInMemoryCompactionFlag()) 
{<a name="line.431"></a>
+<span class="sourceLineNo">432</span>          // The thread is dispatched to 
do in-memory compaction in the background<a name="line.432"></a>
+<span class="sourceLineNo">433</span>          InMemoryCompactionRunnable 
runnable = new InMemoryCompactionRunnable();<a name="line.433"></a>
+<span class="sourceLineNo">434</span>          if (LOG.isTraceEnabled()) {<a 
name="line.434"></a>
+<span class="sourceLineNo">435</span>            LOG.trace("Dispatching the 
MemStore in-memory flush for store " + store<a name="line.435"></a>
+<span class="sourceLineNo">436</span>                
.getColumnFamilyName());<a name="line.436"></a>
+<span class="sourceLineNo">437</span>          }<a name="line.437"></a>
+<span class="sourceLineNo">438</span>          getPool().execute(runnable);<a 
name="line.438"></a>
+<span class="sourceLineNo">439</span>        }<a name="line.439"></a>
+<span class="sourceLineNo">440</span>      }<a name="line.440"></a>
+<span class="sourceLineNo">441</span>      return false;<a name="line.441"></a>
+<span class="sourceLineNo">442</span>    }<a name="line.442"></a>
+<span class="sourceLineNo">443</span>    return true;<a name="line.443"></a>
+<span class="sourceLineNo">444</span> }<a name="line.444"></a>
+<span class="sourceLineNo">445</span><a name="line.445"></a>
+<span class="sourceLineNo">446</span>  // externally visible only for tests<a 
name="line.446"></a>
+<span class="sourceLineNo">447</span>  // when invoked directly from tests it 
must be verified that the caller doesn't hold updatesLock,<a 
name="line.447"></a>
+<span class="sourceLineNo">448</span>  // otherwise there is a deadlock<a 
name="line.448"></a>
+<span class="sourceLineNo">449</span>  @VisibleForTesting<a 
name="line.449"></a>
+<span class="sourceLineNo">450</span>  void flushInMemory() {<a 
name="line.450"></a>
+<span class="sourceLineNo">451</span>    MutableSegment currActive = 
getActive();<a name="line.451"></a>
+<span class="sourceLineNo">452</span>    if(currActive.setInMemoryFlushed()) 
{<a name="line.452"></a>
+<span class="sourceLineNo">453</span>      flushInMemory(currActive);<a 
name="line.453"></a>
+<span class="sourceLineNo">454</span>    }<a name="line.454"></a>
+<span class="sourceLineNo">455</span>    inMemoryCompaction();<a 
name="line.455"></a>
+<span class="sourceLineNo">456</span>  }<a name="line.456"></a>
+<span class="sourceLineNo">457</span><a name="line.457"></a>
+<span class="sourceLineNo">458</span>  private void 
flushInMemory(MutableSegment currActive) {<a name="line.458"></a>
+<span class="sourceLineNo">459</span>    LOG.trace("IN-MEMORY FLUSH: Pushing 
active segment into compaction pipeline");<a name="line.459"></a>
+<span class="sourceLineNo">460</span>    pushActiveToPipeline(currActive);<a 
name="line.460"></a>
+<span class="sourceLineNo">461</span>  }<a name="line.461"></a>
+<span class="sourceLineNo">462</span><a name="line.462"></a>
+<span class="sourceLineNo">463</span>  void inMemoryCompaction() {<a 
name="line.463"></a>
+<span class="sourceLineNo">464</span>    // setting the 
inMemoryCompactionInProgress flag again for the case this method is invoked<a 
name="line.464"></a>
+<span class="sourceLineNo">465</span>    // directly (only in tests) in the 
common path setting from true to true is idempotent<a name="line.465"></a>
+<span class="sourceLineNo">466</span>    
inMemoryCompactionInProgress.set(true);<a name="line.466"></a>
+<span class="sourceLineNo">467</span>    // Used by tests<a 
name="line.467"></a>
+<span class="sourceLineNo">468</span>    if (!allowCompaction.get()) {<a 
name="line.468"></a>
+<span class="sourceLineNo">469</span>      return;<a name="line.469"></a>
+<span class="sourceLineNo">470</span>    }<a name="line.470"></a>
+<span class="sourceLineNo">471</span>    try {<a name="line.471"></a>
+<span class="sourceLineNo">472</span>      // Speculative compaction 
execution, may be interrupted if flush is forced while<a name="line.472"></a>
+<span class="sourceLineNo">473</span>      // compaction is in progress<a 
name="line.473"></a>
+<span class="sourceLineNo">474</span>      if(!compactor.start()) {<a 
name="line.474"></a>
+<span class="sourceLineNo">475</span>        
setInMemoryCompactionCompleted();<a name="line.475"></a>
+<span class="sourceLineNo">476</span>      }<a name="line.476"></a>
+<span class="sourceLineNo">477</span>    } catch (IOException e) {<a 
name="line.477"></a>
+<span class="sourceLineNo">478</span>      LOG.warn("Unable to run in-memory 
compaction on {}/{}; exception={}",<a name="line.478"></a>
+<span class="sourceLineNo">479</span>          
getRegionServices().getRegionInfo().getEncodedName(), getFamilyName(), e);<a 
name="line.479"></a>
+<span class="sourceLineNo">480</span>    }<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>  private Segment getLastSegment() {<a 
name="line.483"></a>
+<span class="sourceLineNo">484</span>    Segment localActive = getActive();<a 
name="line.484"></a>
+<span class="sourceLineNo">485</span>    Segment tail = pipeline.getTail();<a 
name="line.485"></a>
+<span class="sourceLineNo">486</span>    return tail == null ? localActive : 
tail;<a name="line.486"></a>
+<span class="sourceLineNo">487</span>  }<a name="line.487"></a>
+<span class="sourceLineNo">488</span><a name="line.488"></a>
+<span class="sourceLineNo">489</span>  private byte[] getFamilyNameInBytes() 
{<a name="line.489"></a>
+<span class="sourceLineNo">490</span>    return 
store.getColumnFamilyDescriptor().getName();<a name="line.490"></a>
+<span class="sourceLineNo">491</span>  }<a name="line.491"></a>
+<span class="sourceLineNo">492</span><a name="line.492"></a>
+<span class="sourceLineNo">493</span>  private ThreadPoolExecutor getPool() 
{<a name="line.493"></a>
+<span class="sourceLineNo">494</span>    return 
getRegionServices().getInMemoryCompactionPool();<a name="line.494"></a>
+<span class="sourceLineNo">495</span>  }<a name="line.495"></a>
+<span class="sourceLineNo">496</span><a name="line.496"></a>
+<span class="sourceLineNo">497</span>  @VisibleForTesting<a 
name="line.497"></a>
+<span class="sourceLineNo">498</span>  protected boolean 
shouldFlushInMemory(MutableSegment currActive, Cell cellToAdd,<a 
name="line.498"></a>
+<span class="sourceLineNo">499</span>      MemStoreSizing memstoreSizing) {<a 
name="line.499"></a>
+<span class="sourceLineNo">500</span>    long cellSize = 
currActive.getCellLength(cellToAdd);<a name="line.500"></a>
+<span class="sourceLineNo">501</span>    long segmentDataSize = 
currActive.getDataSize();<a name="line.501"></a>
+<span class="sourceLineNo">502</span>    while (segmentDataSize + cellSize 
&lt; inmemoryFlushSize || inWalReplay) {<a name="line.502"></a>
+<span class="sourceLineNo">503</span>      // when replaying edits from WAL 
there is no need in in-memory flush regardless the size<a name="line.503"></a>
+<span class="sourceLineNo">504</span>      // otherwise size below flush 
threshold try to update atomically<a name="line.504"></a>
+<span class="sourceLineNo">505</span>      
if(currActive.compareAndSetDataSize(segmentDataSize, segmentDataSize + 
cellSize)) {<a name="line.505"></a>
+<span class="sourceLineNo">506</span>        if(memstoreSizing != null){<a 
name="line.506"></a>
+<span class="sourceLineNo">507</span>          
memstoreSizing.incMemStoreSize(cellSize, 0, 0);<a name="line.507"></a>
+<span class="sourceLineNo">508</span>        }<a name="line.508"></a>
+<span class="sourceLineNo">509</span>        //enough space for cell - no need 
to flush<a name="line.509"></a>
+<span class="sourceLineNo">510</span>        return false;<a 
name="line.510"></a>
+<span class="sourceLineNo">511</span>      }<a name="line.511"></a>
+<span class="sourceLineNo">512</span>      segmentDataSize = 
currActive.getDataSize();<a name="line.512"></a>
+<span class="sourceLineNo">513</span>    }<a name="line.513"></a>
+<span class="sourceLineNo">514</span>    // size above flush threshold<a 
name="line.514"></a>
+<span class="sourceLineNo">515</span>    return true;<a name="line.515"></a>
+<span class="sourceLineNo">516</span>  }<a name="line.516"></a>
+<span class="sourceLineNo">517</span><a name="line.517"></a>
+<span class="sourceLineNo">518</span>  /**<a name="line.518"></a>
+<span class="sourceLineNo">519</span>   * The request to cancel the compaction 
asynchronous task (caused by in-memory flush)<a name="line.519"></a>
+<span class="sourceLineNo">520</span>   * The compaction may still happen if 
the request was sent too late<a name="line.520"></a>
+<span class="sourceLineNo">521</span>   * Non-blocking request<a 
name="line.521"></a>
+<span class="sourceLineNo">522</span>   */<a name="line.522"></a>
+<span class="sourceLineNo">523</span>  private void stopCompaction() {<a 
name="line.523"></a>
+<span class="sourceLineNo">524</span>    if 
(inMemoryCompactionInProgress.get()) {<a name="line.524"></a>
+<span class="sourceLineNo">525</span>      compactor.stop();<a 
name="line.525"></a>
 <span class="sourceLineNo">526</span>    }<a name="line.526"></a>
 <span class="sourceLineNo">527</span>  }<a name="line.527"></a>
 <span class="sourceLineNo">528</span><a name="line.528"></a>
-<span class="sourceLineNo">529</span>  private void pushTailToSnapshot() {<a 
name="line.529"></a>
-<span class="sourceLineNo">530</span>    VersionedSegmentsList segments = 
pipeline.getVersionedTail();<a name="line.530"></a>
-<span class="sourceLineNo">531</span>    
pushToSnapshot(segments.getStoreSegments());<a name="line.531"></a>
-<span class="sourceLineNo">532</span>    // In Swap: don't close segments 
(they are in snapshot now) and don't update the region size<a 
name="line.532"></a>
-<span class="sourceLineNo">533</span>    pipeline.swap(segments,null,false, 
false);<a name="line.533"></a>
+<span class="sourceLineNo">529</span>  protected void 
pushActiveToPipeline(MutableSegment currActive) {<a name="line.529"></a>
+<span class="sourceLineNo">530</span>    if (!currActive.isEmpty()) {<a 
name="line.530"></a>
+<span class="sourceLineNo">531</span>      pipeline.pushHead(currActive);<a 
name="line.531"></a>
+<span class="sourceLineNo">532</span>      resetActive();<a 
name="line.532"></a>
+<span class="sourceLineNo">533</span>    }<a name="line.533"></a>
 <span class="sourceLineNo">534</span>  }<a name="line.534"></a>
 <span class="sourceLineNo">535</span><a name="line.535"></a>
-<span class="sourceLineNo">536</span>  private void pushPipelineToSnapshot() 
{<a name="line.536"></a>
-<span class="sourceLineNo">537</span>    int iterationsCnt = 0;<a 
name="line.537"></a>
-<span class="sourceLineNo">538</span>    boolean done = false;<a 
name="line.538"></a>
-<span class="sourceLineNo">539</span>    while (!done) {<a name="line.539"></a>
-<span class="sourceLineNo">540</span>      iterationsCnt++;<a 
name="line.540"></a>
-<span class="sourceLineNo">541</span>      VersionedSegmentsList segments = 
pipeline.getVersionedList();<a name="line.541"></a>
-<span class="sourceLineNo">542</span>      
pushToSnapshot(segments.getStoreSegments());<a name="line.542"></a>
-<span class="sourceLineNo">543</span>      // swap can return false in case 
the pipeline was updated by ongoing compaction<a name="line.543"></a>
-<span class="sourceLineNo">544</span>      // and the version increase, the 
chance of it happenning is very low<a name="line.544"></a>
-<span class="sourceLineNo">545</span>      // In Swap: don't close segments 
(they are in snapshot now) and don't update the region size<a 
name="line.545"></a>
-<span class="sourceLineNo">546</span>      done = pipeline.swap(segments, 
null, false, false);<a name="line.546"></a>
-<span class="sourceLineNo">547</span>      if (iterationsCnt&gt;2) {<a 
name="line.547"></a>
-<span class="sourceLineNo">548</span>        // practically it is impossible 
that this loop iterates more than two times<a name="line.548"></a>
-<span class="sourceLineNo">549</span>        // (because the compaction is 
stopped and none restarts it while in snapshot request),<a name="line.549"></a>
-<span class="sourceLineNo">550</span>        // however stopping here for the 
case of the infinite loop causing by any error<a name="line.550"></a>
-<span class="sourceLineNo">551</span>        LOG.warn("Multiple unsuccessful 
attempts to push the compaction pipeline to snapshot," +<a name="line.551"></a>
-<span class="sourceLineNo">552</span>            " while flushing to 
disk.");<a name="line.552"></a>
-<span class="sourceLineNo">553</span>        this.snapshot = 
SegmentFactory.instance().createImmutableSegment(getComparator());<a 
name="line.553"></a>
-<span class="sourceLineNo">554</span>        break;<a name="line.554"></a>
-<span class="sourceLineNo">555</span>      }<a name="line.555"></a>
-<span class="sourceLineNo">556</span>    }<a name="line.556"></a>
-<span class="sourceLineNo">557</span>  }<a name="line.557"></a>
-<span class="sourceLineNo">558</span><a name="line.558"></a>
-<span class="sourceLineNo">559</span>  private void 
pushToSnapshot(List&lt;ImmutableSegment&gt; segments) {<a name="line.559"></a>
-<span class="sourceLineNo">560</span>    if(segments.isEmpty()) return;<a 
name="line.560"></a>
-<span class="sourceLineNo">561</span>    if(segments.size() == 1 &amp;&amp; 
!segments.get(0).isEmpty()) {<a name="line.561"></a>
-<span class="sourceLineNo">562</span>      this.snapshot = segments.get(0);<a 
name="line.562"></a>
-<span class="sourceLineNo">563</span>      return;<a name="line.563"></a>
-<span class="sourceLineNo">564</span>    } else { // create composite 
snapshot<a name="line.564"></a>
-<span class="sourceLineNo">565</span>      this.snapshot =<a 
name="line.565"></a>
-<span class="sourceLineNo">566</span>          
SegmentFactory.instance().createCompositeImmutableSegment(getComparator(), 
segments);<a name="line.566"></a>
-<span class="sourceLineNo">567</span>    }<a name="line.567"></a>
-<span class="sourceLineNo">568</span>  }<a name="line.568"></a>
-<span class="sourceLineNo">569</span><a name="line.569"></a>
-<span class="sourceLineNo">570</span>  private RegionServicesForStores 
getRegionServices() {<a name="line.570"></a>
-<span class="sourceLineNo">571</span>    return regionServices;<a 
name="line.571"></a>
-<span class="sourceLineNo">572</span>  }<a name="line.572"></a>
-<span class="sourceLineNo">573</span><a name="line.573"></a>
-<span class="sourceLineNo">574</span>  /**<a name="line.574"></a>
-<span class="sourceLineNo">575</span>   * The in-memory-flusher thread 
performs the flush asynchronously.<a name="line.575"></a>
-<span class="sourceLineNo">576</span>   * There is at most one thread per 
memstore instance.<a name="line.576"></a>
-<span class="sourceLineNo">577</span>   * It takes the updatesLock 
exclusively, pushes active into the pipeline, releases updatesLock<a 
name="line.577"></a>
-<span class="sourceLineNo">578</span>   * and compacts the pipeline.<a 
name="line.578"></a>
-<span class="sourceLineNo">579</span>   */<a name="line.579"></a>
-<span class="sourceLineNo">580</span>  private class 
InMemoryCompactionRunnable implements Runnable {<a name="line.580"></a>
-<span class="sourceLineNo">581</span>    @Override<a name="line.581"></a>
-<span class="sourceLineNo">582</span>    public void run() {<a 
name="line.582"></a>
-<span class="sourceLineNo">583</span>      inMemoryCompaction();<a 
name="line.583"></a>
-<span class="sourceLineNo">584</span>    }<a name="line.584"></a>
-<span class="sourceLineNo">585</span>  }<a name="line.585"></a>
-<span class="sourceLineNo">586</span><a name="line.586"></a>
-<span class="sourceLineNo">587</span>  @VisibleForTesting<a 
name="line.587"></a>
-<span class="sourceLineNo">588</span>  boolean isMemStoreFlushingInMemory() 
{<a name="line.588"></a>
-<span class="sourceLineNo">589</span>    return 
inMemoryCompactionInProgress.get();<a name="line.589"></a>
-<span class="sourceLineNo">590</span>  }<a name="line.590"></a>
-<span class="sourceLineNo">591</span><a name="line.591"></a>
-<span class="sourceLineNo">592</span>  /**<a name="line.592"></a>
-<span class="sourceLineNo">593</span>   * @param cell Find the row that comes 
after this one.  If null, we return the<a name="line.593"></a>
-<span class="sourceLineNo">594</span>   *             first.<a 
name="line.594"></a>
-<span class="sourceLineNo">595</span>   * @return Next row or null if none 
found.<a name="line.595"></a>
-<span class="sourceLineNo">596</span>   */<a name="line.596"></a>
-<span class="sourceLineNo">597</span>  Cell getNextRow(final Cell cell) {<a 
name="line.597"></a>
-<span class="sourceLineNo">598</span>    Cell lowest = null;<a 
name="line.598"></a>
-<span class="sourceLineNo">599</span>    List&lt;Segment&gt; segments = 
getSegments();<a name="line.599"></a>
-<span class="sourceLineNo">600</span>    for (Segment segment : segments) {<a 
name="line.600"></a>
-<span class="sourceLineNo">601</span>      if (lowest == null) {<a 
name="line.601"></a>
-<span class="sourceLineNo">602</span>        lowest = getNextRow(cell, 
segment.getCellSet());<a name="line.602"></a>
-<span class="sourceLineNo">603</span>      } else {<a name="line.603"></a>
-<span class="sourceLineNo">604</span>        lowest = getLowest(lowest, 
getNextRow(cell, segment.getCellSet()));<a name="line.604"></a>
-<span class="sourceLineNo">605</span>      }<a name="line.605"></a>
-<span class="sourceLineNo">606</span>    }<a name="line.606"></a>
-<span class="sourceLineNo">607</span>    return lowest;<a name="line.607"></a>
-<span class="sourceLineNo">608</span>  }<a name="line.608"></a>
-<span class="sourceLineNo">609</span><a name="line.609"></a>
-<span class="sourceLineNo">610</span>  @VisibleForTesting<a 
name="line.610"></a>
-<span class="sourceLineNo">611</span>  long getInmemoryFlushSize() {<a 
name="line.611"></a>
-<span class="sourceLineNo">612</span>    return inmemoryFlushSize;<a 
name="line.612"></a>
-<span class="sourceLineNo">613</span>  }<a name="line.613"></a>
-<span class="sourceLineNo">614</span><a name="line.614"></a>
-<span class="sourceLineNo">615</span>  // debug method<a name="line.615"></a>
-<span class="sourceLineNo">616</span>  public void debug() {<a 
name="line.616"></a>
-<span class="sourceLineNo">617</span>    String msg = "active size=" + 
getActive().getDataSize();<a name="line.617"></a>
-<span class="sourceLineNo">618</span>    msg += " allow compaction is "+ 
(allowCompaction.get() ? "true" : "false");<a name="line.618"></a>
-<span class="sourceLineNo">619</span>    msg += " inMemoryCompactionInProgress 
is "+ (inMemoryCompactionInProgress.get() ? "true" :<a name="line.619"></a>
-<span class="sourceLineNo">620</span>        "false");<a name="line.620"></a>
-<span class="sourceLineNo">621</span>    LOG.debug(msg);<a name="line.621"></a>
-<span class="sourceLineNo">622</span>  }<a name="line.622"></a>
-<span class="sourceLineNo">623</span><a name="line.623"></a>
-<span class="sourceLineNo">624</span>}<a name="line.624"></a>
+<span class="sourceLineNo">536</span>  private void pushTailToSnapshot() {<a 
name="line.536"></a>
+<span class="sourceLineNo">537</span>    VersionedSegmentsList segments = 
pipeline.getVersionedTail();<a name="line.537"></a>
+<span class="sourceLineNo">538</span>    
pushToSnapshot(segments.getStoreSegments());<a name="line.538"></a>
+<span class="sourceLineNo">539</span>    // In Swap: don't close segments 
(they are in snapshot now) and don't update the region size<a 
name="line.539"></a>
+<span class="sourceLineNo">540</span>    pipeline.swap(segments,null,false, 
false);<a name="line.540"></a>
+<span class="sourceLineNo">541</span>  }<a name="line.541"></a>
+<span class="sourceLineNo">542</span><a name="line.542"></a>
+<span class="sourceLineNo">543</span>  private void pushPipelineToSnapshot() 
{<a name="line.543"></a>
+<span class="sourceLineNo">544</span>    int iterationsCnt = 0;<a 
name="line.544"></a>
+<span class="sourceLineNo">545</span>    boolean done = false;<a 
name="line.545"></a>
+<span class="sourceLineNo">546</span>    while (!done) {<a name="line.546"></a>
+<span class="sourceLineNo">547</span>      iterationsCnt++;<a 
name="line.547"></a>
+<span class="sourceLineNo">548</span>      VersionedSegmentsList segments = 
pipeline.getVersionedList();<a name="line.548"></a>
+<span class="sourceLineNo">549</span>      
pushToSnapshot(segments.getStoreSegments());<a name="line.549"></a>
+<span class="sourceLineNo">550</span>      // swap can return false in case 
the pipeline was updated by ongoing compaction<a name="line.550"></a>
+<span class="sourceLineNo">551</span>      // and the version increase, the 
chance of it happenning is very low<a name="line.551"></a>
+<span class="sourceLineNo">552</span>      // In Swap: don't close segments 
(they are in snapshot now) and don't update the region size<a 
name="line.552"></a>
+<span class="sourceLineNo">553</span>      done = pipeline.swap(segments, 
null, false, false);<a name="line.553"></a>
+<span class="sourceLineNo">554</span>      if (iterationsCnt&gt;2) {<a 
name="line.554"></a>
+<span class="sourceLineNo">555</span>        // practically it is impossible 
that this loop iterates more than two times<a name="line.555"></a>
+<span class="sourceLineNo">556</span>        // (because the compaction is 
stopped and none restarts it while in snapshot request),<a name="line.556"></a>
+<span class="sourceLineNo">557</span>        // however stopping here for the 
case of the infinite loop causing by any error<a name="line.557"></a>
+<span class="sourceLineNo">558</span>        LOG.warn("Multiple unsuccessful 
attempts to push the compaction pipeline to snapshot," +<a name="line.558"></a>
+<span class="sourceLineNo">559</span>            " while flushing to 
disk.");<a name="line.559"></a>
+<span class="sourceLineNo">560</span>        this.snapshot = 
SegmentFactory.instance().createImmutableSegment(getComparator());<a 
name="line.560"></a>
+<span class="sourceLineNo">561</span>        break;<a name="line.561"></a>
+<span class="sourceLineNo">562</span>      }<a name="line.562"></a>
+<span class="sourceLineNo">563</span>    }<a name="line.563"></a>
+<span class="sourceLineNo">564</span>  }<a name="line.564"></a>
+<span class="sourceLineNo">565</span><a name="line.565"></a>
+<span class="sourceLineNo">566</span>  private void 
pushToSnapshot(List&lt;ImmutableSegment&gt; segments) {<a name="line.566"></a>
+<span class="sourceLineNo">567</span>    if(segments.isEmpty()) return;<a 
name="line.567"></a>
+<span class="sourceLineNo">568</span>    if(segments.size() == 1 &amp;&amp; 
!segments.get(0).isEmpty()) {<a name="line.568"></a>
+<span class="sourceLineNo">569</span>      this.snapshot = segments.get(0);<a 
name="line.569"></a>
+<span class="sourceLineNo">570</span>      return;<a name="line.570"></a>
+<span class="sourceLineNo">571</span>    } else { // create composite 
snapshot<a name="line.571"></a>
+<span class="sourceLineNo">572</span>      this.snapshot =<a 
name="line.572"></a>
+<span class="sourceLineNo">573</span>          
SegmentFactory.instance().createCompositeImmutableSegment(getComparator(), 
segments);<a name="line.573"></a>
+<span class="sourceLineNo">574</span>    }<a name="line.574"></a>
+<span class="sourceLineNo">575</span>  }<a name="line.575"></a>
+<span class="sourceLineNo">576</span><a name="line.576"></a>
+<span class="sourceLineNo">577</span>  private RegionServicesForStores 
getRegionServices() {<a name="line.577"></a>
+<span class="sourceLineNo">578</span>    return regionServices;<a 
name="line.578"></a>
+<span class="sourceLineNo">579</span>  }<a name="line.579"></a>
+<span class="sourceLineNo">580</span><a name="line.580"></a>
+<span class="sourceLineNo">581</span>  /**<a name="line.581"></a>
+<span class="sourceLineNo">582</span>   * The in-memory-flusher thread 
performs the flush asynchronously.<a name="line.582"></a>
+<span class="sourceLineNo">583</span>   * There is at most one thread per 
memstore instance.<a name="line.583"></a>
+<span class="sourceLineNo">584</span>   * It takes the updatesLock 
exclusively, pushes active into the pipeline, releases updatesLock<a 
name="line.584"></a>
+<span class="sourceLineNo">585</span>   * and compacts the pipeline.<a 
name="line.585"></a>
+<span class="sourceLineNo">586</span>   */<a name="line.586"></a>
+<span class="sourceLineNo">587</span>  private class 
InMemoryCompactionRunnable implements Runnable {<a name="line.587"></a>
+<span class="sourceLineNo">588</span>    @Override<a name="line.588"></a>
+<span class="sourceLineNo">589</span>    public void run() {<a 
name="line.589"></a>
+<span class="sourceLineNo">590</span>      inMemoryCompaction();<a 
name="line.590"></a>
+<span class="sourceLineNo">591</span>    }<a name="line.591"></a>
+<span class="sourceLineNo">592</span>  }<a name="line.592"></a>
+<span class="sourceLineNo">593</span><a name="line.593"></a>
+<span class="sourceLineNo">594</span>  @VisibleForTesting<a 
name="line.594"></a>
+<span class="sourceLineNo">595</span>  boolean isMemStoreFlushingInMemory() 
{<a name="line.595"></a>
+<span class="sourceLineNo">596</span>    return 
inMemoryCompactionInProgress.get();<a name="line.596"></a>
+<span class="sourceLineNo">597</span>  }<a name="line.597"></a>
+<span class="sourceLineNo">598</span><a name="line.598"></a>
+<span class="sourceLineNo">599</span>  /**<a name="line.599"></a>
+<span class="sourceLineNo">600</span>   * @param cell Find the row that comes 
after this one.  If null, we return the<a name="line.600"></a>
+<span class="sourceLineNo">601</span>   *             first.<a 
name="line.601"></a>
+<span class="sourceLineNo">602</span>   * @return Next row or null if none 
found.<a name="line.602"></a>
+<span class="sourceLineNo">603</span>   */<a name="line.603"></a>
+<span class="sourceLineNo">604</span>  Cell getNextRow(final Cell cell) {<a 
name="line.604"></a>
+<span class="sourceLineNo">605</span>    Cell lowest = null;<a 
name="line.605"></a>
+<span class="sourceLineNo">606</span>    List&lt;Segment&gt; segments = 
getSegments();<a name="line.606"></a>
+<span class="sourceLineNo">607</span>    for (Segment segment : segments) {<a 
name="line.607"></a>
+<span class="sourceLineNo">608</span>      if (lowest == null) {<a 
name="line.608"></a>
+<span class="sourceLineNo">609</span>        lowest = getNextRow(cell, 
segment.getCellSet());<a name="line.609"></a>
+<span class="sourceLineNo">610</span>      } else {<a name="line.610"></a>
+<span class="sourceLineNo">611</span>        lowest = getLowest(lowest, 
getNextRow(cell, segment.getCellSet()));<a name="line.611"></a>
+<span class="sourceLineNo">612</span>      }<a name="line.612"></a>
+<span class="sourceLineNo">613</span>    }<a name="line.613"></a>
+<span class="sourceLineNo">614</span>    return lowest;<a name="line.614"></a>
+<span class="sourceLineNo">615</span>  }<a name="line.615"></a>
+<span class="sourceLineNo">616</span><a name="line.616"></a>
+<span class="sourceLineNo">617</span>  @VisibleForTesting<a 
name="line.617"></a>
+<span class="sourceLineNo">618</span>  long getInmemoryFlushSize() {<a 
name="line.618"></a>
+<span class="sourceLineNo">619</span>    return inmemoryFlushSize;<a 
name="line.619"></a>
+<span class="sourceLineNo">620</span>  }<a name="line.620"></a>
+<span class="sourceLineNo">621</span><a name="line.621"></a>
+<span class="sourceLineNo">622</span>  // debug method<a name="line.622"></a>
+<span class="sourceLineNo">623</span>  public void debug() {<a 
name="line.623"></a>
+<span class="sourceLineNo">624</span>    String msg = "active size=" + 
getActive().getDataSize();<a name="line.624"></a>
+<span class="sourceLineNo">625</span>    msg += " allow compaction is "+ 
(allowCompaction.get() ? "true" : "false");<a name="line.625"></a>
+<span class="sourceLineNo">626</span>    msg += " inMemoryCompactionInProgress 
is "+ (inMemoryCompactionInProgress.get() ? "true" :<a name="line.626"></a>
+<span class="sourceLineNo">627</span>        "false");<a name="line.627"></a>
+<span class="sourceLineNo">628</span>    LOG.debug(msg);<a name="line.628"></a>
+<span class="sourceLineNo">629</span>  }<a name="line.629"></a>
+<span class="sourceLineNo">630</span><a name="line.630"></a>
+<span class="sourceLineNo">631</span>}<a name="line.631"></a>
 
 
 

http://git-wip-us.apache.org/repos/asf/hbase-site/blob/c91fafb4/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/MemStoreCompactor.html
----------------------------------------------------------------------
diff --git 
a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/MemStoreCompactor.html
 
b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/MemStoreCompactor.html
index c48b370..39cbc4e 100644
--- 
a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/MemStoreCompactor.html
+++ 
b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/MemStoreCompactor.html
@@ -155,54 +155,54 @@
 <span class="sourceLineNo">147</span>  private void doCompaction() {<a 
name="line.147"></a>
 <span class="sourceLineNo">148</span>    ImmutableSegment result = null;<a 
name="line.148"></a>
 <span class="sourceLineNo">149</span>    boolean resultSwapped = false;<a 
name="line.149"></a>
-<span class="sourceLineNo">150</span>    if (isInterrupted.get()) {      // if 
the entire process is interrupted cancel flattening<a name="line.150"></a>
-<span class="sourceLineNo">151</span>      return;           // the compaction 
also doesn't start when interrupted<a name="line.151"></a>
-<span class="sourceLineNo">152</span>    }<a name="line.152"></a>
-<span class="sourceLineNo">153</span><a name="line.153"></a>
-<span class="sourceLineNo">154</span>    MemStoreCompactionStrategy.Action 
nextStep = strategy.getAction(versionedList);<a name="line.154"></a>
-<span class="sourceLineNo">155</span>    boolean merge =<a name="line.155"></a>
-<span class="sourceLineNo">156</span>        (nextStep == 
MemStoreCompactionStrategy.Action.MERGE ||<a name="line.156"></a>
-<span class="sourceLineNo">157</span>            nextStep == 
MemStoreCompactionStrategy.Action.MERGE_COUNT_UNIQUE_KEYS);<a 
name="line.157"></a>
-<span class="sourceLineNo">158</span>    try {<a name="line.158"></a>
-<span class="sourceLineNo">159</span>      if (nextStep == 
MemStoreCompactionStrategy.Action.NOOP) {<a name="line.159"></a>
-<span class="sourceLineNo">160</span>        return;<a name="line.160"></a>
-<span class="sourceLineNo">161</span>      }<a name="line.161"></a>
-<span class="sourceLineNo">162</span>      if (nextStep == 
MemStoreCompactionStrategy.Action.FLATTEN ||<a name="line.162"></a>
-<span class="sourceLineNo">163</span>          nextStep == 
MemStoreCompactionStrategy.Action.FLATTEN_COUNT_UNIQUE_KEYS) {<a 
name="line.163"></a>
-<span class="sourceLineNo">164</span>        // some Segment in the pipeline 
is with SkipList index, make it flat<a name="line.164"></a>
-<span class="sourceLineNo">165</span>        
compactingMemStore.flattenOneSegment(versionedList.getVersion(), nextStep);<a 
name="line.165"></a>
-<span class="sourceLineNo">166</span>        return;<a name="line.166"></a>
-<span class="sourceLineNo">167</span>      }<a name="line.167"></a>
-<span class="sourceLineNo">168</span><a name="line.168"></a>
-<span class="sourceLineNo">169</span>      // Create one segment representing 
all segments in the compaction pipeline,<a name="line.169"></a>
-<span class="sourceLineNo">170</span>      // either by compaction or by 
merge<a name="line.170"></a>
-<span class="sourceLineNo">171</span>      if (!isInterrupted.get()) {<a 
name="line.171"></a>
-<span class="sourceLineNo">172</span>        result = 
createSubstitution(nextStep);<a name="line.172"></a>
-<span class="sourceLineNo">173</span>      }<a name="line.173"></a>
-<span class="sourceLineNo">174</span><a name="line.174"></a>
-<span class="sourceLineNo">175</span>      // Substitute the pipeline with one 
segment<a name="line.175"></a>
-<span class="sourceLineNo">176</span>      if (!isInterrupted.get()) {<a 
name="line.176"></a>
-<span class="sourceLineNo">177</span>        resultSwapped = 
compactingMemStore.swapCompactedSegments(versionedList, result, merge);<a 
name="line.177"></a>
-<span class="sourceLineNo">178</span>        if (resultSwapped) {<a 
name="line.178"></a>
-<span class="sourceLineNo">179</span>          // update compaction strategy<a 
name="line.179"></a>
-<span class="sourceLineNo">180</span>          strategy.updateStats(result);<a 
name="line.180"></a>
-<span class="sourceLineNo">181</span>          // update the wal so it can be 
truncated and not get too long<a name="line.181"></a>
-<span class="sourceLineNo">182</span>          
compactingMemStore.updateLowestUnflushedSequenceIdInWAL(true); // only if 
greater<a name="line.182"></a>
-<span class="sourceLineNo">183</span>        }<a name="line.183"></a>
-<span class="sourceLineNo">184</span>      }<a name="line.184"></a>
-<span class="sourceLineNo">185</span>    } catch (IOException e) {<a 
name="line.185"></a>
-<span class="sourceLineNo">186</span>      LOG.trace("Interrupting in-memory 
compaction for store={}",<a name="line.186"></a>
-<span class="sourceLineNo">187</span>          
compactingMemStore.getFamilyName());<a name="line.187"></a>
-<span class="sourceLineNo">188</span>      
Thread.currentThread().interrupt();<a name="line.188"></a>
-<span class="sourceLineNo">189</span>    } finally {<a name="line.189"></a>
-<span class="sourceLineNo">190</span>      // For the MERGE case, if the 
result was created, but swap didn't happen,<a name="line.190"></a>
-<span class="sourceLineNo">191</span>      // we DON'T need to close the 
result segment (meaning its MSLAB)!<a name="line.191"></a>
-<span class="sourceLineNo">192</span>      // Because closing the result 
segment means closing the chunks of all segments<a name="line.192"></a>
-<span class="sourceLineNo">193</span>      // in the compaction pipeline, 
which still have ongoing scans.<a name="line.193"></a>
-<span class="sourceLineNo">194</span>      if (!merge &amp;&amp; (result != 
null) &amp;&amp; !resultSwapped) {<a name="line.194"></a>
-<span class="sourceLineNo">195</span>        result.close();<a 
name="line.195"></a>
-<span class="sourceLineNo">196</span>      }<a name="line.196"></a>
-<span class="sourceLineNo">197</span>      releaseResources();<a 
name="line.197"></a>
+<span class="sourceLineNo">150</span>    MemStoreCompactionStrategy.Action 
nextStep = strategy.getAction(versionedList);<a name="line.150"></a>
+<span class="sourceLineNo">151</span>    boolean merge = (nextStep == 
MemStoreCompactionStrategy.Action.MERGE ||<a name="line.151"></a>
+<span class="sourceLineNo">152</span>        nextStep == 
MemStoreCompactionStrategy.Action.MERGE_COUNT_UNIQUE_KEYS);<a 
name="line.152"></a>
+<span class="sourceLineNo">153</span>    try {<a name="line.153"></a>
+<span class="sourceLineNo">154</span>      if (isInterrupted.get()) {      // 
if the entire process is interrupted cancel flattening<a name="line.154"></a>
+<span class="sourceLineNo">155</span>        return;           // the 
compaction also doesn't start when interrupted<a name="line.155"></a>
+<span class="sourceLineNo">156</span>      }<a name="line.156"></a>
+<span class="sourceLineNo">157</span><a name="line.157"></a>
+<span class="sourceLineNo">158</span>      if (nextStep == 
MemStoreCompactionStrategy.Action.NOOP) {<a name="line.158"></a>
+<span class="sourceLineNo">159</span>        return;<a name="line.159"></a>
+<span class="sourceLineNo">160</span>      }<a name="line.160"></a>
+<span class="sourceLineNo">161</span>      if (nextStep == 
MemStoreCompactionStrategy.Action.FLATTEN<a name="line.161"></a>
+<span class="sourceLineNo">162</span>          || nextStep == 
MemStoreCompactionStrategy.Action.FLATTEN_COUNT_UNIQUE_KEYS) {<a 
name="line.162"></a>
+<span class="sourceLineNo">163</span>        // some Segment in the pipeline 
is with SkipList index, make it flat<a name="line.163"></a>
+<span class="sourceLineNo">164</span>        
compactingMemStore.flattenOneSegment(versionedList.getVersion(), nextStep);<a 
name="line.164"></a>
+<span class="sourceLineNo">165</span>        return;<a name="line.165"></a>
+<span class="sourceLineNo">166</span>      }<a name="line.166"></a>
+<span class="sourceLineNo">167</span><a name="line.167"></a>
+<span class="sourceLineNo">168</span>      // Create one segment representing 
all segments in the compaction pipeline,<a name="line.168"></a>
+<span class="sourceLineNo">169</span>      // either by compaction or by 
merge<a name="line.169"></a>
+<span class="sourceLineNo">170</span>      if (!isInterrupted.get()) {<a 
name="line.170"></a>
+<span class="sourceLineNo">171</span>        result = 
createSubstitution(nextStep);<a name="line.171"></a>
+<span class="sourceLineNo">172</span>      }<a name="line.172"></a>
+<span class="sourceLineNo">173</span><a name="line.173"></a>
+<span class="sourceLineNo">174</span>      // Substitute the pipeline with one 
segment<a name="line.174"></a>
+<span class="sourceLineNo">175</span>      if (!isInterrupted.get()) {<a 
name="line.175"></a>
+<span class="sourceLineNo">176</span>        resultSwapped = 
compactingMemStore.swapCompactedSegments(versionedList, result, merge);<a 
name="line.176"></a>
+<span class="sourceLineNo">177</span>        if (resultSwapped) {<a 
name="line.177"></a>
+<span class="sourceLineNo">178</span>          // update compaction strategy<a 
name="line.178"></a>
+<span class="sourceLineNo">179</span>          strategy.updateStats(result);<a 
name="line.179"></a>
+<span class="sourceLineNo">180</span>          // update the wal so it can be 
truncated and not get too long<a name="line.180"></a>
+<span class="sourceLineNo">181</span>          
compactingMemStore.updateLowestUnflushedSequenceIdInWAL(true); // only if 
greater<a name="line.181"></a>
+<span class="sourceLineNo">182</span>        }<a name="line.182"></a>
+<span class="sourceLineNo">183</span>      }<a name="line.183"></a>
+<span class="sourceLineNo">184</span>    } catch (IOException e) {<a 
name="line.184"></a>
+<span class="sourceLineNo">185</span>      LOG.trace("Interrupting in-memory 
compaction for store={}",<a name="line.185"></a>
+<span class="sourceLineNo">186</span>          
compactingMemStore.getFamilyName());<a name="line.186"></a>
+<span class="sourceLineNo">187</span>      
Thread.currentThread().interrupt();<a name="line.187"></a>
+<span class="sourceLineNo">188</span>    } finally {<a name="line.188"></a>
+<span class="sourceLineNo">189</span>      // For the MERGE case, if the 
result was created, but swap didn't happen,<a name="line.189"></a>
+<span class="sourceLineNo">190</span>      // we DON'T need to close the 
result segment (meaning its MSLAB)!<a name="line.190"></a>
+<span class="sourceLineNo">191</span>      // Because closing the result 
segment means closing the chunks of all segments<a name="line.191"></a>
+<span class="sourceLineNo">192</span>      // in the compaction pipeline, 
which still have ongoing scans.<a name="line.192"></a>
+<span class="sourceLineNo">193</span>      if (!merge &amp;&amp; (result != 
null) &amp;&amp; !resultSwapped) {<a name="line.193"></a>
+<span class="sourceLineNo">194</span>        result.close();<a 
name="line.194"></a>
+<span class="sourceLineNo">195</span>      }<a name="line.195"></a>
+<span class="sourceLineNo">196</span>      releaseResources();<a 
name="line.196"></a>
+<span class="sourceLineNo">197</span>      
compactingMemStore.setInMemoryCompactionCompleted();<a name="line.197"></a>
 <span class="sourceLineNo">198</span>    }<a name="line.198"></a>
 <span class="sourceLineNo">199</span><a name="line.199"></a>
 <span class="sourceLineNo">200</span>  }<a name="line.200"></a>

http://git-wip-us.apache.org/repos/asf/hbase-site/blob/c91fafb4/downloads.html
----------------------------------------------------------------------
diff --git a/downloads.html b/downloads.html
index f09c20d..8823986 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="20180710" />
+    <meta name="Date-Revision-yyyymmdd" content="20180711" />
     <meta http-equiv="Content-Language" content="en" />
     <title>Apache HBase &#x2013; Apache HBase Downloads</title>
     <link rel="stylesheet" href="./css/apache-maven-fluido-1.5-HBASE.min.css" 
/>
@@ -404,7 +404,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-07-10</li>
+                  <li id="publishDate" class="pull-right">Last Published: 
2018-07-11</li>
             </p>
                 </div>
 

http://git-wip-us.apache.org/repos/asf/hbase-site/blob/c91fafb4/export_control.html
----------------------------------------------------------------------
diff --git a/export_control.html b/export_control.html
index 0aecb45..39e6a3f 100644
--- a/export_control.html
+++ b/export_control.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="20180710" />
+    <meta name="Date-Revision-yyyymmdd" content="20180711" />
     <meta http-equiv="Content-Language" content="en" />
     <title>Apache HBase &#x2013; 
       Export Control
@@ -331,7 +331,7 @@ for more details.</p>
                         <a href="https://www.apache.org/";>The Apache Software 
Foundation</a>.
             All rights reserved.      
                     
-                  <li id="publishDate" class="pull-right">Last Published: 
2018-07-10</li>
+                  <li id="publishDate" class="pull-right">Last Published: 
2018-07-11</li>
             </p>
                 </div>
 

http://git-wip-us.apache.org/repos/asf/hbase-site/blob/c91fafb4/index.html
----------------------------------------------------------------------
diff --git a/index.html b/index.html
index 2d47d1c..319393f 100644
--- a/index.html
+++ b/index.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="20180710" />
+    <meta name="Date-Revision-yyyymmdd" content="20180711" />
     <meta http-equiv="Content-Language" content="en" />
     <title>Apache HBase &#x2013; Apache HBase™ Home</title>
     <link rel="stylesheet" href="./css/apache-maven-fluido-1.5-HBASE.min.css" 
/>
@@ -411,7 +411,7 @@ Apache HBase is an open-source, distributed, versioned, 
non-relational database
                         <a href="https://www.apache.org/";>The Apache Software 
Foundation</a>.
             All rights reserved.      
                     
-                  <li id="publishDate" class="pull-right">Last Published: 
2018-07-10</li>
+                  <li id="publishDate" class="pull-right">Last Published: 
2018-07-11</li>
             </p>
                 </div>
 

http://git-wip-us.apache.org/repos/asf/hbase-site/blob/c91fafb4/integration.html
----------------------------------------------------------------------
diff --git a/integration.html b/integration.html
index 133cf7e..fc1a8fb 100644
--- a/integration.html
+++ b/integration.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="20180710" />
+    <meta name="Date-Revision-yyyymmdd" content="20180711" />
     <meta http-equiv="Content-Language" content="en" />
     <title>Apache HBase &#x2013; CI Management</title>
     <link rel="stylesheet" href="./css/apache-maven-fluido-1.5-HBASE.min.css" 
/>
@@ -291,7 +291,7 @@
                         <a href="https://www.apache.org/";>The Apache Software 
Foundation</a>.
             All rights reserved.      
                     
-                  <li id="publishDate" class="pull-right">Last Published: 
2018-07-10</li>
+                  <li id="publishDate" class="pull-right">Last Published: 
2018-07-11</li>
             </p>
                 </div>
 

Reply via email to