hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mi...@apache.org
Subject [03/13] hbase-site git commit: Published site at ef92a6a067230cae96d3e3267da5a18ac5ad89c6.
Date Tue, 15 Dec 2015 16:54:53 GMT
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/4e8775f9/xref/org/apache/hadoop/hbase/regionserver/StoreScanner.html
----------------------------------------------------------------------
diff --git a/xref/org/apache/hadoop/hbase/regionserver/StoreScanner.html b/xref/org/apache/hadoop/hbase/regionserver/StoreScanner.html
index b6bfd3e..c5a9c58 100644
--- a/xref/org/apache/hadoop/hbase/regionserver/StoreScanner.html
+++ b/xref/org/apache/hadoop/hbase/regionserver/StoreScanner.html
@@ -424,498 +424,497 @@
 <a class="jxr_linenumber" name="414" href="#414">414</a> 
 <a class="jxr_linenumber" name="415" href="#415">415</a>   @Override
 <a class="jxr_linenumber" name="416" href="#416">416</a>   <strong class="jxr_keyword">public</strong> <a href="../../../../../org/apache/hadoop/hbase/Cell.html">Cell</a> peek() {
-<a class="jxr_linenumber" name="417" href="#417">417</a>     checkFlushed();
-<a class="jxr_linenumber" name="418" href="#418">418</a>     <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">this</strong>.heap == <strong class="jxr_keyword">null</strong>) {
-<a class="jxr_linenumber" name="419" href="#419">419</a>       <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">this</strong>.lastTop;
-<a class="jxr_linenumber" name="420" href="#420">420</a>     }
-<a class="jxr_linenumber" name="421" href="#421">421</a>     <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">this</strong>.heap.peek();
-<a class="jxr_linenumber" name="422" href="#422">422</a>   }
-<a class="jxr_linenumber" name="423" href="#423">423</a> 
-<a class="jxr_linenumber" name="424" href="#424">424</a>   @Override
-<a class="jxr_linenumber" name="425" href="#425">425</a>   <strong class="jxr_keyword">public</strong> <a href="../../../../../org/apache/hadoop/hbase/KeyValue.html">KeyValue</a> next() {
-<a class="jxr_linenumber" name="426" href="#426">426</a>     <em class="jxr_comment">// throw runtime exception perhaps?</em>
-<a class="jxr_linenumber" name="427" href="#427">427</a>     <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> RuntimeException(<span class="jxr_string">"Never call StoreScanner.next()"</span>);
-<a class="jxr_linenumber" name="428" href="#428">428</a>   }
-<a class="jxr_linenumber" name="429" href="#429">429</a> 
-<a class="jxr_linenumber" name="430" href="#430">430</a>   @Override
-<a class="jxr_linenumber" name="431" href="#431">431</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> close() {
-<a class="jxr_linenumber" name="432" href="#432">432</a>     close(<strong class="jxr_keyword">true</strong>);
-<a class="jxr_linenumber" name="433" href="#433">433</a>   }
-<a class="jxr_linenumber" name="434" href="#434">434</a> 
-<a class="jxr_linenumber" name="435" href="#435">435</a>   <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">void</strong> close(<strong class="jxr_keyword">boolean</strong> withHeapClose) {
-<a class="jxr_linenumber" name="436" href="#436">436</a>     <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">this</strong>.closing) {
-<a class="jxr_linenumber" name="437" href="#437">437</a>       <strong class="jxr_keyword">return</strong>;
-<a class="jxr_linenumber" name="438" href="#438">438</a>     }
-<a class="jxr_linenumber" name="439" href="#439">439</a>     <strong class="jxr_keyword">if</strong> (withHeapClose) <strong class="jxr_keyword">this</strong>.closing = <strong class="jxr_keyword">true</strong>;
-<a class="jxr_linenumber" name="440" href="#440">440</a>     <em class="jxr_comment">// Under test, we dont have a this.store</em>
-<a class="jxr_linenumber" name="441" href="#441">441</a>     <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">this</strong>.store != <strong class="jxr_keyword">null</strong>) <strong class="jxr_keyword">this</strong>.store.deleteChangedReaderObserver(<strong class="jxr_keyword">this</strong>);
-<a class="jxr_linenumber" name="442" href="#442">442</a>     <strong class="jxr_keyword">if</strong> (withHeapClose) {
-<a class="jxr_linenumber" name="443" href="#443">443</a>       <strong class="jxr_keyword">for</strong> (KeyValueHeap h : <strong class="jxr_keyword">this</strong>.heapsForDelayedClose) {
-<a class="jxr_linenumber" name="444" href="#444">444</a>         h.close();
-<a class="jxr_linenumber" name="445" href="#445">445</a>       }
-<a class="jxr_linenumber" name="446" href="#446">446</a>       <strong class="jxr_keyword">this</strong>.heapsForDelayedClose.clear();
-<a class="jxr_linenumber" name="447" href="#447">447</a>       <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">this</strong>.heap != <strong class="jxr_keyword">null</strong>) {
-<a class="jxr_linenumber" name="448" href="#448">448</a>         <strong class="jxr_keyword">this</strong>.heap.close();
-<a class="jxr_linenumber" name="449" href="#449">449</a>         <strong class="jxr_keyword">this</strong>.currentScanners.clear();
-<a class="jxr_linenumber" name="450" href="#450">450</a>         <strong class="jxr_keyword">this</strong>.heap = <strong class="jxr_keyword">null</strong>; <em class="jxr_comment">// CLOSED!</em>
-<a class="jxr_linenumber" name="451" href="#451">451</a>       }
-<a class="jxr_linenumber" name="452" href="#452">452</a>     } <strong class="jxr_keyword">else</strong> {
-<a class="jxr_linenumber" name="453" href="#453">453</a>       <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">this</strong>.heap != <strong class="jxr_keyword">null</strong>) {
-<a class="jxr_linenumber" name="454" href="#454">454</a>         <strong class="jxr_keyword">this</strong>.heapsForDelayedClose.add(<strong class="jxr_keyword">this</strong>.heap);
-<a class="jxr_linenumber" name="455" href="#455">455</a>         <strong class="jxr_keyword">this</strong>.currentScanners.clear();
-<a class="jxr_linenumber" name="456" href="#456">456</a>         <strong class="jxr_keyword">this</strong>.heap = <strong class="jxr_keyword">null</strong>;
-<a class="jxr_linenumber" name="457" href="#457">457</a>       }
-<a class="jxr_linenumber" name="458" href="#458">458</a>     }
-<a class="jxr_linenumber" name="459" href="#459">459</a>     <strong class="jxr_keyword">this</strong>.lastTop = <strong class="jxr_keyword">null</strong>; <em class="jxr_comment">// If both are null, we are closed.</em>
-<a class="jxr_linenumber" name="460" href="#460">460</a>   }
-<a class="jxr_linenumber" name="461" href="#461">461</a> 
-<a class="jxr_linenumber" name="462" href="#462">462</a>   @Override
-<a class="jxr_linenumber" name="463" href="#463">463</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">boolean</strong> seek(<a href="../../../../../org/apache/hadoop/hbase/Cell.html">Cell</a> key) <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="464" href="#464">464</a>     <strong class="jxr_keyword">boolean</strong> flushed = checkFlushed();
-<a class="jxr_linenumber" name="465" href="#465">465</a>     <em class="jxr_comment">// reset matcher state, in case that underlying store changed</em>
-<a class="jxr_linenumber" name="466" href="#466">466</a>     checkReseek(flushed);
-<a class="jxr_linenumber" name="467" href="#467">467</a>     <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">this</strong>.heap.seek(key);
-<a class="jxr_linenumber" name="468" href="#468">468</a>   }
-<a class="jxr_linenumber" name="469" href="#469">469</a> 
-<a class="jxr_linenumber" name="470" href="#470">470</a>   @Override
-<a class="jxr_linenumber" name="471" href="#471">471</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">boolean</strong> next(List&lt;Cell&gt; outResult) <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="472" href="#472">472</a>     <strong class="jxr_keyword">return</strong> next(outResult, NoLimitScannerContext.getInstance());
-<a class="jxr_linenumber" name="473" href="#473">473</a>   }
-<a class="jxr_linenumber" name="474" href="#474">474</a> 
-<a class="jxr_linenumber" name="475" href="#475">475</a>   <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="476" href="#476">476</a> <em class="jxr_javadoccomment">   * Get the next row of values from this Store.</em>
-<a class="jxr_linenumber" name="477" href="#477">477</a> <em class="jxr_javadoccomment">   * @param outResult</em>
-<a class="jxr_linenumber" name="478" href="#478">478</a> <em class="jxr_javadoccomment">   * @param scannerContext</em>
-<a class="jxr_linenumber" name="479" href="#479">479</a> <em class="jxr_javadoccomment">   * @return true if there are more rows, false if scanner is done</em>
-<a class="jxr_linenumber" name="480" href="#480">480</a> <em class="jxr_javadoccomment">   */</em>
-<a class="jxr_linenumber" name="481" href="#481">481</a>   @Override
-<a class="jxr_linenumber" name="482" href="#482">482</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">boolean</strong> next(List&lt;Cell&gt; outResult, <a href="../../../../../org/apache/hadoop/hbase/regionserver/ScannerContext.html">ScannerContext</a> scannerContext) <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="483" href="#483">483</a>     <strong class="jxr_keyword">if</strong> (scannerContext == <strong class="jxr_keyword">null</strong>) {
-<a class="jxr_linenumber" name="484" href="#484">484</a>       <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> IllegalArgumentException(<span class="jxr_string">"Scanner context cannot be null"</span>);
-<a class="jxr_linenumber" name="485" href="#485">485</a>     }
-<a class="jxr_linenumber" name="486" href="#486">486</a>     <strong class="jxr_keyword">boolean</strong> flushed = checkFlushed();
-<a class="jxr_linenumber" name="487" href="#487">487</a>     <strong class="jxr_keyword">if</strong> (checkReseek(flushed)) {
-<a class="jxr_linenumber" name="488" href="#488">488</a>       <strong class="jxr_keyword">return</strong> scannerContext.setScannerState(NextState.MORE_VALUES).hasMoreValues();
-<a class="jxr_linenumber" name="489" href="#489">489</a>     }
-<a class="jxr_linenumber" name="490" href="#490">490</a> 
-<a class="jxr_linenumber" name="491" href="#491">491</a>     <em class="jxr_comment">// if the heap was left null, then the scanners had previously run out anyways, close and</em>
-<a class="jxr_linenumber" name="492" href="#492">492</a>     <em class="jxr_comment">// return.</em>
-<a class="jxr_linenumber" name="493" href="#493">493</a>     <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">this</strong>.heap == <strong class="jxr_keyword">null</strong>) {
-<a class="jxr_linenumber" name="494" href="#494">494</a>       <em class="jxr_comment">// By this time partial close should happened because already heap is null</em>
-<a class="jxr_linenumber" name="495" href="#495">495</a>       close(false);<em class="jxr_comment">// Do all cleanup except heap.close()</em>
-<a class="jxr_linenumber" name="496" href="#496">496</a>       <strong class="jxr_keyword">return</strong> scannerContext.setScannerState(NextState.NO_MORE_VALUES).hasMoreValues();
-<a class="jxr_linenumber" name="497" href="#497">497</a>     }
-<a class="jxr_linenumber" name="498" href="#498">498</a> 
-<a class="jxr_linenumber" name="499" href="#499">499</a>     <a href="../../../../../org/apache/hadoop/hbase/Cell.html">Cell</a> cell = <strong class="jxr_keyword">this</strong>.heap.peek();
-<a class="jxr_linenumber" name="500" href="#500">500</a>     <strong class="jxr_keyword">if</strong> (cell == <strong class="jxr_keyword">null</strong>) {
-<a class="jxr_linenumber" name="501" href="#501">501</a>       close(false);<em class="jxr_comment">// Do all cleanup except heap.close()</em>
-<a class="jxr_linenumber" name="502" href="#502">502</a>       <strong class="jxr_keyword">return</strong> scannerContext.setScannerState(NextState.NO_MORE_VALUES).hasMoreValues();
-<a class="jxr_linenumber" name="503" href="#503">503</a>     }
-<a class="jxr_linenumber" name="504" href="#504">504</a> 
-<a class="jxr_linenumber" name="505" href="#505">505</a>     <em class="jxr_comment">// only call setRow if the row changes; avoids confusing the query matcher</em>
-<a class="jxr_linenumber" name="506" href="#506">506</a>     <em class="jxr_comment">// if scanning intra-row</em>
-<a class="jxr_linenumber" name="507" href="#507">507</a> 
-<a class="jxr_linenumber" name="508" href="#508">508</a>     <em class="jxr_comment">// If no limits exists in the scope LimitScope.Between_Cells then we are sure we are changing</em>
-<a class="jxr_linenumber" name="509" href="#509">509</a>     <em class="jxr_comment">// rows. Else it is possible we are still traversing the same row so we must perform the row</em>
-<a class="jxr_linenumber" name="510" href="#510">510</a>     <em class="jxr_comment">// comparison.</em>
-<a class="jxr_linenumber" name="511" href="#511">511</a>     <strong class="jxr_keyword">if</strong> (!scannerContext.hasAnyLimit(LimitScope.BETWEEN_CELLS) || matcher.curCell == <strong class="jxr_keyword">null</strong>
-<a class="jxr_linenumber" name="512" href="#512">512</a>         || !CellUtil.matchingRow(cell, matcher.curCell)) {
-<a class="jxr_linenumber" name="513" href="#513">513</a>       <strong class="jxr_keyword">this</strong>.countPerRow = 0;
-<a class="jxr_linenumber" name="514" href="#514">514</a>       matcher.setToNewRow(cell);
-<a class="jxr_linenumber" name="515" href="#515">515</a>     }
-<a class="jxr_linenumber" name="516" href="#516">516</a> 
-<a class="jxr_linenumber" name="517" href="#517">517</a>     <em class="jxr_comment">// Clear progress away unless invoker has indicated it should be kept.</em>
-<a class="jxr_linenumber" name="518" href="#518">518</a>     <strong class="jxr_keyword">if</strong> (!scannerContext.getKeepProgress()) scannerContext.clearProgress();
-<a class="jxr_linenumber" name="519" href="#519">519</a> 
-<a class="jxr_linenumber" name="520" href="#520">520</a>     <em class="jxr_comment">// Only do a sanity-check if store and comparator are available.</em>
-<a class="jxr_linenumber" name="521" href="#521">521</a>     <a href="../../../../../org/apache/hadoop/hbase/CellComparator.html">CellComparator</a> comparator = store != <strong class="jxr_keyword">null</strong> ? store.getComparator() : <strong class="jxr_keyword">null</strong>;
-<a class="jxr_linenumber" name="522" href="#522">522</a> 
-<a class="jxr_linenumber" name="523" href="#523">523</a>     <strong class="jxr_keyword">int</strong> count = 0;
-<a class="jxr_linenumber" name="524" href="#524">524</a>     <strong class="jxr_keyword">long</strong> totalBytesRead = 0;
-<a class="jxr_linenumber" name="525" href="#525">525</a> 
-<a class="jxr_linenumber" name="526" href="#526">526</a>     LOOP: <strong class="jxr_keyword">do</strong> {
-<a class="jxr_linenumber" name="527" href="#527">527</a>       <em class="jxr_comment">// Update and check the time limit based on the configured value of cellsPerTimeoutCheck</em>
-<a class="jxr_linenumber" name="528" href="#528">528</a>       <strong class="jxr_keyword">if</strong> ((kvsScanned % cellsPerHeartbeatCheck == 0)) {
-<a class="jxr_linenumber" name="529" href="#529">529</a>         scannerContext.updateTimeProgress();
-<a class="jxr_linenumber" name="530" href="#530">530</a>         <strong class="jxr_keyword">if</strong> (scannerContext.checkTimeLimit(LimitScope.BETWEEN_CELLS)) {
-<a class="jxr_linenumber" name="531" href="#531">531</a>           <strong class="jxr_keyword">return</strong> scannerContext.setScannerState(NextState.TIME_LIMIT_REACHED).hasMoreValues();
-<a class="jxr_linenumber" name="532" href="#532">532</a>         }
-<a class="jxr_linenumber" name="533" href="#533">533</a>       }
-<a class="jxr_linenumber" name="534" href="#534">534</a> 
-<a class="jxr_linenumber" name="535" href="#535">535</a>       <strong class="jxr_keyword">if</strong> (prevCell != cell) ++kvsScanned; <em class="jxr_comment">// Do object compare - we set prevKV from the same heap.</em>
-<a class="jxr_linenumber" name="536" href="#536">536</a>       checkScanOrder(prevCell, cell, comparator);
-<a class="jxr_linenumber" name="537" href="#537">537</a>       prevCell = cell;
-<a class="jxr_linenumber" name="538" href="#538">538</a> 
-<a class="jxr_linenumber" name="539" href="#539">539</a>       ScanQueryMatcher.MatchCode qcode = matcher.match(cell);
-<a class="jxr_linenumber" name="540" href="#540">540</a>       qcode = optimize(qcode, cell);
-<a class="jxr_linenumber" name="541" href="#541">541</a>       <strong class="jxr_keyword">switch</strong> (qcode) {
-<a class="jxr_linenumber" name="542" href="#542">542</a>       <strong class="jxr_keyword">case</strong> INCLUDE:
-<a class="jxr_linenumber" name="543" href="#543">543</a>       <strong class="jxr_keyword">case</strong> INCLUDE_AND_SEEK_NEXT_ROW:
-<a class="jxr_linenumber" name="544" href="#544">544</a>       <strong class="jxr_keyword">case</strong> INCLUDE_AND_SEEK_NEXT_COL:
-<a class="jxr_linenumber" name="545" href="#545">545</a> 
-<a class="jxr_linenumber" name="546" href="#546">546</a>         <a href="../../../../../org/apache/hadoop/hbase/filter/Filter.html">Filter</a> f = matcher.getFilter();
-<a class="jxr_linenumber" name="547" href="#547">547</a>         <strong class="jxr_keyword">if</strong> (f != <strong class="jxr_keyword">null</strong>) {
-<a class="jxr_linenumber" name="548" href="#548">548</a>           cell = f.transformCell(cell);
-<a class="jxr_linenumber" name="549" href="#549">549</a>         }
-<a class="jxr_linenumber" name="550" href="#550">550</a> 
-<a class="jxr_linenumber" name="551" href="#551">551</a>         <strong class="jxr_keyword">this</strong>.countPerRow++;
-<a class="jxr_linenumber" name="552" href="#552">552</a>         <strong class="jxr_keyword">if</strong> (storeLimit &gt; -1 &amp;&amp; <strong class="jxr_keyword">this</strong>.countPerRow &gt; (storeLimit + storeOffset)) {
-<a class="jxr_linenumber" name="553" href="#553">553</a>           <em class="jxr_comment">// do what SEEK_NEXT_ROW does.</em>
-<a class="jxr_linenumber" name="554" href="#554">554</a>           <strong class="jxr_keyword">if</strong> (!matcher.moreRowsMayExistAfter(cell)) {
-<a class="jxr_linenumber" name="555" href="#555">555</a>             <strong class="jxr_keyword">return</strong> scannerContext.setScannerState(NextState.NO_MORE_VALUES).hasMoreValues();
-<a class="jxr_linenumber" name="556" href="#556">556</a>           }
-<a class="jxr_linenumber" name="557" href="#557">557</a>           seekToNextRow(cell);
-<a class="jxr_linenumber" name="558" href="#558">558</a>           <strong class="jxr_keyword">break</strong> LOOP;
-<a class="jxr_linenumber" name="559" href="#559">559</a>         }
-<a class="jxr_linenumber" name="560" href="#560">560</a> 
-<a class="jxr_linenumber" name="561" href="#561">561</a>         <em class="jxr_comment">// add to results only if we have skipped #storeOffset kvs</em>
-<a class="jxr_linenumber" name="562" href="#562">562</a>         <em class="jxr_comment">// also update metric accordingly</em>
-<a class="jxr_linenumber" name="563" href="#563">563</a>         <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">this</strong>.countPerRow &gt; storeOffset) {
-<a class="jxr_linenumber" name="564" href="#564">564</a>           outResult.add(cell);
-<a class="jxr_linenumber" name="565" href="#565">565</a> 
-<a class="jxr_linenumber" name="566" href="#566">566</a>           <em class="jxr_comment">// Update local tracking information</em>
-<a class="jxr_linenumber" name="567" href="#567">567</a>           count++;
-<a class="jxr_linenumber" name="568" href="#568">568</a>           totalBytesRead += CellUtil.estimatedSerializedSizeOf(cell);
-<a class="jxr_linenumber" name="569" href="#569">569</a> 
-<a class="jxr_linenumber" name="570" href="#570">570</a>           <em class="jxr_comment">// Update the progress of the scanner context</em>
-<a class="jxr_linenumber" name="571" href="#571">571</a>           scannerContext.incrementSizeProgress(CellUtil.estimatedHeapSizeOf(cell));
-<a class="jxr_linenumber" name="572" href="#572">572</a>           scannerContext.incrementBatchProgress(1);
-<a class="jxr_linenumber" name="573" href="#573">573</a> 
-<a class="jxr_linenumber" name="574" href="#574">574</a>           <strong class="jxr_keyword">if</strong> (totalBytesRead &gt; maxRowSize) {
-<a class="jxr_linenumber" name="575" href="#575">575</a>             <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/hadoop/hbase/client/RowTooBigException.html">RowTooBigException</a>(
-<a class="jxr_linenumber" name="576" href="#576">576</a>                 <span class="jxr_string">"Max row size allowed: "</span> + maxRowSize + <span class="jxr_string">", but the row is bigger than that."</span>);
-<a class="jxr_linenumber" name="577" href="#577">577</a>           }
-<a class="jxr_linenumber" name="578" href="#578">578</a>         }
-<a class="jxr_linenumber" name="579" href="#579">579</a> 
-<a class="jxr_linenumber" name="580" href="#580">580</a>         <strong class="jxr_keyword">if</strong> (qcode == ScanQueryMatcher.MatchCode.INCLUDE_AND_SEEK_NEXT_ROW) {
-<a class="jxr_linenumber" name="581" href="#581">581</a>           <strong class="jxr_keyword">if</strong> (!matcher.moreRowsMayExistAfter(cell)) {
-<a class="jxr_linenumber" name="582" href="#582">582</a>             <strong class="jxr_keyword">return</strong> scannerContext.setScannerState(NextState.NO_MORE_VALUES).hasMoreValues();
-<a class="jxr_linenumber" name="583" href="#583">583</a>           }
-<a class="jxr_linenumber" name="584" href="#584">584</a>           seekToNextRow(cell);
-<a class="jxr_linenumber" name="585" href="#585">585</a>         } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (qcode == ScanQueryMatcher.MatchCode.INCLUDE_AND_SEEK_NEXT_COL) {
-<a class="jxr_linenumber" name="586" href="#586">586</a>           seekAsDirection(matcher.getKeyForNextColumn(cell));
-<a class="jxr_linenumber" name="587" href="#587">587</a>         } <strong class="jxr_keyword">else</strong> {
-<a class="jxr_linenumber" name="588" href="#588">588</a>           <strong class="jxr_keyword">this</strong>.heap.next();
-<a class="jxr_linenumber" name="589" href="#589">589</a>         }
-<a class="jxr_linenumber" name="590" href="#590">590</a> 
-<a class="jxr_linenumber" name="591" href="#591">591</a>         <strong class="jxr_keyword">if</strong> (scannerContext.checkBatchLimit(LimitScope.BETWEEN_CELLS)) {
-<a class="jxr_linenumber" name="592" href="#592">592</a>           <strong class="jxr_keyword">break</strong> LOOP;
-<a class="jxr_linenumber" name="593" href="#593">593</a>         }
-<a class="jxr_linenumber" name="594" href="#594">594</a>         <strong class="jxr_keyword">if</strong> (scannerContext.checkSizeLimit(LimitScope.BETWEEN_CELLS)) {
-<a class="jxr_linenumber" name="595" href="#595">595</a>           <strong class="jxr_keyword">break</strong> LOOP;
-<a class="jxr_linenumber" name="596" href="#596">596</a>         }
-<a class="jxr_linenumber" name="597" href="#597">597</a>         <strong class="jxr_keyword">continue</strong>;
-<a class="jxr_linenumber" name="598" href="#598">598</a> 
-<a class="jxr_linenumber" name="599" href="#599">599</a>       <strong class="jxr_keyword">case</strong> DONE:
-<a class="jxr_linenumber" name="600" href="#600">600</a>         <strong class="jxr_keyword">return</strong> scannerContext.setScannerState(NextState.MORE_VALUES).hasMoreValues();
-<a class="jxr_linenumber" name="601" href="#601">601</a> 
-<a class="jxr_linenumber" name="602" href="#602">602</a>       <strong class="jxr_keyword">case</strong> DONE_SCAN:
-<a class="jxr_linenumber" name="603" href="#603">603</a>         close(false);<em class="jxr_comment">// Do all cleanup except heap.close()</em>
-<a class="jxr_linenumber" name="604" href="#604">604</a>         <strong class="jxr_keyword">return</strong> scannerContext.setScannerState(NextState.NO_MORE_VALUES).hasMoreValues();
-<a class="jxr_linenumber" name="605" href="#605">605</a> 
-<a class="jxr_linenumber" name="606" href="#606">606</a>       <strong class="jxr_keyword">case</strong> SEEK_NEXT_ROW:
-<a class="jxr_linenumber" name="607" href="#607">607</a>         <em class="jxr_comment">// This is just a relatively simple end of scan fix, to short-cut end</em>
-<a class="jxr_linenumber" name="608" href="#608">608</a>         <em class="jxr_comment">// us if there is an endKey in the scan.</em>
-<a class="jxr_linenumber" name="609" href="#609">609</a>         <strong class="jxr_keyword">if</strong> (!matcher.moreRowsMayExistAfter(cell)) {
-<a class="jxr_linenumber" name="610" href="#610">610</a>           <strong class="jxr_keyword">return</strong> scannerContext.setScannerState(NextState.NO_MORE_VALUES).hasMoreValues();
-<a class="jxr_linenumber" name="611" href="#611">611</a>         }
-<a class="jxr_linenumber" name="612" href="#612">612</a> 
-<a class="jxr_linenumber" name="613" href="#613">613</a>         seekToNextRow(cell);
-<a class="jxr_linenumber" name="614" href="#614">614</a>         <strong class="jxr_keyword">break</strong>;
-<a class="jxr_linenumber" name="615" href="#615">615</a> 
-<a class="jxr_linenumber" name="616" href="#616">616</a>       <strong class="jxr_keyword">case</strong> SEEK_NEXT_COL:
-<a class="jxr_linenumber" name="617" href="#617">617</a>         seekAsDirection(matcher.getKeyForNextColumn(cell));
-<a class="jxr_linenumber" name="618" href="#618">618</a>         <strong class="jxr_keyword">break</strong>;
-<a class="jxr_linenumber" name="619" href="#619">619</a> 
-<a class="jxr_linenumber" name="620" href="#620">620</a>       <strong class="jxr_keyword">case</strong> SKIP:
-<a class="jxr_linenumber" name="621" href="#621">621</a>         <strong class="jxr_keyword">this</strong>.heap.next();
-<a class="jxr_linenumber" name="622" href="#622">622</a>         <strong class="jxr_keyword">break</strong>;
-<a class="jxr_linenumber" name="623" href="#623">623</a> 
-<a class="jxr_linenumber" name="624" href="#624">624</a>       <strong class="jxr_keyword">case</strong> SEEK_NEXT_USING_HINT:
-<a class="jxr_linenumber" name="625" href="#625">625</a>         <a href="../../../../../org/apache/hadoop/hbase/Cell.html">Cell</a> nextKV = matcher.getNextKeyHint(cell);
-<a class="jxr_linenumber" name="626" href="#626">626</a>         <strong class="jxr_keyword">if</strong> (nextKV != <strong class="jxr_keyword">null</strong>) {
-<a class="jxr_linenumber" name="627" href="#627">627</a>           seekAsDirection(nextKV);
-<a class="jxr_linenumber" name="628" href="#628">628</a>         } <strong class="jxr_keyword">else</strong> {
-<a class="jxr_linenumber" name="629" href="#629">629</a>           heap.next();
-<a class="jxr_linenumber" name="630" href="#630">630</a>         }
-<a class="jxr_linenumber" name="631" href="#631">631</a>         <strong class="jxr_keyword">break</strong>;
-<a class="jxr_linenumber" name="632" href="#632">632</a> 
-<a class="jxr_linenumber" name="633" href="#633">633</a>       <strong class="jxr_keyword">default</strong>:
-<a class="jxr_linenumber" name="634" href="#634">634</a>         <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> RuntimeException(<span class="jxr_string">"UNEXPECTED"</span>);
-<a class="jxr_linenumber" name="635" href="#635">635</a>       }
-<a class="jxr_linenumber" name="636" href="#636">636</a>     } <strong class="jxr_keyword">while</strong> ((cell = <strong class="jxr_keyword">this</strong>.heap.peek()) != <strong class="jxr_keyword">null</strong>);
-<a class="jxr_linenumber" name="637" href="#637">637</a> 
-<a class="jxr_linenumber" name="638" href="#638">638</a>     <strong class="jxr_keyword">if</strong> (count &gt; 0) {
-<a class="jxr_linenumber" name="639" href="#639">639</a>       <strong class="jxr_keyword">return</strong> scannerContext.setScannerState(NextState.MORE_VALUES).hasMoreValues();
-<a class="jxr_linenumber" name="640" href="#640">640</a>     }
-<a class="jxr_linenumber" name="641" href="#641">641</a> 
-<a class="jxr_linenumber" name="642" href="#642">642</a>     <em class="jxr_comment">// No more keys</em>
-<a class="jxr_linenumber" name="643" href="#643">643</a>     close(false);<em class="jxr_comment">// Do all cleanup except heap.close()</em>
-<a class="jxr_linenumber" name="644" href="#644">644</a>     <strong class="jxr_keyword">return</strong> scannerContext.setScannerState(NextState.NO_MORE_VALUES).hasMoreValues();
-<a class="jxr_linenumber" name="645" href="#645">645</a>   }
-<a class="jxr_linenumber" name="646" href="#646">646</a> 
-<a class="jxr_linenumber" name="647" href="#647">647</a>   <em class="jxr_comment">/*</em>
-<a class="jxr_linenumber" name="648" href="#648">648</a> <em class="jxr_comment">   * See if we should actually SEEK or rather just SKIP to the next Cell.</em>
-<a class="jxr_linenumber" name="649" href="#649">649</a> <em class="jxr_comment">   * (see HBASE-13109)</em>
-<a class="jxr_linenumber" name="650" href="#650">650</a> <em class="jxr_comment">   */</em>
-<a class="jxr_linenumber" name="651" href="#651">651</a>   <strong class="jxr_keyword">private</strong> ScanQueryMatcher.MatchCode optimize(ScanQueryMatcher.MatchCode qcode, <a href="../../../../../org/apache/hadoop/hbase/Cell.html">Cell</a> cell) {
-<a class="jxr_linenumber" name="652" href="#652">652</a>     <strong class="jxr_keyword">switch</strong>(qcode) {
-<a class="jxr_linenumber" name="653" href="#653">653</a>     <strong class="jxr_keyword">case</strong> INCLUDE_AND_SEEK_NEXT_COL:
-<a class="jxr_linenumber" name="654" href="#654">654</a>     <strong class="jxr_keyword">case</strong> SEEK_NEXT_COL:
-<a class="jxr_linenumber" name="655" href="#655">655</a>     {
-<a class="jxr_linenumber" name="656" href="#656">656</a>       <a href="../../../../../org/apache/hadoop/hbase/Cell.html">Cell</a> nextIndexedKey = getNextIndexedKey();
-<a class="jxr_linenumber" name="657" href="#657">657</a>       <strong class="jxr_keyword">if</strong> (nextIndexedKey != <strong class="jxr_keyword">null</strong> &amp;&amp; nextIndexedKey != HConstants.NO_NEXT_INDEXED_KEY
-<a class="jxr_linenumber" name="658" href="#658">658</a>           &amp;&amp; matcher.compareKeyForNextColumn(nextIndexedKey, cell) &gt;= 0) {
-<a class="jxr_linenumber" name="659" href="#659">659</a>         <strong class="jxr_keyword">return</strong> qcode == MatchCode.SEEK_NEXT_COL ? MatchCode.SKIP : MatchCode.INCLUDE;
-<a class="jxr_linenumber" name="660" href="#660">660</a>       }
-<a class="jxr_linenumber" name="661" href="#661">661</a>       <strong class="jxr_keyword">break</strong>;
-<a class="jxr_linenumber" name="662" href="#662">662</a>     }
-<a class="jxr_linenumber" name="663" href="#663">663</a>     <strong class="jxr_keyword">case</strong> INCLUDE_AND_SEEK_NEXT_ROW:
-<a class="jxr_linenumber" name="664" href="#664">664</a>     <strong class="jxr_keyword">case</strong> SEEK_NEXT_ROW:
-<a class="jxr_linenumber" name="665" href="#665">665</a>     {
-<a class="jxr_linenumber" name="666" href="#666">666</a>       <a href="../../../../../org/apache/hadoop/hbase/Cell.html">Cell</a> nextIndexedKey = getNextIndexedKey();
-<a class="jxr_linenumber" name="667" href="#667">667</a>       <strong class="jxr_keyword">if</strong> (nextIndexedKey != <strong class="jxr_keyword">null</strong> &amp;&amp; nextIndexedKey != HConstants.NO_NEXT_INDEXED_KEY
-<a class="jxr_linenumber" name="668" href="#668">668</a>           &amp;&amp; matcher.compareKeyForNextRow(nextIndexedKey, cell) &gt;= 0) {
-<a class="jxr_linenumber" name="669" href="#669">669</a>         <strong class="jxr_keyword">return</strong> qcode == MatchCode.SEEK_NEXT_ROW ? MatchCode.SKIP : MatchCode.INCLUDE;
-<a class="jxr_linenumber" name="670" href="#670">670</a>       }
-<a class="jxr_linenumber" name="671" href="#671">671</a>       <strong class="jxr_keyword">break</strong>;
-<a class="jxr_linenumber" name="672" href="#672">672</a>     }
-<a class="jxr_linenumber" name="673" href="#673">673</a>     <strong class="jxr_keyword">default</strong>:
-<a class="jxr_linenumber" name="674" href="#674">674</a>       <strong class="jxr_keyword">break</strong>;
-<a class="jxr_linenumber" name="675" href="#675">675</a>     }
-<a class="jxr_linenumber" name="676" href="#676">676</a>     <strong class="jxr_keyword">return</strong> qcode;
-<a class="jxr_linenumber" name="677" href="#677">677</a>   }
-<a class="jxr_linenumber" name="678" href="#678">678</a> 
-<a class="jxr_linenumber" name="679" href="#679">679</a>   <em class="jxr_comment">// Implementation of ChangedReadersObserver</em>
-<a class="jxr_linenumber" name="680" href="#680">680</a>   @Override
-<a class="jxr_linenumber" name="681" href="#681">681</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> updateReaders(List&lt;StoreFile&gt; sfs) <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="682" href="#682">682</a>     flushed = <strong class="jxr_keyword">true</strong>;
-<a class="jxr_linenumber" name="683" href="#683">683</a>     flushLock.lock();
-<a class="jxr_linenumber" name="684" href="#684">684</a>     <strong class="jxr_keyword">try</strong> {
-<a class="jxr_linenumber" name="685" href="#685">685</a>       flushedStoreFiles.addAll(sfs);
-<a class="jxr_linenumber" name="686" href="#686">686</a>     } <strong class="jxr_keyword">finally</strong> {
-<a class="jxr_linenumber" name="687" href="#687">687</a>       flushLock.unlock();
-<a class="jxr_linenumber" name="688" href="#688">688</a>     }
-<a class="jxr_linenumber" name="689" href="#689">689</a>     <em class="jxr_comment">// Let the next() call handle re-creating and seeking</em>
-<a class="jxr_linenumber" name="690" href="#690">690</a>   }
-<a class="jxr_linenumber" name="691" href="#691">691</a> 
-<a class="jxr_linenumber" name="692" href="#692">692</a>   <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="693" href="#693">693</a> <em class="jxr_javadoccomment">   * @param flushed indicates if there was a flush</em>
-<a class="jxr_linenumber" name="694" href="#694">694</a> <em class="jxr_javadoccomment">   * @return true if top of heap has changed (and KeyValueHeap has to try the</em>
-<a class="jxr_linenumber" name="695" href="#695">695</a> <em class="jxr_javadoccomment">   *         next KV)</em>
-<a class="jxr_linenumber" name="696" href="#696">696</a> <em class="jxr_javadoccomment">   * @throws IOException</em>
-<a class="jxr_linenumber" name="697" href="#697">697</a> <em class="jxr_javadoccomment">   */</em>
-<a class="jxr_linenumber" name="698" href="#698">698</a>   <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">boolean</strong> checkReseek(<strong class="jxr_keyword">boolean</strong> flushed) <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="699" href="#699">699</a>     <strong class="jxr_keyword">if</strong> (flushed &amp;&amp; <strong class="jxr_keyword">this</strong>.lastTop != <strong class="jxr_keyword">null</strong>) {
-<a class="jxr_linenumber" name="700" href="#700">700</a>       resetScannerStack(<strong class="jxr_keyword">this</strong>.lastTop);
-<a class="jxr_linenumber" name="701" href="#701">701</a>       <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">this</strong>.heap.peek() == <strong class="jxr_keyword">null</strong>
-<a class="jxr_linenumber" name="702" href="#702">702</a>           || store.getComparator().compareRows(<strong class="jxr_keyword">this</strong>.lastTop, <strong class="jxr_keyword">this</strong>.heap.peek()) != 0) {
-<a class="jxr_linenumber" name="703" href="#703">703</a>         LOG.debug(<span class="jxr_string">"Storescanner.peek() is changed where before = "</span>
-<a class="jxr_linenumber" name="704" href="#704">704</a>             + <strong class="jxr_keyword">this</strong>.lastTop.toString() + <span class="jxr_string">",and after = "</span> + <strong class="jxr_keyword">this</strong>.heap.peek());
-<a class="jxr_linenumber" name="705" href="#705">705</a>         <strong class="jxr_keyword">this</strong>.lastTop = <strong class="jxr_keyword">null</strong>;
-<a class="jxr_linenumber" name="706" href="#706">706</a>         <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">true</strong>;
-<a class="jxr_linenumber" name="707" href="#707">707</a>       }
-<a class="jxr_linenumber" name="708" href="#708">708</a>       <strong class="jxr_keyword">this</strong>.lastTop = <strong class="jxr_keyword">null</strong>; <em class="jxr_comment">// gone!</em>
-<a class="jxr_linenumber" name="709" href="#709">709</a>     }
-<a class="jxr_linenumber" name="710" href="#710">710</a>     <em class="jxr_comment">// else dont need to reseek</em>
-<a class="jxr_linenumber" name="711" href="#711">711</a>     <strong class="jxr_keyword">return</strong> false;
-<a class="jxr_linenumber" name="712" href="#712">712</a>   }
-<a class="jxr_linenumber" name="713" href="#713">713</a> 
-<a class="jxr_linenumber" name="714" href="#714">714</a>   <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">void</strong> resetScannerStack(<a href="../../../../../org/apache/hadoop/hbase/Cell.html">Cell</a> lastTopKey) <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="715" href="#715">715</a>     <em class="jxr_comment">/*<em class="jxr_comment"> When we have the scan object, should we not pass it to getScanners()</em></em>
-<a class="jxr_linenumber" name="716" href="#716">716</a> <em class="jxr_comment">     * to get a limited set of scanners? We did so in the constructor and we</em>
-<a class="jxr_linenumber" name="717" href="#717">717</a> <em class="jxr_comment">     * could have done it now by storing the scan object from the constructor</em>
-<a class="jxr_linenumber" name="718" href="#718">718</a> <em class="jxr_comment">     */</em>
-<a class="jxr_linenumber" name="719" href="#719">719</a> 
-<a class="jxr_linenumber" name="720" href="#720">720</a>     <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">boolean</strong> isCompaction = false;
-<a class="jxr_linenumber" name="721" href="#721">721</a>     <strong class="jxr_keyword">boolean</strong> usePread = get || scanUsePread;
-<a class="jxr_linenumber" name="722" href="#722">722</a>     List&lt;KeyValueScanner&gt; scanners = <strong class="jxr_keyword">null</strong>;
-<a class="jxr_linenumber" name="723" href="#723">723</a>     <strong class="jxr_keyword">try</strong> {
-<a class="jxr_linenumber" name="724" href="#724">724</a>       flushLock.lock();
-<a class="jxr_linenumber" name="725" href="#725">725</a>       scanners = selectScannersFrom(store.getScanners(flushedStoreFiles, cacheBlocks, get, usePread,
-<a class="jxr_linenumber" name="726" href="#726">726</a>         isCompaction, matcher, scan.getStartRow(), scan.getStopRow(), <strong class="jxr_keyword">this</strong>.readPt, <strong class="jxr_keyword">true</strong>));
-<a class="jxr_linenumber" name="727" href="#727">727</a>       <em class="jxr_comment">// Clear the current set of flushed store files so that they don't get added again</em>
-<a class="jxr_linenumber" name="728" href="#728">728</a>       flushedStoreFiles.clear();
-<a class="jxr_linenumber" name="729" href="#729">729</a>     } <strong class="jxr_keyword">finally</strong> {
-<a class="jxr_linenumber" name="730" href="#730">730</a>       flushLock.unlock();
-<a class="jxr_linenumber" name="731" href="#731">731</a>     }
-<a class="jxr_linenumber" name="732" href="#732">732</a> 
-<a class="jxr_linenumber" name="733" href="#733">733</a>     <em class="jxr_comment">// Seek the new scanners to the last key</em>
-<a class="jxr_linenumber" name="734" href="#734">734</a>     seekScanners(scanners, lastTopKey, false, parallelSeekEnabled);
-<a class="jxr_linenumber" name="735" href="#735">735</a>     <em class="jxr_comment">// remove the older memstore scanner</em>
-<a class="jxr_linenumber" name="736" href="#736">736</a>     <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; currentScanners.size(); i++) {
-<a class="jxr_linenumber" name="737" href="#737">737</a>       <strong class="jxr_keyword">if</strong> (!currentScanners.get(i).isFileScanner()) {
-<a class="jxr_linenumber" name="738" href="#738">738</a>         currentScanners.remove(i);
-<a class="jxr_linenumber" name="739" href="#739">739</a>         <strong class="jxr_keyword">break</strong>;
-<a class="jxr_linenumber" name="740" href="#740">740</a>       }
-<a class="jxr_linenumber" name="741" href="#741">741</a>     }
-<a class="jxr_linenumber" name="742" href="#742">742</a>     <em class="jxr_comment">// add the newly created scanners on the flushed files and the current active memstore scanner</em>
-<a class="jxr_linenumber" name="743" href="#743">743</a>     addCurrentScanners(scanners);
-<a class="jxr_linenumber" name="744" href="#744">744</a>     <em class="jxr_comment">// Combine all seeked scanners with a heap</em>
-<a class="jxr_linenumber" name="745" href="#745">745</a>     resetKVHeap(<strong class="jxr_keyword">this</strong>.currentScanners, store.getComparator());
-<a class="jxr_linenumber" name="746" href="#746">746</a>     <em class="jxr_comment">// Reset the state of the Query Matcher and set to top row.</em>
-<a class="jxr_linenumber" name="747" href="#747">747</a>     <em class="jxr_comment">// Only reset and call setRow if the row changes; avoids confusing the</em>
-<a class="jxr_linenumber" name="748" href="#748">748</a>     <em class="jxr_comment">// query matcher if scanning intra-row.</em>
-<a class="jxr_linenumber" name="749" href="#749">749</a>     <a href="../../../../../org/apache/hadoop/hbase/Cell.html">Cell</a> cell = heap.peek();
-<a class="jxr_linenumber" name="750" href="#750">750</a>     <strong class="jxr_keyword">if</strong> (cell == <strong class="jxr_keyword">null</strong>) {
-<a class="jxr_linenumber" name="751" href="#751">751</a>       cell = lastTopKey;
-<a class="jxr_linenumber" name="752" href="#752">752</a>     }
-<a class="jxr_linenumber" name="753" href="#753">753</a>     <strong class="jxr_keyword">if</strong> ((matcher.curCell == <strong class="jxr_keyword">null</strong>) || !CellUtil.matchingRows(cell, matcher.curCell)) {
-<a class="jxr_linenumber" name="754" href="#754">754</a>       <strong class="jxr_keyword">this</strong>.countPerRow = 0;
-<a class="jxr_linenumber" name="755" href="#755">755</a>       matcher.reset();
-<a class="jxr_linenumber" name="756" href="#756">756</a>       matcher.setToNewRow(cell);
-<a class="jxr_linenumber" name="757" href="#757">757</a>     }
-<a class="jxr_linenumber" name="758" href="#758">758</a>   }
-<a class="jxr_linenumber" name="759" href="#759">759</a> 
-<a class="jxr_linenumber" name="760" href="#760">760</a>   <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="761" href="#761">761</a> <em class="jxr_javadoccomment">   * Check whether scan as expected order</em>
-<a class="jxr_linenumber" name="762" href="#762">762</a> <em class="jxr_javadoccomment">   * @param prevKV</em>
-<a class="jxr_linenumber" name="763" href="#763">763</a> <em class="jxr_javadoccomment">   * @param kv</em>
-<a class="jxr_linenumber" name="764" href="#764">764</a> <em class="jxr_javadoccomment">   * @param comparator</em>
-<a class="jxr_linenumber" name="765" href="#765">765</a> <em class="jxr_javadoccomment">   * @throws IOException</em>
-<a class="jxr_linenumber" name="766" href="#766">766</a> <em class="jxr_javadoccomment">   */</em>
-<a class="jxr_linenumber" name="767" href="#767">767</a>   <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">void</strong> checkScanOrder(<a href="../../../../../org/apache/hadoop/hbase/Cell.html">Cell</a> prevKV, <a href="../../../../../org/apache/hadoop/hbase/Cell.html">Cell</a> kv,
-<a class="jxr_linenumber" name="768" href="#768">768</a>       <a href="../../../../../org/apache/hadoop/hbase/CellComparator.html">CellComparator</a> comparator) <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="769" href="#769">769</a>     <em class="jxr_comment">// Check that the heap gives us KVs in an increasing order.</em>
-<a class="jxr_linenumber" name="770" href="#770">770</a>     assert prevKV == <strong class="jxr_keyword">null</strong> || comparator == <strong class="jxr_keyword">null</strong>
-<a class="jxr_linenumber" name="771" href="#771">771</a>         || comparator.compare(prevKV, kv) &lt;= 0 : <span class="jxr_string">"Key "</span> + prevKV
-<a class="jxr_linenumber" name="772" href="#772">772</a>         + <span class="jxr_string">" followed by a "</span> + <span class="jxr_string">"smaller key "</span> + kv + <span class="jxr_string">" in cf "</span> + store;
-<a class="jxr_linenumber" name="773" href="#773">773</a>   }
-<a class="jxr_linenumber" name="774" href="#774">774</a> 
-<a class="jxr_linenumber" name="775" href="#775">775</a>   <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">boolean</strong> seekToNextRow(<a href="../../../../../org/apache/hadoop/hbase/Cell.html">Cell</a> c) <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="776" href="#776">776</a>     <strong class="jxr_keyword">return</strong> reseek(CellUtil.createLastOnRow(c));
-<a class="jxr_linenumber" name="777" href="#777">777</a>   }
-<a class="jxr_linenumber" name="778" href="#778">778</a> 
-<a class="jxr_linenumber" name="779" href="#779">779</a>   <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="780" href="#780">780</a> <em class="jxr_javadoccomment">   * Do a reseek in a normal StoreScanner(scan forward)</em>
-<a class="jxr_linenumber" name="781" href="#781">781</a> <em class="jxr_javadoccomment">   * @param kv</em>
-<a class="jxr_linenumber" name="782" href="#782">782</a> <em class="jxr_javadoccomment">   * @return true if scanner has values left, false if end of scanner</em>
-<a class="jxr_linenumber" name="783" href="#783">783</a> <em class="jxr_javadoccomment">   * @throws IOException</em>
-<a class="jxr_linenumber" name="784" href="#784">784</a> <em class="jxr_javadoccomment">   */</em>
-<a class="jxr_linenumber" name="785" href="#785">785</a>   <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">boolean</strong> seekAsDirection(<a href="../../../../../org/apache/hadoop/hbase/Cell.html">Cell</a> kv)
-<a class="jxr_linenumber" name="786" href="#786">786</a>       <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="787" href="#787">787</a>     <strong class="jxr_keyword">return</strong> reseek(kv);
-<a class="jxr_linenumber" name="788" href="#788">788</a>   }
-<a class="jxr_linenumber" name="789" href="#789">789</a> 
-<a class="jxr_linenumber" name="790" href="#790">790</a>   @Override
-<a class="jxr_linenumber" name="791" href="#791">791</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">boolean</strong> reseek(<a href="../../../../../org/apache/hadoop/hbase/Cell.html">Cell</a> kv) <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="792" href="#792">792</a>     <strong class="jxr_keyword">boolean</strong> flushed = checkFlushed();
-<a class="jxr_linenumber" name="793" href="#793">793</a>     <em class="jxr_comment">// Heap will not be null, if this is called from next() which.</em>
-<a class="jxr_linenumber" name="794" href="#794">794</a>     <em class="jxr_comment">// If called from RegionScanner.reseek(...) make sure the scanner</em>
-<a class="jxr_linenumber" name="795" href="#795">795</a>     <em class="jxr_comment">// stack is reset if needed.</em>
-<a class="jxr_linenumber" name="796" href="#796">796</a>     checkReseek(flushed);
-<a class="jxr_linenumber" name="797" href="#797">797</a>     <strong class="jxr_keyword">if</strong> (explicitColumnQuery &amp;&amp; lazySeekEnabledGlobally) {
-<a class="jxr_linenumber" name="798" href="#798">798</a>       <strong class="jxr_keyword">return</strong> heap.requestSeek(kv, <strong class="jxr_keyword">true</strong>, useRowColBloom);
-<a class="jxr_linenumber" name="799" href="#799">799</a>     }
-<a class="jxr_linenumber" name="800" href="#800">800</a>     <strong class="jxr_keyword">return</strong> heap.reseek(kv);
-<a class="jxr_linenumber" name="801" href="#801">801</a>   }
-<a class="jxr_linenumber" name="802" href="#802">802</a> 
-<a class="jxr_linenumber" name="803" href="#803">803</a>   <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">boolean</strong> checkFlushed() {
-<a class="jxr_linenumber" name="804" href="#804">804</a>     <em class="jxr_comment">// check the var without any lock. Suppose even if we see the old</em>
-<a class="jxr_linenumber" name="805" href="#805">805</a>     <em class="jxr_comment">// value here still it is ok to continue because we will not be resetting</em>
-<a class="jxr_linenumber" name="806" href="#806">806</a>     <em class="jxr_comment">// the heap but will continue with the referenced memstore's snapshot. For compactions</em>
-<a class="jxr_linenumber" name="807" href="#807">807</a>     <em class="jxr_comment">// any way we don't need the updateReaders at all to happen as we still continue with </em>
-<a class="jxr_linenumber" name="808" href="#808">808</a>     <em class="jxr_comment">// the older files</em>
-<a class="jxr_linenumber" name="809" href="#809">809</a>     <strong class="jxr_keyword">if</strong> (flushed) {
-<a class="jxr_linenumber" name="810" href="#810">810</a>       <em class="jxr_comment">// If there is a flush and the current scan is notified on the flush ensure that the </em>
-<a class="jxr_linenumber" name="811" href="#811">811</a>       <em class="jxr_comment">// scan's heap gets reset and we do a seek on the newly flushed file.</em>
-<a class="jxr_linenumber" name="812" href="#812">812</a>       <strong class="jxr_keyword">if</strong>(!<strong class="jxr_keyword">this</strong>.closing) {
-<a class="jxr_linenumber" name="813" href="#813">813</a>         <strong class="jxr_keyword">this</strong>.lastTop = <strong class="jxr_keyword">this</strong>.heap.peek();
-<a class="jxr_linenumber" name="814" href="#814">814</a>       } <strong class="jxr_keyword">else</strong> {
-<a class="jxr_linenumber" name="815" href="#815">815</a>         <strong class="jxr_keyword">return</strong> false;
-<a class="jxr_linenumber" name="816" href="#816">816</a>       }
-<a class="jxr_linenumber" name="817" href="#817">817</a>       <em class="jxr_comment">// reset the flag</em>
-<a class="jxr_linenumber" name="818" href="#818">818</a>       flushed = false;
-<a class="jxr_linenumber" name="819" href="#819">819</a>       <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">true</strong>;
-<a class="jxr_linenumber" name="820" href="#820">820</a>     }
-<a class="jxr_linenumber" name="821" href="#821">821</a>     <strong class="jxr_keyword">return</strong> false;
-<a class="jxr_linenumber" name="822" href="#822">822</a>   }
-<a class="jxr_linenumber" name="823" href="#823">823</a> 
-<a class="jxr_linenumber" name="824" href="#824">824</a>   @Override
-<a class="jxr_linenumber" name="825" href="#825">825</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">long</strong> getSequenceID() {
-<a class="jxr_linenumber" name="826" href="#826">826</a>     <strong class="jxr_keyword">return</strong> 0;
-<a class="jxr_linenumber" name="827" href="#827">827</a>   }
-<a class="jxr_linenumber" name="828" href="#828">828</a> 
-<a class="jxr_linenumber" name="829" href="#829">829</a>   <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="830" href="#830">830</a> <em class="jxr_javadoccomment">   * Seek storefiles in parallel to optimize IO latency as much as possible</em>
-<a class="jxr_linenumber" name="831" href="#831">831</a> <em class="jxr_javadoccomment">   * @param scanners the list {@link KeyValueScanner}s to be read from</em>
-<a class="jxr_linenumber" name="832" href="#832">832</a> <em class="jxr_javadoccomment">   * @param kv the KeyValue on which the operation is being requested</em>
-<a class="jxr_linenumber" name="833" href="#833">833</a> <em class="jxr_javadoccomment">   * @throws IOException</em>
-<a class="jxr_linenumber" name="834" href="#834">834</a> <em class="jxr_javadoccomment">   */</em>
-<a class="jxr_linenumber" name="835" href="#835">835</a>   <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">void</strong> parallelSeek(<strong class="jxr_keyword">final</strong> List&lt;? <strong class="jxr_keyword">extends</strong> KeyValueScanner&gt;
-<a class="jxr_linenumber" name="836" href="#836">836</a>       scanners, <strong class="jxr_keyword">final</strong> <a href="../../../../../org/apache/hadoop/hbase/Cell.html">Cell</a> kv) <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="837" href="#837">837</a>     <strong class="jxr_keyword">if</strong> (scanners.isEmpty()) <strong class="jxr_keyword">return</strong>;
-<a class="jxr_linenumber" name="838" href="#838">838</a>     <strong class="jxr_keyword">int</strong> storeFileScannerCount = scanners.size();
-<a class="jxr_linenumber" name="839" href="#839">839</a>     CountDownLatch latch = <strong class="jxr_keyword">new</strong> CountDownLatch(storeFileScannerCount);
-<a class="jxr_linenumber" name="840" href="#840">840</a>     List&lt;ParallelSeekHandler&gt; handlers = 
-<a class="jxr_linenumber" name="841" href="#841">841</a>         <strong class="jxr_keyword">new</strong> ArrayList&lt;ParallelSeekHandler&gt;(storeFileScannerCount);
-<a class="jxr_linenumber" name="842" href="#842">842</a>     <strong class="jxr_keyword">for</strong> (KeyValueScanner scanner : scanners) {
-<a class="jxr_linenumber" name="843" href="#843">843</a>       <strong class="jxr_keyword">if</strong> (scanner instanceof StoreFileScanner) {
-<a class="jxr_linenumber" name="844" href="#844">844</a>         <a href="../../../../../org/apache/hadoop/hbase/regionserver/handler/ParallelSeekHandler.html">ParallelSeekHandler</a> seekHandler = <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/hadoop/hbase/regionserver/handler/ParallelSeekHandler.html">ParallelSeekHandler</a>(scanner, kv,
-<a class="jxr_linenumber" name="845" href="#845">845</a>           <strong class="jxr_keyword">this</strong>.readPt, latch);
-<a class="jxr_linenumber" name="846" href="#846">846</a>         executor.submit(seekHandler);
-<a class="jxr_linenumber" name="847" href="#847">847</a>         handlers.add(seekHandler);
-<a class="jxr_linenumber" name="848" href="#848">848</a>       } <strong class="jxr_keyword">else</strong> {
-<a class="jxr_linenumber" name="849" href="#849">849</a>         scanner.seek(kv);
-<a class="jxr_linenumber" name="850" href="#850">850</a>         latch.countDown();
-<a class="jxr_linenumber" name="851" href="#851">851</a>       }
-<a class="jxr_linenumber" name="852" href="#852">852</a>     }
-<a class="jxr_linenumber" name="853" href="#853">853</a> 
-<a class="jxr_linenumber" name="854" href="#854">854</a>     <strong class="jxr_keyword">try</strong> {
-<a class="jxr_linenumber" name="855" href="#855">855</a>       latch.await();
-<a class="jxr_linenumber" name="856" href="#856">856</a>     } <strong class="jxr_keyword">catch</strong> (InterruptedException ie) {
-<a class="jxr_linenumber" name="857" href="#857">857</a>       <strong class="jxr_keyword">throw</strong> (InterruptedIOException)<strong class="jxr_keyword">new</strong> InterruptedIOException().initCause(ie);
-<a class="jxr_linenumber" name="858" href="#858">858</a>     }
-<a class="jxr_linenumber" name="859" href="#859">859</a> 
-<a class="jxr_linenumber" name="860" href="#860">860</a>     <strong class="jxr_keyword">for</strong> (ParallelSeekHandler handler : handlers) {
-<a class="jxr_linenumber" name="861" href="#861">861</a>       <strong class="jxr_keyword">if</strong> (handler.getErr() != <strong class="jxr_keyword">null</strong>) {
-<a class="jxr_linenumber" name="862" href="#862">862</a>         <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> IOException(handler.getErr());
-<a class="jxr_linenumber" name="863" href="#863">863</a>       }
-<a class="jxr_linenumber" name="864" href="#864">864</a>     }
-<a class="jxr_linenumber" name="865" href="#865">865</a>   }
-<a class="jxr_linenumber" name="866" href="#866">866</a> 
-<a class="jxr_linenumber" name="867" href="#867">867</a>   <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="868" href="#868">868</a> <em class="jxr_javadoccomment">   * Used in testing.</em>
-<a class="jxr_linenumber" name="869" href="#869">869</a> <em class="jxr_javadoccomment">   * @return all scanners in no particular order</em>
-<a class="jxr_linenumber" name="870" href="#870">870</a> <em class="jxr_javadoccomment">   */</em>
-<a class="jxr_linenumber" name="871" href="#871">871</a>   List&lt;KeyValueScanner&gt; getAllScannersForTesting() {
-<a class="jxr_linenumber" name="872" href="#872">872</a>     List&lt;KeyValueScanner&gt; allScanners = <strong class="jxr_keyword">new</strong> ArrayList&lt;KeyValueScanner&gt;();
-<a class="jxr_linenumber" name="873" href="#873">873</a>     <a href="../../../../../org/apache/hadoop/hbase/regionserver/KeyValueScanner.html">KeyValueScanner</a> current = heap.getCurrentForTesting();
-<a class="jxr_linenumber" name="874" href="#874">874</a>     <strong class="jxr_keyword">if</strong> (current != <strong class="jxr_keyword">null</strong>)
-<a class="jxr_linenumber" name="875" href="#875">875</a>       allScanners.add(current);
-<a class="jxr_linenumber" name="876" href="#876">876</a>     <strong class="jxr_keyword">for</strong> (KeyValueScanner scanner : heap.getHeap())
-<a class="jxr_linenumber" name="877" href="#877">877</a>       allScanners.add(scanner);
-<a class="jxr_linenumber" name="878" href="#878">878</a>     <strong class="jxr_keyword">return</strong> allScanners;
-<a class="jxr_linenumber" name="879" href="#879">879</a>   }
-<a class="jxr_linenumber" name="880" href="#880">880</a> 
-<a class="jxr_linenumber" name="881" href="#881">881</a>   <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">void</strong> enableLazySeekGlobally(<strong class="jxr_keyword">boolean</strong> enable) {
-<a class="jxr_linenumber" name="882" href="#882">882</a>     lazySeekEnabledGlobally = enable;
-<a class="jxr_linenumber" name="883" href="#883">883</a>   }
-<a class="jxr_linenumber" name="884" href="#884">884</a> 
-<a class="jxr_linenumber" name="885" href="#885">885</a>   <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="886" href="#886">886</a> <em class="jxr_javadoccomment">   * @return The estimated number of KVs seen by this scanner (includes some skipped KVs).</em>
-<a class="jxr_linenumber" name="887" href="#887">887</a> <em class="jxr_javadoccomment">   */</em>
-<a class="jxr_linenumber" name="888" href="#888">888</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">long</strong> getEstimatedNumberOfKvsScanned() {
-<a class="jxr_linenumber" name="889" href="#889">889</a>     <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">this</strong>.kvsScanned;
-<a class="jxr_linenumber" name="890" href="#890">890</a>   }
-<a class="jxr_linenumber" name="891" href="#891">891</a> 
-<a class="jxr_linenumber" name="892" href="#892">892</a>   @Override
-<a class="jxr_linenumber" name="893" href="#893">893</a>   <strong class="jxr_keyword">public</strong> <a href="../../../../../org/apache/hadoop/hbase/Cell.html">Cell</a> getNextIndexedKey() {
-<a class="jxr_linenumber" name="894" href="#894">894</a>     <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">this</strong>.heap.getNextIndexedKey();
-<a class="jxr_linenumber" name="895" href="#895">895</a>   }
-<a class="jxr_linenumber" name="896" href="#896">896</a> 
-<a class="jxr_linenumber" name="897" href="#897">897</a>   @Override
-<a class="jxr_linenumber" name="898" href="#898">898</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> shipped() <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="899" href="#899">899</a>     <strong class="jxr_keyword">for</strong> (KeyValueHeap h : <strong class="jxr_keyword">this</strong>.heapsForDelayedClose) {
-<a class="jxr_linenumber" name="900" href="#900">900</a>       h.close();<em class="jxr_comment">// There wont be further fetch of Cells from these scanners. Just close.</em>
-<a class="jxr_linenumber" name="901" href="#901">901</a>     }
-<a class="jxr_linenumber" name="902" href="#902">902</a>     <strong class="jxr_keyword">this</strong>.heapsForDelayedClose.clear();
-<a class="jxr_linenumber" name="903" href="#903">903</a>     <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">this</strong>.heap != <strong class="jxr_keyword">null</strong>) {
-<a class="jxr_linenumber" name="904" href="#904">904</a>       <strong class="jxr_keyword">this</strong>.heap.shipped();
-<a class="jxr_linenumber" name="905" href="#905">905</a>     }
-<a class="jxr_linenumber" name="906" href="#906">906</a>   }
-<a class="jxr_linenumber" name="907" href="#907">907</a> }
-<a class="jxr_linenumber" name="908" href="#908">908</a> 
+<a class="jxr_linenumber" name="417" href="#417">417</a>     <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">this</strong>.heap == <strong class="jxr_keyword">null</strong>) {
+<a class="jxr_linenumber" name="418" href="#418">418</a>       <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">this</strong>.lastTop;
+<a class="jxr_linenumber" name="419" href="#419">419</a>     }
+<a class="jxr_linenumber" name="420" href="#420">420</a>     <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">this</strong>.heap.peek();
+<a class="jxr_linenumber" name="421" href="#421">421</a>   }
+<a class="jxr_linenumber" name="422" href="#422">422</a> 
+<a class="jxr_linenumber" name="423" href="#423">423</a>   @Override
+<a class="jxr_linenumber" name="424" href="#424">424</a>   <strong class="jxr_keyword">public</strong> <a href="../../../../../org/apache/hadoop/hbase/KeyValue.html">KeyValue</a> next() {
+<a class="jxr_linenumber" name="425" href="#425">425</a>     <em class="jxr_comment">// throw runtime exception perhaps?</em>
+<a class="jxr_linenumber" name="426" href="#426">426</a>     <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> RuntimeException(<span class="jxr_string">"Never call StoreScanner.next()"</span>);
+<a class="jxr_linenumber" name="427" href="#427">427</a>   }
+<a class="jxr_linenumber" name="428" href="#428">428</a> 
+<a class="jxr_linenumber" name="429" href="#429">429</a>   @Override
+<a class="jxr_linenumber" name="430" href="#430">430</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> close() {
+<a class="jxr_linenumber" name="431" href="#431">431</a>     close(<strong class="jxr_keyword">true</strong>);
+<a class="jxr_linenumber" name="432" href="#432">432</a>   }
+<a class="jxr_linenumber" name="433" href="#433">433</a> 
+<a class="jxr_linenumber" name="434" href="#434">434</a>   <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">void</strong> close(<strong class="jxr_keyword">boolean</strong> withHeapClose) {
+<a class="jxr_linenumber" name="435" href="#435">435</a>     <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">this</strong>.closing) {
+<a class="jxr_linenumber" name="436" href="#436">436</a>       <strong class="jxr_keyword">return</strong>;
+<a class="jxr_linenumber" name="437" href="#437">437</a>     }
+<a class="jxr_linenumber" name="438" href="#438">438</a>     <strong class="jxr_keyword">if</strong> (withHeapClose) <strong class="jxr_keyword">this</strong>.closing = <strong class="jxr_keyword">true</strong>;
+<a class="jxr_linenumber" name="439" href="#439">439</a>     <em class="jxr_comment">// Under test, we dont have a this.store</em>
+<a class="jxr_linenumber" name="440" href="#440">440</a>     <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">this</strong>.store != <strong class="jxr_keyword">null</strong>) <strong class="jxr_keyword">this</strong>.store.deleteChangedReaderObserver(<strong class="jxr_keyword">this</strong>);
+<a class="jxr_linenumber" name="441" href="#441">441</a>     <strong class="jxr_keyword">if</strong> (withHeapClose) {
+<a class="jxr_linenumber" name="442" href="#442">442</a>       <strong class="jxr_keyword">for</strong> (KeyValueHeap h : <strong class="jxr_keyword">this</strong>.heapsForDelayedClose) {
+<a class="jxr_linenumber" name="443" href="#443">443</a>         h.close();
+<a class="jxr_linenumber" name="444" href="#444">444</a>       }
+<a class="jxr_linenumber" name="445" href="#445">445</a>       <strong class="jxr_keyword">this</strong>.heapsForDelayedClose.clear();
+<a class="jxr_linenumber" name="446" href="#446">446</a>       <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">this</strong>.heap != <strong class="jxr_keyword">null</strong>) {
+<a class="jxr_linenumber" name="447" href="#447">447</a>         <strong class="jxr_keyword">this</strong>.heap.close();
+<a class="jxr_linenumber" name="448" href="#448">448</a>         <strong class="jxr_keyword">this</strong>.currentScanners.clear();
+<a class="jxr_linenumber" name="449" href="#449">449</a>         <strong class="jxr_keyword">this</strong>.heap = <strong class="jxr_keyword">null</strong>; <em class="jxr_comment">// CLOSED!</em>
+<a class="jxr_linenumber" name="450" href="#450">450</a>       }
+<a class="jxr_linenumber" name="451" href="#451">451</a>     } <strong class="jxr_keyword">else</strong> {
+<a class="jxr_linenumber" name="452" href="#452">452</a>       <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">this</strong>.heap != <strong class="jxr_keyword">null</strong>) {
+<a class="jxr_linenumber" name="453" href="#453">453</a>         <strong class="jxr_keyword">this</strong>.heapsForDelayedClose.add(<strong class="jxr_keyword">this</strong>.heap);
+<a class="jxr_linenumber" name="454" href="#454">454</a>         <strong class="jxr_keyword">this</strong>.currentScanners.clear();
+<a class="jxr_linenumber" name="455" href="#455">455</a>         <strong class="jxr_keyword">this</strong>.heap = <strong class="jxr_keyword">null</strong>;
+<a class="jxr_linenumber" name="456" href="#456">456</a>       }
+<a class="jxr_linenumber" name="457" href="#457">457</a>     }
+<a class="jxr_linenumber" name="458" href="#458">458</a>     <strong class="jxr_keyword">this</strong>.lastTop = <strong class="jxr_keyword">null</strong>; <em class="jxr_comment">// If both are null, we are closed.</em>
+<a class="jxr_linenumber" name="459" href="#459">459</a>   }
+<a class="jxr_linenumber" name="460" href="#460">460</a> 
+<a class="jxr_linenumber" name="461" href="#461">461</a>   @Override
+<a class="jxr_linenumber" name="462" href="#462">462</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">boolean</strong> seek(<a href="../../../../../org/apache/hadoop/hbase/Cell.html">Cell</a> key) <strong class="jxr_keyword">throws</strong> IOException {
+<a class="jxr_linenumber" name="463" href="#463">463</a>     <strong class="jxr_keyword">boolean</strong> flushed = checkFlushed();
+<a class="jxr_linenumber" name="464" href="#464">464</a>     <em class="jxr_comment">// reset matcher state, in case that underlying store changed</em>
+<a class="jxr_linenumber" name="465" href="#465">465</a>     checkReseek(flushed);
+<a class="jxr_linenumber" name="466" href="#466">466</a>     <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">this</strong>.heap.seek(key);
+<a class="jxr_linenumber" name="467" href="#467">467</a>   }
+<a class="jxr_linenumber" name="468" href="#468">468</a> 
+<a class="jxr_linenumber" name="469" href="#469">469</a>   @Override
+<a class="jxr_linenumber" name="470" href="#470">470</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">boolean</strong> next(List&lt;Cell&gt; outResult) <strong class="jxr_keyword">throws</strong> IOException {
+<a class="jxr_linenumber" name="471" href="#471">471</a>     <strong class="jxr_keyword">return</strong> next(outResult, NoLimitScannerContext.getInstance());
+<a class="jxr_linenumber" name="472" href="#472">472</a>   }
+<a class="jxr_linenumber" name="473" href="#473">473</a> 
+<a class="jxr_linenumber" name="474" href="#474">474</a>   <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="475" href="#475">475</a> <em class="jxr_javadoccomment">   * Get the next row of values from this Store.</em>
+<a class="jxr_linenumber" name="476" href="#476">476</a> <em class="jxr_javadoccomment">   * @param outResult</em>
+<a class="jxr_linenumber" name="477" href="#477">477</a> <em class="jxr_javadoccomment">   * @param scannerContext</em>
+<a class="jxr_linenumber" name="478" href="#478">478</a> <em class="jxr_javadoccomment">   * @return true if there are more rows, false if scanner is done</em>
+<a class="jxr_linenumber" name="479" href="#479">479</a> <em class="jxr_javadoccomment">   */</em>
+<a class="jxr_linenumber" name="480" href="#480">480</a>   @Override
+<a class="jxr_linenumber" name="481" href="#481">481</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">boolean</strong> next(List&lt;Cell&gt; outResult, <a href="../../../../../org/apache/hadoop/hbase/regionserver/ScannerContext.html">ScannerContext</a> scannerContext) <strong class="jxr_keyword">throws</strong> IOException {
+<a class="jxr_linenumber" name="482" href="#482">482</a>     <strong class="jxr_keyword">if</strong> (scannerContext == <strong class="jxr_keyword">null</strong>) {
+<a class="jxr_linenumber" name="483" href="#483">483</a>       <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> IllegalArgumentException(<span class="jxr_string">"Scanner context cannot be null"</span>);
+<a class="jxr_linenumber" name="484" href="#484">484</a>     }
+<a class="jxr_linenumber" name="485" href="#485">485</a>     <strong class="jxr_keyword">boolean</strong> flushed = checkFlushed();
+<a class="jxr_linenumber" name="486" href="#486">486</a>     <strong class="jxr_keyword">if</strong> (checkReseek(flushed)) {
+<a class="jxr_linenumber" name="487" href="#487">487</a>       <strong class="jxr_keyword">return</strong> scannerContext.setScannerState(NextState.MORE_VALUES).hasMoreValues();
+<a class="jxr_linenumber" name="488" href="#488">488</a>     }
+<a class="jxr_linenumber" name="489" href="#489">489</a> 
+<a class="jxr_linenumber" name="490" href="#490">490</a>     <em class="jxr_comment">// if the heap was left null, then the scanners had previously run out anyways, close and</em>
+<a class="jxr_linenumber" name="491" href="#491">491</a>     <em class="jxr_comment">// return.</em>
+<a class="jxr_linenumber" name="492" href="#492">492</a>     <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">this</strong>.heap == <strong class="jxr_keyword">null</strong>) {
+<a class="jxr_linenumber" name="493" href="#493">493</a>       <em class="jxr_comment">// By this time partial close should happened because already heap is null</em>
+<a class="jxr_linenumber" name="494" href="#494">494</a>       close(false);<em class="jxr_comment">// Do all cleanup except heap.close()</em>
+<a class="jxr_linenumber" name="495" href="#495">495</a>       <strong class="jxr_keyword">return</strong> scannerContext.setScannerState(NextState.NO_MORE_VALUES).hasMoreValues();
+<a class="jxr_linenumber" name="496" href="#496">496</a>     }
+<a class="jxr_linenumber" name="497" href="#497">497</a> 
+<a class="jxr_linenumber" name="498" href="#498">498</a>     <a href="../../../../../org/apache/hadoop/hbase/Cell.html">Cell</a> cell = <strong class="jxr_keyword">this</strong>.heap.peek();
+<a class="jxr_linenumber" name="499" href="#499">499</a>     <strong class="jxr_keyword">if</strong> (cell == <strong class="jxr_keyword">null</strong>) {
+<a class="jxr_linenumber" name="500" href="#500">500</a>       close(false);<em class="jxr_comment">// Do all cleanup except heap.close()</em>
+<a class="jxr_linenumber" name="501" href="#501">501</a>       <strong class="jxr_keyword">return</strong> scannerContext.setScannerState(NextState.NO_MORE_VALUES).hasMoreValues();
+<a class="jxr_linenumber" name="502" href="#502">502</a>     }
+<a class="jxr_linenumber" name="503" href="#503">503</a> 
+<a class="jxr_linenumber" name="504" href="#504">504</a>     <em class="jxr_comment">// only call setRow if the row changes; avoids confusing the query matcher</em>
+<a class="jxr_linenumber" name="505" href="#505">505</a>     <em class="jxr_comment">// if scanning intra-row</em>
+<a class="jxr_linenumber" name="506" href="#506">506</a> 
+<a class="jxr_linenumber" name="507" href="#507">507</a>     <em class="jxr_comment">// If no limits exists in the scope LimitScope.Between_Cells then we are sure we are changing</em>
+<a class="jxr_linenumber" name="508" href="#508">508</a>     <em class="jxr_comment">// rows. Else it is possible we are still traversing the same row so we must perform the row</em>
+<a class="jxr_linenumber" name="509" href="#509">509</a>     <em class="jxr_comment">// comparison.</em>
+<a class="jxr_linenumber" name="510" href="#510">510</a>     <strong class="jxr_keyword">if</strong> (!scannerContext.hasAnyLimit(LimitScope.BETWEEN_CELLS) || matcher.curCell == <strong class="jxr_keyword">null</strong>
+<a class="jxr_linenumber" name="511" href="#511">511</a>         || !CellUtil.matchingRow(cell, matcher.curCell)) {
+<a class="jxr_linenumber" name="512" href="#512">512</a>       <strong class="jxr_keyword">this</strong>.countPerRow = 0;
+<a class="jxr_linenumber" name="513" href="#513">513</a>       matcher.setToNewRow(cell);
+<a class="jxr_linenumber" name="514" href="#514">514</a>     }
+<a class="jxr_linenumber" name="515" href="#515">515</a> 
+<a class="jxr_linenumber" name="516" href="#516">516</a>     <em class="jxr_comment">// Clear progress away unless invoker has indicated it should be kept.</em>
+<a class="jxr_linenumber" name="517" href="#517">517</a>     <strong class="jxr_keyword">if</strong> (!scannerContext.getKeepProgress()) scannerContext.clearProgress();
+<a class="jxr_linenumber" name="518" href="#518">518</a> 
+<a class="jxr_linenumber" name="519" href="#519">519</a>     <em class="jxr_comment">// Only do a sanity-check if store and comparator are available.</em>
+<a class="jxr_linenumber" name="520" href="#520">520</a>     <a href="../../../../../org/apache/hadoop/hbase/CellComparator.html">CellComparator</a> comparator = store != <strong class="jxr_keyword">null</strong> ? store.getComparator() : <strong class="jxr_keyword">null</strong>;
+<a class="jxr_linenumber" name="521" href="#521">521</a> 
+<a class="jxr_linenumber" name="522" href="#522">522</a>     <strong class="jxr_keyword">int</strong> count = 0;
+<a class="jxr_linenumber" name="523" href="#523">523</a>     <strong class="jxr_keyword">long</strong> totalBytesRead = 0;
+<a class="jxr_linenumber" name="524" href="#524">524</a> 
+<a class="jxr_linenumber" name="525" href="#525">525</a>     LOOP: <strong class="jxr_keyword">do</strong> {
+<a class="jxr_linenumber" name="526" href="#526">526</a>       <em class="jxr_comment">// Update and check the time limit based on the configured value of cellsPerTimeoutCheck</em>
+<a class="jxr_linenumber" name="527" href="#527">527</a>       <strong class="jxr_keyword">if</strong> ((kvsScanned % cellsPerHeartbeatCheck == 0)) {
+<a class="jxr_linenumber" name="528" href="#528">528</a>         scannerContext.updateTimeProgress();
+<a class="jxr_linenumber" name="529" href="#529">529</a>         <strong class="jxr_keyword">if</strong> (scannerContext.checkTimeLimit(LimitScope.BETWEEN_CELLS)) {
+<a class="jxr_linenumber" name="530" href="#530">530</a>           <strong class="jxr_keyword">return</strong> scannerContext.setScannerState(NextState.TIME_LIMIT_REACHED).hasMoreValues();
+<a class="jxr_linenumber" name="531" href="#531">531</a>         }
+<a class="jxr_linenumber" name="532" href="#532">532</a>       }
+<a class="jxr_linenumber" name="533" href="#533">533</a> 
+<a class="jxr_linenumber" name="534" href="#534">534</a>       <strong class="jxr_keyword">if</strong> (prevCell != cell) ++kvsScanned; <em class="jxr_comment">// Do object compare - we set prevKV from the same heap.</em>
+<a class="jxr_linenumber" name="535" href="#535">535</a>       checkScanOrder(prevCell, cell, comparator);
+<a class="jxr_linenumber" name="536" href="#536">536</a>       prevCell = cell;
+<a class="jxr_linenumber" name="537" href="#537">537</a> 
+<a class="jxr_linenumber" name="538" href="#538">538</a>       ScanQueryMatcher.MatchCode qcode = matcher.match(cell);
+<a class="jxr_linenumber" name="539" href="#539">539</a>       qcode = optimize(qcode, cell);
+<a class="jxr_linenumber" name="540" href="#540">540</a>       <strong class="jxr_keyword">switch</strong> (qcode) {
+<a class="jxr_linenumber" name="541" href="#541">541</a>       <strong class="jxr_keyword">case</strong> INCLUDE:
+<a class="jxr_linenumber" name="542" href="#542">542</a>       <strong class="jxr_keyword">case</strong> INCLUDE_AND_SEEK_NEXT_ROW:
+<a class="jxr_linenumber" name="543" href="#543">543</a>       <strong class="jxr_keyword">case</strong> INCLUDE_AND_SEEK_NEXT_COL:
+<a class="jxr_linenumber" name="544" href="#544">544</a> 
+<a class="jxr_linenumber" name="545" href="#545">545</a>         <a href="../../../../../org/apache/hadoop/hbase/filter/Filter.html">Filter</a> f = matcher.getFilter();
+<a class="jxr_linenumber" name="546" href="#546">546</a>         <strong class="jxr_keyword">if</strong> (f != <strong class="jxr_keyword">null</strong>) {
+<a class="jxr_linenumber" name="547" href="#547">547</a>           cell = f.transformCell(cell);
+<a class="jxr_linenumber" name="548" href="#548">548</a>         }
+<a class="jxr_linenumber" name="549" href="#549">549</a> 
+<a class="jxr_linenumber" name="550" href="#550">550</a>         <strong class="jxr_keyword">this</strong>.countPerRow++;
+<a class="jxr_linenumber" name="551" href="#551">551</a>         <strong class="jxr_keyword">if</strong> (storeLimit &gt; -1 &amp;&amp; <strong class="jxr_keyword">this</strong>.countPerRow &gt; (storeLimit + storeOffset)) {
+<a class="jxr_linenumber" name="552" href="#552">552</a>           <em class="jxr_comment">// do what SEEK_NEXT_ROW does.</em>
+<a class="jxr_linenumber" name="553" href="#553">553</a>           <strong class="jxr_keyword">if</strong> (!matcher.moreRowsMayExistAfter(cell)) {
+<a class="jxr_linenumber" name="554" href="#554">554</a>             <strong class="jxr_keyword">return</strong> scannerContext.setScannerState(NextState.NO_MORE_VALUES).hasMoreValues();
+<a class="jxr_linenumber" name="555" href="#555">555</a>           }
+<a class="jxr_linenumber" name="556" href="#556">556</a>           seekToNextRow(cell);
+<a class="jxr_linenumber" name="557" href="#557">557</a>           <strong class="jxr_keyword">break</strong> LOOP;
+<a class="jxr_linenumber" name="558" href="#558">558</a>         }
+<a class="jxr_linenumber" name="559" href="#559">559</a> 
+<a class="jxr_linenumber" name="560" href="#560">560</a>         <em class="jxr_comment">// add to results only if we have skipped #storeOffset kvs</em>
+<a class="jxr_linenumber" name="561" href="#561">561</a>         <em class="jxr_comment">// also update metric accordingly</em>
+<a class="jxr_linenumber" name="562" href="#562">562</a>         <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">this</strong>.countPerRow &gt; storeOffset) {
+<a class="jxr_linenumber" name="563" href="#563">563</a>           outResult.add(cell);
+<a class="jxr_linenumber" name="564" href="#564">564</a> 
+<a class="jxr_linenumber" name="565" href="#565">565</a>           <em class="jxr_comment">// Update local tracking information</em>
+<a class="jxr_linenumber" name="566" href="#566">566</a>           count++;
+<a class="jxr_linenumber" name="567" href="#567">567</a>           totalBytesRead += CellUtil.estimatedSerializedSizeOf(cell);
+<a class="jxr_linenumber" name="568" href="#568">568</a> 
+<a class="jxr_linenumber" name="569" href="#569">569</a>           <em class="jxr_comment">// Update the progress of the scanner context</em>
+<a class="jxr_linenumber" name="570" href="#570">570</a>           scannerContext.incrementSizeProgress(CellUtil.estimatedHeapSizeOf(cell));
+<a class="jxr_linenumber" name="571" href="#571">571</a>           scannerContext.incrementBatchProgress(1);
+<a class="jxr_linenumber" name="572" href="#572">572</a> 
+<a class="jxr_linenumber" name="573" href="#573">573</a>           <strong class="jxr_keyword">if</strong> (totalBytesRead &gt; maxRowSize) {
+<a class="jxr_linenumber" name="574" href="#574">574</a>             <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/hadoop/hbase/client/RowTooBigException.html">RowTooBigException</a>(
+<a class="jxr_linenumber" name="575" href="#575">575</a>                 <span class="jxr_string">"Max row size allowed: "</span> + maxRowSize + <span class="jxr_string">", but the row is bigger than that."</span>);
+<a class="jxr_linenumber" name="576" href="#576">576</a>           }
+<a class="jxr_linenumber" name="577" href="#577">577</a>         }
+<a class="jxr_linenumber" name="578" href="#578">578</a> 
+<a class="jxr_linenumber" name="579" href="#579">579</a>         <strong class="jxr_keyword">if</strong> (qcode == ScanQueryMatcher.MatchCode.INCLUDE_AND_SEEK_NEXT_ROW) {
+<a class="jxr_linenumber" name="580" href="#580">580</a>           <strong class="jxr_keyword">if</strong> (!matcher.moreRowsMayExistAfter(cell)) {
+<a class="jxr_linenumber" name="581" href="#581">581</a>             <strong class="jxr_keyword">return</strong> scannerContext.setScannerState(NextState.NO_MORE_VALUES).hasMoreValues();
+<a class="jxr_linenumber" name="582" href="#582">582</a>           }
+<a class="jxr_linenumber" name="583" href="#583">583</a>           seekToNextRow(cell);
+<a class="jxr_linenumber" name="584" href="#584">584</a>         } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (qcode == ScanQueryMatcher.MatchCode.INCLUDE_AND_SEEK_NEXT_COL) {
+<a class="jxr_linenumber" name="585" href="#585">585</a>           seekAsDirection(matcher.getKeyForNextColumn(cell));
+<a class="jxr_linenumber" name="586" href="#586">586</a>         } <strong class="jxr_keyword">else</strong> {
+<a class="jxr_linenumber" name="587" href="#587">587</a>           <strong class="jxr_keyword">this</strong>.heap.next();
+<a class="jxr_linenumber" name="588" href="#588">588</a>         }
+<a class="jxr_linenumber" name="589" href="#589">589</a> 
+<a class="jxr_linenumber" name="590" href="#590">590</a>         <strong class="jxr_keyword">if</strong> (scannerContext.checkBatchLimit(LimitScope.BETWEEN_CELLS)) {
+<a class="jxr_linenumber" name="591" href="#591">591</a>           <strong class="jxr_keyword">break</strong> LOOP;
+<a class="jxr_linenumber" name="592" href="#592">592</a>         }
+<a class="jxr_linenumber" name="593" href="#593">593</a>         <strong class="jxr_keyword">if</strong> (scannerContext.checkSizeLimit(LimitScope.BETWEEN_CELLS)) {
+<a class="jxr_linenumber" name="594" href="#594">594</a>           <strong class="jxr_keyword">break</strong> LOOP;
+<a class="jxr_linenumber" name="595" href="#595">595</a>         }
+<a class="jxr_linenumber" name="596" href="#596">596</a>         <strong class="jxr_keyword">continue</strong>;
+<a class="jxr_linenumber" name="597" href="#597">597</a> 
+<a class="jxr_linenumber" name="598" href="#598">598</a>       <strong class="jxr_keyword">case</strong> DONE:
+<a class="jxr_linenumber" name="599" href="#599">599</a>         <strong class="jxr_keyword">return</strong> scannerContext.setScannerState(NextState.MORE_VALUES).hasMoreValues();
+<a class="jxr_linenumber" name="600" href="#600">600</a> 
+<a class="jxr_linenumber" name="601" href="#601">601</a>       <strong class="jxr_keyword">case</strong> DONE_SCAN:
+<a class="jxr_linenumber" name="602" href="#602">602</a>         close(false);<em class="jxr_comment">// Do all cleanup except heap.close()</em>
+<a class="jxr_linenumber" name="603" href="#603">603</a>         <strong class="jxr_keyword">return</strong> scannerContext.setScannerState(NextState.NO_MORE_VALUES).hasMoreValues();
+<a class="jxr_linenumber" name="604" href="#604">604</a> 
+<a class="jxr_linenumber" name="605" href="#605">605</a>       <strong class="jxr_keyword">case</strong> SEEK_NEXT_ROW:
+<a class="jxr_linenumber" name="606" href="#606">606</a>         <em class="jxr_comment">// This is just a relatively simple end of scan fix, to short-cut end</em>
+<a class="jxr_linenumber" name="607" href="#607">607</a>         <em class="jxr_comment">// us if there is an endKey in the scan.</em>
+<a class="jxr_linenumber" name="608" href="#608">608</a>         <strong class="jxr_keyword">if</strong> (!matcher.moreRowsMayExistAfter(cell)) {
+<a class="jxr_linenumber" name="609" href="#609">609</a>           <strong class="jxr_keyword">return</strong> scannerContext.setScannerState(NextState.NO_MORE_VALUES).hasMoreValues();
+<a class="jxr_linenumber" name="610" href="#610">610</a>         }
+<a class="jxr_linenumber" name="611" href="#611">611</a> 
+<a class="jxr_linenumber" name="612" href="#612">612</a>         seekToNextRow(cell);
+<a class="jxr_linenumber" name="613" href="#613">613</a>         <strong class="jxr_keyword">break</strong>;
+<a class="jxr_linenumber" name="614" href="#614">614</a> 
+<a class="jxr_linenumber" name="615" href="#615">615</a>       <strong class="jxr_keyword">case</strong> SEEK_NEXT_COL:
+<a class="jxr_linenumber" name="616" href="#616">616</a>         seekAsDirection(matcher.getKeyForNextColumn(cell));
+<a class="jxr_linenumber" name="617" href="#617">617</a>         <strong class="jxr_keyword">break</strong>;
+<a class="jxr_linenumber" name="618" href="#618">618</a> 
+<a class="jxr_linenumber" name="619" href="#619">619</a>       <strong class="jxr_keyword">case</strong> SKIP:
+<a class="jxr_linenumber" name="620" href="#620">620</a>         <strong class="jxr_keyword">this</strong>.heap.next();
+<a class="jxr_linenumber" name="621" href="#621">621</a>         <strong class="jxr_keyword">break</strong>;
+<a class="jxr_linenumber" name="622" href="#622">622</a> 
+<a class="jxr_linenumber" name="623" href="#623">623</a>       <strong class="jxr_keyword">case</strong> SEEK_NEXT_USING_HINT:
+<a class="jxr_linenumber" name="624" href="#624">624</a>         <a href="../../../../../org/apache/hadoop/hbase/Cell.html">Cell</a> nextKV = matcher.getNextKeyHint(cell);
+<a class="jxr_linenumber" name="625" href="#625">625</a>         <strong class="jxr_keyword">if</strong> (nextKV != <strong class="jxr_keyword">null</strong>) {
+<a class="jxr_linenumber" name="626" href="#626">626</a>           seekAsDirection(nextKV);
+<a class="jxr_linenumber" name="627" href="#627">627</a>         } <strong class="jxr_keyword">else</strong> {
+<a class="jxr_linenumber" name="628" href="#628">628</a>           heap.next();
+<a class="jxr_linenumber" name="629" href="#629">629</a>         }
+<a class="jxr_linenumber" name="630" href="#630">630</a>         <strong class="jxr_keyword">break</strong>;
+<a class="jxr_linenumber" name="631" href="#631">631</a> 
+<a class="jxr_linenumber" name="632" href="#632">632</a>       <strong class="jxr_keyword">default</strong>:
+<a class="jxr_linenumber" name="633" href="#633">633</a>         <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> RuntimeException(<span class="jxr_string">"UNEXPECTED"</span>);
+<a class="jxr_linenumber" name="634" href="#634">634</a>       }
+<a class="jxr_linenumber" name="635" href="#635">635</a>     } <strong class="jxr_keyword">while</strong> ((cell = <strong class="jxr_keyword">this</strong>.heap.peek()) != <strong class="jxr_keyword">null</strong>);
+<a class="jxr_linenumber" name="636" href="#636">636</a> 
+<a class="jxr_linenumber" name="637" href="#637">637</a>     <strong class="jxr_keyword">if</strong> (count &gt; 0) {
+<a class="jxr_linenumber" name="638" href="#638">638</a>       <strong class="jxr_keyword">return</strong> scannerContext.setScannerState(NextState.MORE_VALUES).hasMoreValues();
+<a class="jxr_linenumber" name="639" href="#639">639</a>     }


<TRUNCATED>

Mime
View raw message