hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mi...@apache.org
Subject [15/24] hbase git commit: Published site at 0d72849581c1e5a50a2aa7757b909e5531b8d12c.
Date Thu, 26 Nov 2015 21:52:39 GMT
http://git-wip-us.apache.org/repos/asf/hbase/blob/2fa570dd/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/ScanQueryMatcher.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/ScanQueryMatcher.html b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/ScanQueryMatcher.html
index bddf5c5..80b5066 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/ScanQueryMatcher.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/ScanQueryMatcher.html
@@ -168,513 +168,518 @@
 <span class="sourceLineNo">160</span>  public ScanQueryMatcher(Scan scan, ScanInfo scanInfo, NavigableSet&lt;byte[]&gt; columns,<a name="line.160"></a>
 <span class="sourceLineNo">161</span>      ScanType scanType, long readPointToUse, long earliestPutTs, long oldestUnexpiredTS,<a name="line.161"></a>
 <span class="sourceLineNo">162</span>      long now, RegionCoprocessorHost regionCoprocessorHost) throws IOException {<a name="line.162"></a>
-<span class="sourceLineNo">163</span>    this.tr = scan.getTimeRange();<a name="line.163"></a>
-<span class="sourceLineNo">164</span>    this.rowComparator = scanInfo.getComparator();<a name="line.164"></a>
-<span class="sourceLineNo">165</span>    this.regionCoprocessorHost = regionCoprocessorHost;<a name="line.165"></a>
-<span class="sourceLineNo">166</span>    this.deletes =  instantiateDeleteTracker();<a name="line.166"></a>
-<span class="sourceLineNo">167</span>    this.stopRow = scan.getStopRow();<a name="line.167"></a>
-<span class="sourceLineNo">168</span>    this.startKey = CellUtil.createFirstDeleteFamilyCellOnRow(scan.getStartRow(),<a name="line.168"></a>
-<span class="sourceLineNo">169</span>        scanInfo.getFamily());<a name="line.169"></a>
-<span class="sourceLineNo">170</span>    this.filter = scan.getFilter();<a name="line.170"></a>
-<span class="sourceLineNo">171</span>    this.earliestPutTs = earliestPutTs;<a name="line.171"></a>
-<span class="sourceLineNo">172</span>    this.oldestUnexpiredTS = oldestUnexpiredTS;<a name="line.172"></a>
-<span class="sourceLineNo">173</span>    this.now = now;<a name="line.173"></a>
-<span class="sourceLineNo">174</span><a name="line.174"></a>
-<span class="sourceLineNo">175</span>    this.maxReadPointToTrackVersions = readPointToUse;<a name="line.175"></a>
-<span class="sourceLineNo">176</span>    this.timeToPurgeDeletes = scanInfo.getTimeToPurgeDeletes();<a name="line.176"></a>
-<span class="sourceLineNo">177</span>    this.ttl = oldestUnexpiredTS;<a name="line.177"></a>
-<span class="sourceLineNo">178</span><a name="line.178"></a>
-<span class="sourceLineNo">179</span>    /* how to deal with deletes */<a name="line.179"></a>
-<span class="sourceLineNo">180</span>    this.isUserScan = scanType == ScanType.USER_SCAN;<a name="line.180"></a>
-<span class="sourceLineNo">181</span>    // keep deleted cells: if compaction or raw scan<a name="line.181"></a>
-<span class="sourceLineNo">182</span>    this.keepDeletedCells = scan.isRaw() ? KeepDeletedCells.TRUE :<a name="line.182"></a>
-<span class="sourceLineNo">183</span>      isUserScan ? KeepDeletedCells.FALSE : scanInfo.getKeepDeletedCells();<a name="line.183"></a>
-<span class="sourceLineNo">184</span>    // retain deletes: if minor compaction or raw scanisDone<a name="line.184"></a>
-<span class="sourceLineNo">185</span>    this.retainDeletesInOutput = scanType == ScanType.COMPACT_RETAIN_DELETES || scan.isRaw();<a name="line.185"></a>
-<span class="sourceLineNo">186</span>    // seePastDeleteMarker: user initiated scans<a name="line.186"></a>
-<span class="sourceLineNo">187</span>    this.seePastDeleteMarkers =<a name="line.187"></a>
-<span class="sourceLineNo">188</span>        scanInfo.getKeepDeletedCells() != KeepDeletedCells.FALSE &amp;&amp; isUserScan;<a name="line.188"></a>
-<span class="sourceLineNo">189</span><a name="line.189"></a>
-<span class="sourceLineNo">190</span>    int maxVersions =<a name="line.190"></a>
-<span class="sourceLineNo">191</span>        scan.isRaw() ? scan.getMaxVersions() : Math.min(scan.getMaxVersions(),<a name="line.191"></a>
-<span class="sourceLineNo">192</span>          scanInfo.getMaxVersions());<a name="line.192"></a>
-<span class="sourceLineNo">193</span><a name="line.193"></a>
-<span class="sourceLineNo">194</span>    // Single branch to deal with two types of reads (columns vs all in family)<a name="line.194"></a>
-<span class="sourceLineNo">195</span>    if (columns == null || columns.size() == 0) {<a name="line.195"></a>
-<span class="sourceLineNo">196</span>      // there is always a null column in the wildcard column query.<a name="line.196"></a>
-<span class="sourceLineNo">197</span>      hasNullColumn = true;<a name="line.197"></a>
+<span class="sourceLineNo">163</span>    TimeRange timeRange = scan.getColumnFamilyTimeRange().get(scanInfo.getFamily());<a name="line.163"></a>
+<span class="sourceLineNo">164</span>    if (timeRange == null) {<a name="line.164"></a>
+<span class="sourceLineNo">165</span>      this.tr = scan.getTimeRange();<a name="line.165"></a>
+<span class="sourceLineNo">166</span>    } else {<a name="line.166"></a>
+<span class="sourceLineNo">167</span>      this.tr = timeRange;<a name="line.167"></a>
+<span class="sourceLineNo">168</span>    }<a name="line.168"></a>
+<span class="sourceLineNo">169</span>    this.rowComparator = scanInfo.getComparator();<a name="line.169"></a>
+<span class="sourceLineNo">170</span>    this.regionCoprocessorHost = regionCoprocessorHost;<a name="line.170"></a>
+<span class="sourceLineNo">171</span>    this.deletes =  instantiateDeleteTracker();<a name="line.171"></a>
+<span class="sourceLineNo">172</span>    this.stopRow = scan.getStopRow();<a name="line.172"></a>
+<span class="sourceLineNo">173</span>    this.startKey = CellUtil.createFirstDeleteFamilyCellOnRow(scan.getStartRow(),<a name="line.173"></a>
+<span class="sourceLineNo">174</span>        scanInfo.getFamily());<a name="line.174"></a>
+<span class="sourceLineNo">175</span>    this.filter = scan.getFilter();<a name="line.175"></a>
+<span class="sourceLineNo">176</span>    this.earliestPutTs = earliestPutTs;<a name="line.176"></a>
+<span class="sourceLineNo">177</span>    this.oldestUnexpiredTS = oldestUnexpiredTS;<a name="line.177"></a>
+<span class="sourceLineNo">178</span>    this.now = now;<a name="line.178"></a>
+<span class="sourceLineNo">179</span><a name="line.179"></a>
+<span class="sourceLineNo">180</span>    this.maxReadPointToTrackVersions = readPointToUse;<a name="line.180"></a>
+<span class="sourceLineNo">181</span>    this.timeToPurgeDeletes = scanInfo.getTimeToPurgeDeletes();<a name="line.181"></a>
+<span class="sourceLineNo">182</span>    this.ttl = oldestUnexpiredTS;<a name="line.182"></a>
+<span class="sourceLineNo">183</span><a name="line.183"></a>
+<span class="sourceLineNo">184</span>    /* how to deal with deletes */<a name="line.184"></a>
+<span class="sourceLineNo">185</span>    this.isUserScan = scanType == ScanType.USER_SCAN;<a name="line.185"></a>
+<span class="sourceLineNo">186</span>    // keep deleted cells: if compaction or raw scan<a name="line.186"></a>
+<span class="sourceLineNo">187</span>    this.keepDeletedCells = scan.isRaw() ? KeepDeletedCells.TRUE :<a name="line.187"></a>
+<span class="sourceLineNo">188</span>      isUserScan ? KeepDeletedCells.FALSE : scanInfo.getKeepDeletedCells();<a name="line.188"></a>
+<span class="sourceLineNo">189</span>    // retain deletes: if minor compaction or raw scanisDone<a name="line.189"></a>
+<span class="sourceLineNo">190</span>    this.retainDeletesInOutput = scanType == ScanType.COMPACT_RETAIN_DELETES || scan.isRaw();<a name="line.190"></a>
+<span class="sourceLineNo">191</span>    // seePastDeleteMarker: user initiated scans<a name="line.191"></a>
+<span class="sourceLineNo">192</span>    this.seePastDeleteMarkers =<a name="line.192"></a>
+<span class="sourceLineNo">193</span>        scanInfo.getKeepDeletedCells() != KeepDeletedCells.FALSE &amp;&amp; isUserScan;<a name="line.193"></a>
+<span class="sourceLineNo">194</span><a name="line.194"></a>
+<span class="sourceLineNo">195</span>    int maxVersions =<a name="line.195"></a>
+<span class="sourceLineNo">196</span>        scan.isRaw() ? scan.getMaxVersions() : Math.min(scan.getMaxVersions(),<a name="line.196"></a>
+<span class="sourceLineNo">197</span>          scanInfo.getMaxVersions());<a name="line.197"></a>
 <span class="sourceLineNo">198</span><a name="line.198"></a>
-<span class="sourceLineNo">199</span>      // use a specialized scan for wildcard column tracker.<a name="line.199"></a>
-<span class="sourceLineNo">200</span>      this.columns = new ScanWildcardColumnTracker(<a name="line.200"></a>
-<span class="sourceLineNo">201</span>          scanInfo.getMinVersions(), maxVersions, oldestUnexpiredTS);<a name="line.201"></a>
-<span class="sourceLineNo">202</span>    } else {<a name="line.202"></a>
-<span class="sourceLineNo">203</span>      // whether there is null column in the explicit column query<a name="line.203"></a>
-<span class="sourceLineNo">204</span>      hasNullColumn = (columns.first().length == 0);<a name="line.204"></a>
-<span class="sourceLineNo">205</span><a name="line.205"></a>
-<span class="sourceLineNo">206</span>      // We can share the ExplicitColumnTracker, diff is we reset<a name="line.206"></a>
-<span class="sourceLineNo">207</span>      // between rows, not between storefiles.<a name="line.207"></a>
-<span class="sourceLineNo">208</span>      this.columns = new ExplicitColumnTracker(columns, scanInfo.getMinVersions(), maxVersions,<a name="line.208"></a>
-<span class="sourceLineNo">209</span>          oldestUnexpiredTS);<a name="line.209"></a>
-<span class="sourceLineNo">210</span>    }<a name="line.210"></a>
-<span class="sourceLineNo">211</span>    this.isReversed = scan.isReversed();<a name="line.211"></a>
-<span class="sourceLineNo">212</span>  }<a name="line.212"></a>
-<span class="sourceLineNo">213</span><a name="line.213"></a>
-<span class="sourceLineNo">214</span>  private DeleteTracker instantiateDeleteTracker() throws IOException {<a name="line.214"></a>
-<span class="sourceLineNo">215</span>    DeleteTracker tracker = new ScanDeleteTracker();<a name="line.215"></a>
-<span class="sourceLineNo">216</span>    if (regionCoprocessorHost != null) {<a name="line.216"></a>
-<span class="sourceLineNo">217</span>      tracker = regionCoprocessorHost.postInstantiateDeleteTracker(tracker);<a name="line.217"></a>
-<span class="sourceLineNo">218</span>    }<a name="line.218"></a>
-<span class="sourceLineNo">219</span>    return tracker;<a name="line.219"></a>
-<span class="sourceLineNo">220</span>  }<a name="line.220"></a>
-<span class="sourceLineNo">221</span><a name="line.221"></a>
-<span class="sourceLineNo">222</span>  /**<a name="line.222"></a>
-<span class="sourceLineNo">223</span>   * Construct a QueryMatcher for a scan that drop deletes from a limited range of rows.<a name="line.223"></a>
-<span class="sourceLineNo">224</span>   * @param scan<a name="line.224"></a>
-<span class="sourceLineNo">225</span>   * @param scanInfo The store's immutable scan info<a name="line.225"></a>
-<span class="sourceLineNo">226</span>   * @param columns<a name="line.226"></a>
-<span class="sourceLineNo">227</span>   * @param earliestPutTs Earliest put seen in any of the store files.<a name="line.227"></a>
-<span class="sourceLineNo">228</span>   * @param oldestUnexpiredTS the oldest timestamp we are interested in, based on TTL<a name="line.228"></a>
-<span class="sourceLineNo">229</span>   * @param now the current server time<a name="line.229"></a>
-<span class="sourceLineNo">230</span>   * @param dropDeletesFromRow The inclusive left bound of the range; can be EMPTY_START_ROW.<a name="line.230"></a>
-<span class="sourceLineNo">231</span>   * @param dropDeletesToRow The exclusive right bound of the range; can be EMPTY_END_ROW.<a name="line.231"></a>
-<span class="sourceLineNo">232</span>   * @param regionCoprocessorHost <a name="line.232"></a>
-<span class="sourceLineNo">233</span>   * @throws IOException <a name="line.233"></a>
-<span class="sourceLineNo">234</span>   */<a name="line.234"></a>
-<span class="sourceLineNo">235</span>  public ScanQueryMatcher(Scan scan, ScanInfo scanInfo, NavigableSet&lt;byte[]&gt; columns,<a name="line.235"></a>
-<span class="sourceLineNo">236</span>      long readPointToUse, long earliestPutTs, long oldestUnexpiredTS, long now,<a name="line.236"></a>
-<span class="sourceLineNo">237</span>      byte[] dropDeletesFromRow, byte[] dropDeletesToRow,<a name="line.237"></a>
-<span class="sourceLineNo">238</span>      RegionCoprocessorHost regionCoprocessorHost) throws IOException {<a name="line.238"></a>
-<span class="sourceLineNo">239</span>    this(scan, scanInfo, columns, ScanType.COMPACT_RETAIN_DELETES, readPointToUse, earliestPutTs,<a name="line.239"></a>
-<span class="sourceLineNo">240</span>        oldestUnexpiredTS, now, regionCoprocessorHost);<a name="line.240"></a>
-<span class="sourceLineNo">241</span>    Preconditions.checkArgument((dropDeletesFromRow != null) &amp;&amp; (dropDeletesToRow != null));<a name="line.241"></a>
-<span class="sourceLineNo">242</span>    this.dropDeletesFromRow = dropDeletesFromRow;<a name="line.242"></a>
-<span class="sourceLineNo">243</span>    this.dropDeletesToRow = dropDeletesToRow;<a name="line.243"></a>
-<span class="sourceLineNo">244</span>  }<a name="line.244"></a>
-<span class="sourceLineNo">245</span><a name="line.245"></a>
-<span class="sourceLineNo">246</span>  /*<a name="line.246"></a>
-<span class="sourceLineNo">247</span>   * Constructor for tests<a name="line.247"></a>
-<span class="sourceLineNo">248</span>   */<a name="line.248"></a>
-<span class="sourceLineNo">249</span>  ScanQueryMatcher(Scan scan, ScanInfo scanInfo,<a name="line.249"></a>
-<span class="sourceLineNo">250</span>      NavigableSet&lt;byte[]&gt; columns, long oldestUnexpiredTS, long now) throws IOException {<a name="line.250"></a>
-<span class="sourceLineNo">251</span>    this(scan, scanInfo, columns, ScanType.USER_SCAN,<a name="line.251"></a>
-<span class="sourceLineNo">252</span>          Long.MAX_VALUE, /* max Readpoint to track versions */<a name="line.252"></a>
-<span class="sourceLineNo">253</span>        HConstants.LATEST_TIMESTAMP, oldestUnexpiredTS, now, null);<a name="line.253"></a>
-<span class="sourceLineNo">254</span>  }<a name="line.254"></a>
-<span class="sourceLineNo">255</span><a name="line.255"></a>
-<span class="sourceLineNo">256</span>  /**<a name="line.256"></a>
-<span class="sourceLineNo">257</span>   *<a name="line.257"></a>
-<span class="sourceLineNo">258</span>   * @return  whether there is an null column in the query<a name="line.258"></a>
-<span class="sourceLineNo">259</span>   */<a name="line.259"></a>
-<span class="sourceLineNo">260</span>  public boolean hasNullColumnInQuery() {<a name="line.260"></a>
-<span class="sourceLineNo">261</span>    return hasNullColumn;<a name="line.261"></a>
-<span class="sourceLineNo">262</span>  }<a name="line.262"></a>
-<span class="sourceLineNo">263</span><a name="line.263"></a>
-<span class="sourceLineNo">264</span>  /**<a name="line.264"></a>
-<span class="sourceLineNo">265</span>   * Determines if the caller should do one of several things:<a name="line.265"></a>
-<span class="sourceLineNo">266</span>   * - seek/skip to the next row (MatchCode.SEEK_NEXT_ROW)<a name="line.266"></a>
-<span class="sourceLineNo">267</span>   * - seek/skip to the next column (MatchCode.SEEK_NEXT_COL)<a name="line.267"></a>
-<span class="sourceLineNo">268</span>   * - include the current KeyValue (MatchCode.INCLUDE)<a name="line.268"></a>
-<span class="sourceLineNo">269</span>   * - ignore the current KeyValue (MatchCode.SKIP)<a name="line.269"></a>
-<span class="sourceLineNo">270</span>   * - got to the next row (MatchCode.DONE)<a name="line.270"></a>
-<span class="sourceLineNo">271</span>   *<a name="line.271"></a>
-<span class="sourceLineNo">272</span>   * @param cell KeyValue to check<a name="line.272"></a>
-<span class="sourceLineNo">273</span>   * @return The match code instance.<a name="line.273"></a>
-<span class="sourceLineNo">274</span>   * @throws IOException in case there is an internal consistency problem<a name="line.274"></a>
-<span class="sourceLineNo">275</span>   *      caused by a data corruption.<a name="line.275"></a>
-<span class="sourceLineNo">276</span>   */<a name="line.276"></a>
-<span class="sourceLineNo">277</span>  public MatchCode match(Cell cell) throws IOException {<a name="line.277"></a>
-<span class="sourceLineNo">278</span>    if (filter != null &amp;&amp; filter.filterAllRemaining()) {<a name="line.278"></a>
-<span class="sourceLineNo">279</span>      return MatchCode.DONE_SCAN;<a name="line.279"></a>
-<span class="sourceLineNo">280</span>    }<a name="line.280"></a>
-<span class="sourceLineNo">281</span>    int ret = this.rowComparator.compareRows(curCell, cell);<a name="line.281"></a>
-<span class="sourceLineNo">282</span>    if (!this.isReversed) {<a name="line.282"></a>
-<span class="sourceLineNo">283</span>      if (ret &lt;= -1) {<a name="line.283"></a>
-<span class="sourceLineNo">284</span>        return MatchCode.DONE;<a name="line.284"></a>
-<span class="sourceLineNo">285</span>      } else if (ret &gt;= 1) {<a name="line.285"></a>
-<span class="sourceLineNo">286</span>        // could optimize this, if necessary?<a name="line.286"></a>
-<span class="sourceLineNo">287</span>        // Could also be called SEEK_TO_CURRENT_ROW, but this<a name="line.287"></a>
-<span class="sourceLineNo">288</span>        // should be rare/never happens.<a name="line.288"></a>
-<span class="sourceLineNo">289</span>        return MatchCode.SEEK_NEXT_ROW;<a name="line.289"></a>
-<span class="sourceLineNo">290</span>      }<a name="line.290"></a>
-<span class="sourceLineNo">291</span>    } else {<a name="line.291"></a>
-<span class="sourceLineNo">292</span>      if (ret &lt;= -1) {<a name="line.292"></a>
-<span class="sourceLineNo">293</span>        return MatchCode.SEEK_NEXT_ROW;<a name="line.293"></a>
-<span class="sourceLineNo">294</span>      } else if (ret &gt;= 1) {<a name="line.294"></a>
-<span class="sourceLineNo">295</span>        return MatchCode.DONE;<a name="line.295"></a>
-<span class="sourceLineNo">296</span>      }<a name="line.296"></a>
-<span class="sourceLineNo">297</span>    }<a name="line.297"></a>
-<span class="sourceLineNo">298</span><a name="line.298"></a>
-<span class="sourceLineNo">299</span>    // optimize case.<a name="line.299"></a>
-<span class="sourceLineNo">300</span>    if (this.stickyNextRow)<a name="line.300"></a>
-<span class="sourceLineNo">301</span>      return MatchCode.SEEK_NEXT_ROW;<a name="line.301"></a>
-<span class="sourceLineNo">302</span><a name="line.302"></a>
-<span class="sourceLineNo">303</span>    if (this.columns.done()) {<a name="line.303"></a>
-<span class="sourceLineNo">304</span>      stickyNextRow = true;<a name="line.304"></a>
-<span class="sourceLineNo">305</span>      return MatchCode.SEEK_NEXT_ROW;<a name="line.305"></a>
-<span class="sourceLineNo">306</span>    }<a name="line.306"></a>
+<span class="sourceLineNo">199</span>    // Single branch to deal with two types of reads (columns vs all in family)<a name="line.199"></a>
+<span class="sourceLineNo">200</span>    if (columns == null || columns.size() == 0) {<a name="line.200"></a>
+<span class="sourceLineNo">201</span>      // there is always a null column in the wildcard column query.<a name="line.201"></a>
+<span class="sourceLineNo">202</span>      hasNullColumn = true;<a name="line.202"></a>
+<span class="sourceLineNo">203</span><a name="line.203"></a>
+<span class="sourceLineNo">204</span>      // use a specialized scan for wildcard column tracker.<a name="line.204"></a>
+<span class="sourceLineNo">205</span>      this.columns = new ScanWildcardColumnTracker(<a name="line.205"></a>
+<span class="sourceLineNo">206</span>          scanInfo.getMinVersions(), maxVersions, oldestUnexpiredTS);<a name="line.206"></a>
+<span class="sourceLineNo">207</span>    } else {<a name="line.207"></a>
+<span class="sourceLineNo">208</span>      // whether there is null column in the explicit column query<a name="line.208"></a>
+<span class="sourceLineNo">209</span>      hasNullColumn = (columns.first().length == 0);<a name="line.209"></a>
+<span class="sourceLineNo">210</span><a name="line.210"></a>
+<span class="sourceLineNo">211</span>      // We can share the ExplicitColumnTracker, diff is we reset<a name="line.211"></a>
+<span class="sourceLineNo">212</span>      // between rows, not between storefiles.<a name="line.212"></a>
+<span class="sourceLineNo">213</span>      this.columns = new ExplicitColumnTracker(columns, scanInfo.getMinVersions(), maxVersions,<a name="line.213"></a>
+<span class="sourceLineNo">214</span>          oldestUnexpiredTS);<a name="line.214"></a>
+<span class="sourceLineNo">215</span>    }<a name="line.215"></a>
+<span class="sourceLineNo">216</span>    this.isReversed = scan.isReversed();<a name="line.216"></a>
+<span class="sourceLineNo">217</span>  }<a name="line.217"></a>
+<span class="sourceLineNo">218</span><a name="line.218"></a>
+<span class="sourceLineNo">219</span>  private DeleteTracker instantiateDeleteTracker() throws IOException {<a name="line.219"></a>
+<span class="sourceLineNo">220</span>    DeleteTracker tracker = new ScanDeleteTracker();<a name="line.220"></a>
+<span class="sourceLineNo">221</span>    if (regionCoprocessorHost != null) {<a name="line.221"></a>
+<span class="sourceLineNo">222</span>      tracker = regionCoprocessorHost.postInstantiateDeleteTracker(tracker);<a name="line.222"></a>
+<span class="sourceLineNo">223</span>    }<a name="line.223"></a>
+<span class="sourceLineNo">224</span>    return tracker;<a name="line.224"></a>
+<span class="sourceLineNo">225</span>  }<a name="line.225"></a>
+<span class="sourceLineNo">226</span><a name="line.226"></a>
+<span class="sourceLineNo">227</span>  /**<a name="line.227"></a>
+<span class="sourceLineNo">228</span>   * Construct a QueryMatcher for a scan that drop deletes from a limited range of rows.<a name="line.228"></a>
+<span class="sourceLineNo">229</span>   * @param scan<a name="line.229"></a>
+<span class="sourceLineNo">230</span>   * @param scanInfo The store's immutable scan info<a name="line.230"></a>
+<span class="sourceLineNo">231</span>   * @param columns<a name="line.231"></a>
+<span class="sourceLineNo">232</span>   * @param earliestPutTs Earliest put seen in any of the store files.<a name="line.232"></a>
+<span class="sourceLineNo">233</span>   * @param oldestUnexpiredTS the oldest timestamp we are interested in, based on TTL<a name="line.233"></a>
+<span class="sourceLineNo">234</span>   * @param now the current server time<a name="line.234"></a>
+<span class="sourceLineNo">235</span>   * @param dropDeletesFromRow The inclusive left bound of the range; can be EMPTY_START_ROW.<a name="line.235"></a>
+<span class="sourceLineNo">236</span>   * @param dropDeletesToRow The exclusive right bound of the range; can be EMPTY_END_ROW.<a name="line.236"></a>
+<span class="sourceLineNo">237</span>   * @param regionCoprocessorHost <a name="line.237"></a>
+<span class="sourceLineNo">238</span>   * @throws IOException <a name="line.238"></a>
+<span class="sourceLineNo">239</span>   */<a name="line.239"></a>
+<span class="sourceLineNo">240</span>  public ScanQueryMatcher(Scan scan, ScanInfo scanInfo, NavigableSet&lt;byte[]&gt; columns,<a name="line.240"></a>
+<span class="sourceLineNo">241</span>      long readPointToUse, long earliestPutTs, long oldestUnexpiredTS, long now,<a name="line.241"></a>
+<span class="sourceLineNo">242</span>      byte[] dropDeletesFromRow, byte[] dropDeletesToRow,<a name="line.242"></a>
+<span class="sourceLineNo">243</span>      RegionCoprocessorHost regionCoprocessorHost) throws IOException {<a name="line.243"></a>
+<span class="sourceLineNo">244</span>    this(scan, scanInfo, columns, ScanType.COMPACT_RETAIN_DELETES, readPointToUse, earliestPutTs,<a name="line.244"></a>
+<span class="sourceLineNo">245</span>        oldestUnexpiredTS, now, regionCoprocessorHost);<a name="line.245"></a>
+<span class="sourceLineNo">246</span>    Preconditions.checkArgument((dropDeletesFromRow != null) &amp;&amp; (dropDeletesToRow != null));<a name="line.246"></a>
+<span class="sourceLineNo">247</span>    this.dropDeletesFromRow = dropDeletesFromRow;<a name="line.247"></a>
+<span class="sourceLineNo">248</span>    this.dropDeletesToRow = dropDeletesToRow;<a name="line.248"></a>
+<span class="sourceLineNo">249</span>  }<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>   * Constructor for tests<a name="line.252"></a>
+<span class="sourceLineNo">253</span>   */<a name="line.253"></a>
+<span class="sourceLineNo">254</span>  ScanQueryMatcher(Scan scan, ScanInfo scanInfo,<a name="line.254"></a>
+<span class="sourceLineNo">255</span>      NavigableSet&lt;byte[]&gt; columns, long oldestUnexpiredTS, long now) throws IOException {<a name="line.255"></a>
+<span class="sourceLineNo">256</span>    this(scan, scanInfo, columns, ScanType.USER_SCAN,<a name="line.256"></a>
+<span class="sourceLineNo">257</span>          Long.MAX_VALUE, /* max Readpoint to track versions */<a name="line.257"></a>
+<span class="sourceLineNo">258</span>        HConstants.LATEST_TIMESTAMP, oldestUnexpiredTS, now, null);<a name="line.258"></a>
+<span class="sourceLineNo">259</span>  }<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>   *<a name="line.262"></a>
+<span class="sourceLineNo">263</span>   * @return  whether there is an null column in the query<a name="line.263"></a>
+<span class="sourceLineNo">264</span>   */<a name="line.264"></a>
+<span class="sourceLineNo">265</span>  public boolean hasNullColumnInQuery() {<a name="line.265"></a>
+<span class="sourceLineNo">266</span>    return hasNullColumn;<a name="line.266"></a>
+<span class="sourceLineNo">267</span>  }<a name="line.267"></a>
+<span class="sourceLineNo">268</span><a name="line.268"></a>
+<span class="sourceLineNo">269</span>  /**<a name="line.269"></a>
+<span class="sourceLineNo">270</span>   * Determines if the caller should do one of several things:<a name="line.270"></a>
+<span class="sourceLineNo">271</span>   * - seek/skip to the next row (MatchCode.SEEK_NEXT_ROW)<a name="line.271"></a>
+<span class="sourceLineNo">272</span>   * - seek/skip to the next column (MatchCode.SEEK_NEXT_COL)<a name="line.272"></a>
+<span class="sourceLineNo">273</span>   * - include the current KeyValue (MatchCode.INCLUDE)<a name="line.273"></a>
+<span class="sourceLineNo">274</span>   * - ignore the current KeyValue (MatchCode.SKIP)<a name="line.274"></a>
+<span class="sourceLineNo">275</span>   * - got to the next row (MatchCode.DONE)<a name="line.275"></a>
+<span class="sourceLineNo">276</span>   *<a name="line.276"></a>
+<span class="sourceLineNo">277</span>   * @param cell KeyValue to check<a name="line.277"></a>
+<span class="sourceLineNo">278</span>   * @return The match code instance.<a name="line.278"></a>
+<span class="sourceLineNo">279</span>   * @throws IOException in case there is an internal consistency problem<a name="line.279"></a>
+<span class="sourceLineNo">280</span>   *      caused by a data corruption.<a name="line.280"></a>
+<span class="sourceLineNo">281</span>   */<a name="line.281"></a>
+<span class="sourceLineNo">282</span>  public MatchCode match(Cell cell) throws IOException {<a name="line.282"></a>
+<span class="sourceLineNo">283</span>      if (filter != null &amp;&amp; filter.filterAllRemaining()) {<a name="line.283"></a>
+<span class="sourceLineNo">284</span>      return MatchCode.DONE_SCAN;<a name="line.284"></a>
+<span class="sourceLineNo">285</span>    }<a name="line.285"></a>
+<span class="sourceLineNo">286</span>    int ret = this.rowComparator.compareRows(curCell, cell);<a name="line.286"></a>
+<span class="sourceLineNo">287</span>    if (!this.isReversed) {<a name="line.287"></a>
+<span class="sourceLineNo">288</span>      if (ret &lt;= -1) {<a name="line.288"></a>
+<span class="sourceLineNo">289</span>        return MatchCode.DONE;<a name="line.289"></a>
+<span class="sourceLineNo">290</span>      } else if (ret &gt;= 1) {<a name="line.290"></a>
+<span class="sourceLineNo">291</span>        // could optimize this, if necessary?<a name="line.291"></a>
+<span class="sourceLineNo">292</span>        // Could also be called SEEK_TO_CURRENT_ROW, but this<a name="line.292"></a>
+<span class="sourceLineNo">293</span>        // should be rare/never happens.<a name="line.293"></a>
+<span class="sourceLineNo">294</span>        return MatchCode.SEEK_NEXT_ROW;<a name="line.294"></a>
+<span class="sourceLineNo">295</span>      }<a name="line.295"></a>
+<span class="sourceLineNo">296</span>    } else {<a name="line.296"></a>
+<span class="sourceLineNo">297</span>      if (ret &lt;= -1) {<a name="line.297"></a>
+<span class="sourceLineNo">298</span>        return MatchCode.SEEK_NEXT_ROW;<a name="line.298"></a>
+<span class="sourceLineNo">299</span>      } else if (ret &gt;= 1) {<a name="line.299"></a>
+<span class="sourceLineNo">300</span>        return MatchCode.DONE;<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>    // optimize case.<a name="line.304"></a>
+<span class="sourceLineNo">305</span>    if (this.stickyNextRow)<a name="line.305"></a>
+<span class="sourceLineNo">306</span>      return MatchCode.SEEK_NEXT_ROW;<a name="line.306"></a>
 <span class="sourceLineNo">307</span><a name="line.307"></a>
-<span class="sourceLineNo">308</span>    long timestamp = cell.getTimestamp();<a name="line.308"></a>
-<span class="sourceLineNo">309</span>    // check for early out based on timestamp alone<a name="line.309"></a>
-<span class="sourceLineNo">310</span>    if (columns.isDone(timestamp)) {<a name="line.310"></a>
-<span class="sourceLineNo">311</span>      return columns.getNextRowOrNextColumn(cell);<a name="line.311"></a>
-<span class="sourceLineNo">312</span>    }<a name="line.312"></a>
-<span class="sourceLineNo">313</span>    // check if the cell is expired by cell TTL<a name="line.313"></a>
-<span class="sourceLineNo">314</span>    if (HStore.isCellTTLExpired(cell, this.oldestUnexpiredTS, this.now)) {<a name="line.314"></a>
-<span class="sourceLineNo">315</span>      return MatchCode.SKIP;<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>    /*<a name="line.318"></a>
-<span class="sourceLineNo">319</span>     * The delete logic is pretty complicated now.<a name="line.319"></a>
-<span class="sourceLineNo">320</span>     * This is corroborated by the following:<a name="line.320"></a>
-<span class="sourceLineNo">321</span>     * 1. The store might be instructed to keep deleted rows around.<a name="line.321"></a>
-<span class="sourceLineNo">322</span>     * 2. A scan can optionally see past a delete marker now.<a name="line.322"></a>
-<span class="sourceLineNo">323</span>     * 3. If deleted rows are kept, we have to find out when we can<a name="line.323"></a>
-<span class="sourceLineNo">324</span>     *    remove the delete markers.<a name="line.324"></a>
-<span class="sourceLineNo">325</span>     * 4. Family delete markers are always first (regardless of their TS)<a name="line.325"></a>
-<span class="sourceLineNo">326</span>     * 5. Delete markers should not be counted as version<a name="line.326"></a>
-<span class="sourceLineNo">327</span>     * 6. Delete markers affect puts of the *same* TS<a name="line.327"></a>
-<span class="sourceLineNo">328</span>     * 7. Delete marker need to be version counted together with puts<a name="line.328"></a>
-<span class="sourceLineNo">329</span>     *    they affect<a name="line.329"></a>
-<span class="sourceLineNo">330</span>     */<a name="line.330"></a>
-<span class="sourceLineNo">331</span>    byte typeByte = cell.getTypeByte();<a name="line.331"></a>
-<span class="sourceLineNo">332</span>    long mvccVersion = cell.getSequenceId();<a name="line.332"></a>
-<span class="sourceLineNo">333</span>    if (CellUtil.isDelete(cell)) {<a name="line.333"></a>
-<span class="sourceLineNo">334</span>      if (keepDeletedCells == KeepDeletedCells.FALSE<a name="line.334"></a>
-<span class="sourceLineNo">335</span>          || (keepDeletedCells == KeepDeletedCells.TTL &amp;&amp; timestamp &lt; ttl)) {<a name="line.335"></a>
-<span class="sourceLineNo">336</span>        // first ignore delete markers if the scanner can do so, and the<a name="line.336"></a>
-<span class="sourceLineNo">337</span>        // range does not include the marker<a name="line.337"></a>
-<span class="sourceLineNo">338</span>        //<a name="line.338"></a>
-<span class="sourceLineNo">339</span>        // during flushes and compactions also ignore delete markers newer<a name="line.339"></a>
-<span class="sourceLineNo">340</span>        // than the readpoint of any open scanner, this prevents deleted<a name="line.340"></a>
-<span class="sourceLineNo">341</span>        // rows that could still be seen by a scanner from being collected<a name="line.341"></a>
-<span class="sourceLineNo">342</span>        boolean includeDeleteMarker = seePastDeleteMarkers ?<a name="line.342"></a>
-<span class="sourceLineNo">343</span>            tr.withinTimeRange(timestamp) :<a name="line.343"></a>
-<span class="sourceLineNo">344</span>            tr.withinOrAfterTimeRange(timestamp);<a name="line.344"></a>
-<span class="sourceLineNo">345</span>        if (includeDeleteMarker<a name="line.345"></a>
-<span class="sourceLineNo">346</span>            &amp;&amp; mvccVersion &lt;= maxReadPointToTrackVersions) {<a name="line.346"></a>
-<span class="sourceLineNo">347</span>          this.deletes.add(cell);<a name="line.347"></a>
-<span class="sourceLineNo">348</span>        }<a name="line.348"></a>
-<span class="sourceLineNo">349</span>        // Can't early out now, because DelFam come before any other keys<a name="line.349"></a>
-<span class="sourceLineNo">350</span>      }<a name="line.350"></a>
-<span class="sourceLineNo">351</span>     <a name="line.351"></a>
-<span class="sourceLineNo">352</span>      if ((!isUserScan)<a name="line.352"></a>
-<span class="sourceLineNo">353</span>          &amp;&amp; timeToPurgeDeletes &gt; 0<a name="line.353"></a>
-<span class="sourceLineNo">354</span>          &amp;&amp; (EnvironmentEdgeManager.currentTime() - timestamp) <a name="line.354"></a>
-<span class="sourceLineNo">355</span>            &lt;= timeToPurgeDeletes) {<a name="line.355"></a>
-<span class="sourceLineNo">356</span>        return MatchCode.INCLUDE;<a name="line.356"></a>
-<span class="sourceLineNo">357</span>      } else if (retainDeletesInOutput || mvccVersion &gt; maxReadPointToTrackVersions) {<a name="line.357"></a>
-<span class="sourceLineNo">358</span>        // always include or it is not time yet to check whether it is OK<a name="line.358"></a>
-<span class="sourceLineNo">359</span>        // to purge deltes or not<a name="line.359"></a>
-<span class="sourceLineNo">360</span>        if (!isUserScan) {<a name="line.360"></a>
-<span class="sourceLineNo">361</span>          // if this is not a user scan (compaction), we can filter this deletemarker right here<a name="line.361"></a>
-<span class="sourceLineNo">362</span>          // otherwise (i.e. a "raw" scan) we fall through to normal version and timerange checking<a name="line.362"></a>
-<span class="sourceLineNo">363</span>          return MatchCode.INCLUDE;<a name="line.363"></a>
-<span class="sourceLineNo">364</span>        }<a name="line.364"></a>
-<span class="sourceLineNo">365</span>      } else if (keepDeletedCells == KeepDeletedCells.TRUE<a name="line.365"></a>
-<span class="sourceLineNo">366</span>          || (keepDeletedCells == KeepDeletedCells.TTL &amp;&amp; timestamp &gt;= ttl)) {<a name="line.366"></a>
-<span class="sourceLineNo">367</span>        if (timestamp &lt; earliestPutTs) {<a name="line.367"></a>
-<span class="sourceLineNo">368</span>          // keeping delete rows, but there are no puts older than<a name="line.368"></a>
-<span class="sourceLineNo">369</span>          // this delete in the store files.<a name="line.369"></a>
-<span class="sourceLineNo">370</span>          return columns.getNextRowOrNextColumn(cell);<a name="line.370"></a>
-<span class="sourceLineNo">371</span>        }<a name="line.371"></a>
-<span class="sourceLineNo">372</span>        // else: fall through and do version counting on the<a name="line.372"></a>
-<span class="sourceLineNo">373</span>        // delete markers<a name="line.373"></a>
-<span class="sourceLineNo">374</span>      } else {<a name="line.374"></a>
-<span class="sourceLineNo">375</span>        return MatchCode.SKIP;<a name="line.375"></a>
-<span class="sourceLineNo">376</span>      }<a name="line.376"></a>
-<span class="sourceLineNo">377</span>      // note the following next else if...<a name="line.377"></a>
-<span class="sourceLineNo">378</span>      // delete marker are not subject to other delete markers<a name="line.378"></a>
-<span class="sourceLineNo">379</span>    } else if (!this.deletes.isEmpty()) {<a name="line.379"></a>
-<span class="sourceLineNo">380</span>      DeleteResult deleteResult = deletes.isDeleted(cell);<a name="line.380"></a>
-<span class="sourceLineNo">381</span>      switch (deleteResult) {<a name="line.381"></a>
-<span class="sourceLineNo">382</span>        case FAMILY_DELETED:<a name="line.382"></a>
-<span class="sourceLineNo">383</span>        case COLUMN_DELETED:<a name="line.383"></a>
-<span class="sourceLineNo">384</span>          return columns.getNextRowOrNextColumn(cell);<a name="line.384"></a>
-<span class="sourceLineNo">385</span>        case VERSION_DELETED:<a name="line.385"></a>
-<span class="sourceLineNo">386</span>        case FAMILY_VERSION_DELETED:<a name="line.386"></a>
-<span class="sourceLineNo">387</span>          return MatchCode.SKIP;<a name="line.387"></a>
-<span class="sourceLineNo">388</span>        case NOT_DELETED:<a name="line.388"></a>
-<span class="sourceLineNo">389</span>          break;<a name="line.389"></a>
-<span class="sourceLineNo">390</span>        default:<a name="line.390"></a>
-<span class="sourceLineNo">391</span>          throw new RuntimeException("UNEXPECTED");<a name="line.391"></a>
-<span class="sourceLineNo">392</span>        }<a name="line.392"></a>
-<span class="sourceLineNo">393</span>    }<a name="line.393"></a>
-<span class="sourceLineNo">394</span><a name="line.394"></a>
-<span class="sourceLineNo">395</span>    int timestampComparison = tr.compare(timestamp);<a name="line.395"></a>
-<span class="sourceLineNo">396</span>    if (timestampComparison &gt;= 1) {<a name="line.396"></a>
-<span class="sourceLineNo">397</span>      return MatchCode.SKIP;<a name="line.397"></a>
-<span class="sourceLineNo">398</span>    } else if (timestampComparison &lt;= -1) {<a name="line.398"></a>
-<span class="sourceLineNo">399</span>      return columns.getNextRowOrNextColumn(cell);<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>    // STEP 1: Check if the column is part of the requested columns<a name="line.402"></a>
-<span class="sourceLineNo">403</span>    MatchCode colChecker = columns.checkColumn(cell, typeByte);<a name="line.403"></a>
-<span class="sourceLineNo">404</span>    if (colChecker == MatchCode.INCLUDE) {<a name="line.404"></a>
-<span class="sourceLineNo">405</span>      ReturnCode filterResponse = ReturnCode.SKIP;<a name="line.405"></a>
-<span class="sourceLineNo">406</span>      // STEP 2: Yes, the column is part of the requested columns. Check if filter is present<a name="line.406"></a>
-<span class="sourceLineNo">407</span>      if (filter != null) {<a name="line.407"></a>
-<span class="sourceLineNo">408</span>        // STEP 3: Filter the key value and return if it filters out<a name="line.408"></a>
-<span class="sourceLineNo">409</span>        filterResponse = filter.filterKeyValue(cell);<a name="line.409"></a>
-<span class="sourceLineNo">410</span>        switch (filterResponse) {<a name="line.410"></a>
-<span class="sourceLineNo">411</span>        case SKIP:<a name="line.411"></a>
-<span class="sourceLineNo">412</span>          return MatchCode.SKIP;<a name="line.412"></a>
-<span class="sourceLineNo">413</span>        case NEXT_COL:<a name="line.413"></a>
-<span class="sourceLineNo">414</span>          return columns.getNextRowOrNextColumn(cell);<a name="line.414"></a>
-<span class="sourceLineNo">415</span>        case NEXT_ROW:<a name="line.415"></a>
-<span class="sourceLineNo">416</span>          stickyNextRow = true;<a name="line.416"></a>
-<span class="sourceLineNo">417</span>          return MatchCode.SEEK_NEXT_ROW;<a name="line.417"></a>
-<span class="sourceLineNo">418</span>        case SEEK_NEXT_USING_HINT:<a name="line.418"></a>
-<span class="sourceLineNo">419</span>          return MatchCode.SEEK_NEXT_USING_HINT;<a name="line.419"></a>
-<span class="sourceLineNo">420</span>        default:<a name="line.420"></a>
-<span class="sourceLineNo">421</span>          //It means it is either include or include and seek next<a name="line.421"></a>
-<span class="sourceLineNo">422</span>          break;<a name="line.422"></a>
-<span class="sourceLineNo">423</span>        }<a name="line.423"></a>
-<span class="sourceLineNo">424</span>      }<a name="line.424"></a>
-<span class="sourceLineNo">425</span>      /*<a name="line.425"></a>
-<span class="sourceLineNo">426</span>       * STEP 4: Reaching this step means the column is part of the requested columns and either<a name="line.426"></a>
-<span class="sourceLineNo">427</span>       * the filter is null or the filter has returned INCLUDE or INCLUDE_AND_NEXT_COL response.<a name="line.427"></a>
-<span class="sourceLineNo">428</span>       * Now check the number of versions needed. This method call returns SKIP, INCLUDE,<a name="line.428"></a>
-<span class="sourceLineNo">429</span>       * INCLUDE_AND_SEEK_NEXT_ROW, INCLUDE_AND_SEEK_NEXT_COL.<a name="line.429"></a>
-<span class="sourceLineNo">430</span>       *<a name="line.430"></a>
-<span class="sourceLineNo">431</span>       * FilterResponse            ColumnChecker               Desired behavior<a name="line.431"></a>
-<span class="sourceLineNo">432</span>       * INCLUDE                   SKIP                        row has already been included, SKIP.<a name="line.432"></a>
-<span class="sourceLineNo">433</span>       * INCLUDE                   INCLUDE                     INCLUDE<a name="line.433"></a>
-<span class="sourceLineNo">434</span>       * INCLUDE                   INCLUDE_AND_SEEK_NEXT_COL   INCLUDE_AND_SEEK_NEXT_COL<a name="line.434"></a>
-<span class="sourceLineNo">435</span>       * INCLUDE                   INCLUDE_AND_SEEK_NEXT_ROW   INCLUDE_AND_SEEK_NEXT_ROW<a name="line.435"></a>
-<span class="sourceLineNo">436</span>       * INCLUDE_AND_SEEK_NEXT_COL SKIP                        row has already been included, SKIP.<a name="line.436"></a>
-<span class="sourceLineNo">437</span>       * INCLUDE_AND_SEEK_NEXT_COL INCLUDE                     INCLUDE_AND_SEEK_NEXT_COL<a name="line.437"></a>
-<span class="sourceLineNo">438</span>       * INCLUDE_AND_SEEK_NEXT_COL INCLUDE_AND_SEEK_NEXT_COL   INCLUDE_AND_SEEK_NEXT_COL<a name="line.438"></a>
-<span class="sourceLineNo">439</span>       * INCLUDE_AND_SEEK_NEXT_COL INCLUDE_AND_SEEK_NEXT_ROW   INCLUDE_AND_SEEK_NEXT_ROW<a name="line.439"></a>
-<span class="sourceLineNo">440</span>       *<a name="line.440"></a>
-<span class="sourceLineNo">441</span>       * In all the above scenarios, we return the column checker return value except for<a name="line.441"></a>
-<span class="sourceLineNo">442</span>       * FilterResponse (INCLUDE_AND_SEEK_NEXT_COL) and ColumnChecker(INCLUDE)<a name="line.442"></a>
-<span class="sourceLineNo">443</span>       */<a name="line.443"></a>
-<span class="sourceLineNo">444</span>      colChecker = columns.checkVersions(cell, timestamp, typeByte,<a name="line.444"></a>
-<span class="sourceLineNo">445</span>          mvccVersion &gt; maxReadPointToTrackVersions);<a name="line.445"></a>
-<span class="sourceLineNo">446</span>      //Optimize with stickyNextRow<a name="line.446"></a>
-<span class="sourceLineNo">447</span>      boolean seekNextRowFromEssential = filterResponse == ReturnCode.INCLUDE_AND_SEEK_NEXT_ROW &amp;&amp;<a name="line.447"></a>
-<span class="sourceLineNo">448</span>          filter.isFamilyEssential(cell.getFamilyArray());<a name="line.448"></a>
-<span class="sourceLineNo">449</span>      if (colChecker == MatchCode.INCLUDE_AND_SEEK_NEXT_ROW || seekNextRowFromEssential) {<a name="line.449"></a>
-<span class="sourceLineNo">450</span>        stickyNextRow = true;<a name="line.450"></a>
-<span class="sourceLineNo">451</span>      }<a name="line.451"></a>
-<span class="sourceLineNo">452</span>      if (filterResponse == ReturnCode.INCLUDE_AND_SEEK_NEXT_ROW) {<a name="line.452"></a>
-<span class="sourceLineNo">453</span>        if (colChecker != MatchCode.SKIP) {<a name="line.453"></a>
-<span class="sourceLineNo">454</span>          return MatchCode.INCLUDE_AND_SEEK_NEXT_ROW;<a name="line.454"></a>
-<span class="sourceLineNo">455</span>        }<a name="line.455"></a>
-<span class="sourceLineNo">456</span>        return MatchCode.SEEK_NEXT_ROW;<a name="line.456"></a>
-<span class="sourceLineNo">457</span>      }<a name="line.457"></a>
-<span class="sourceLineNo">458</span>      return (filterResponse == ReturnCode.INCLUDE_AND_NEXT_COL &amp;&amp;<a name="line.458"></a>
-<span class="sourceLineNo">459</span>          colChecker == MatchCode.INCLUDE) ? MatchCode.INCLUDE_AND_SEEK_NEXT_COL<a name="line.459"></a>
-<span class="sourceLineNo">460</span>          : colChecker;<a name="line.460"></a>
-<span class="sourceLineNo">461</span>    }<a name="line.461"></a>
-<span class="sourceLineNo">462</span>    stickyNextRow = (colChecker == MatchCode.SEEK_NEXT_ROW) ? true<a name="line.462"></a>
-<span class="sourceLineNo">463</span>        : stickyNextRow;<a name="line.463"></a>
-<span class="sourceLineNo">464</span>    return colChecker;<a name="line.464"></a>
-<span class="sourceLineNo">465</span>  }<a name="line.465"></a>
-<span class="sourceLineNo">466</span><a name="line.466"></a>
-<span class="sourceLineNo">467</span>  /** Handle partial-drop-deletes. As we match keys in order, when we have a range from which<a name="line.467"></a>
-<span class="sourceLineNo">468</span>   * we can drop deletes, we can set retainDeletesInOutput to false for the duration of this<a name="line.468"></a>
-<span class="sourceLineNo">469</span>   * range only, and maintain consistency. */<a name="line.469"></a>
-<span class="sourceLineNo">470</span>  private void checkPartialDropDeleteRange(Cell curCell) {<a name="line.470"></a>
-<span class="sourceLineNo">471</span>    // If partial-drop-deletes are used, initially, dropDeletesFromRow and dropDeletesToRow<a name="line.471"></a>
-<span class="sourceLineNo">472</span>    // are both set, and the matcher is set to retain deletes. We assume ordered keys. When<a name="line.472"></a>
-<span class="sourceLineNo">473</span>    // dropDeletesFromRow is leq current kv, we start dropping deletes and reset<a name="line.473"></a>
-<span class="sourceLineNo">474</span>    // dropDeletesFromRow; thus the 2nd "if" starts to apply.<a name="line.474"></a>
-<span class="sourceLineNo">475</span>    if ((dropDeletesFromRow != null)<a name="line.475"></a>
-<span class="sourceLineNo">476</span>        &amp;&amp; (Arrays.equals(dropDeletesFromRow, HConstants.EMPTY_START_ROW) ||<a name="line.476"></a>
-<span class="sourceLineNo">477</span>            (CellComparator.COMPARATOR.compareRows(curCell, dropDeletesFromRow, 0,<a name="line.477"></a>
-<span class="sourceLineNo">478</span>                dropDeletesFromRow.length) &gt;= 0))) {<a name="line.478"></a>
-<span class="sourceLineNo">479</span>      retainDeletesInOutput = false;<a name="line.479"></a>
-<span class="sourceLineNo">480</span>      dropDeletesFromRow = null;<a name="line.480"></a>
-<span class="sourceLineNo">481</span>    }<a name="line.481"></a>
-<span class="sourceLineNo">482</span>    // If dropDeletesFromRow is null and dropDeletesToRow is set, we are inside the partial-<a name="line.482"></a>
-<span class="sourceLineNo">483</span>    // drop-deletes range. When dropDeletesToRow is leq current kv, we stop dropping deletes,<a name="line.483"></a>
-<span class="sourceLineNo">484</span>    // and reset dropDeletesToRow so that we don't do any more compares.<a name="line.484"></a>
-<span class="sourceLineNo">485</span>    if ((dropDeletesFromRow == null)<a name="line.485"></a>
-<span class="sourceLineNo">486</span>        &amp;&amp; (dropDeletesToRow != null)<a name="line.486"></a>
-<span class="sourceLineNo">487</span>        &amp;&amp; !Arrays.equals(dropDeletesToRow, HConstants.EMPTY_END_ROW)<a name="line.487"></a>
-<span class="sourceLineNo">488</span>        &amp;&amp; (CellComparator.COMPARATOR<a name="line.488"></a>
-<span class="sourceLineNo">489</span>            .compareRows(curCell, dropDeletesToRow, 0, dropDeletesToRow.length) &gt;= 0)) {<a name="line.489"></a>
-<span class="sourceLineNo">490</span>      retainDeletesInOutput = true;<a name="line.490"></a>
-<span class="sourceLineNo">491</span>      dropDeletesToRow = null;<a name="line.491"></a>
-<span class="sourceLineNo">492</span>    }<a name="line.492"></a>
-<span class="sourceLineNo">493</span>  }<a name="line.493"></a>
-<span class="sourceLineNo">494</span><a name="line.494"></a>
-<span class="sourceLineNo">495</span>  public boolean moreRowsMayExistAfter(Cell kv) {<a name="line.495"></a>
-<span class="sourceLineNo">496</span>    if (this.isReversed) {<a name="line.496"></a>
-<span class="sourceLineNo">497</span>      if (rowComparator.compareRows(kv, stopRow, 0, stopRow.length) &lt;= 0) {<a name="line.497"></a>
-<span class="sourceLineNo">498</span>        return false;<a name="line.498"></a>
-<span class="sourceLineNo">499</span>      } else {<a name="line.499"></a>
-<span class="sourceLineNo">500</span>        return true;<a name="line.500"></a>
-<span class="sourceLineNo">501</span>      }<a name="line.501"></a>
-<span class="sourceLineNo">502</span>    }<a name="line.502"></a>
-<span class="sourceLineNo">503</span>    if (!Bytes.equals(stopRow , HConstants.EMPTY_END_ROW) &amp;&amp;<a name="line.503"></a>
-<span class="sourceLineNo">504</span>        rowComparator.compareRows(kv, stopRow, 0, stopRow.length) &gt;= 0) {<a name="line.504"></a>
-<span class="sourceLineNo">505</span>      // KV &gt;= STOPROW<a name="line.505"></a>
-<span class="sourceLineNo">506</span>      // then NO there is nothing left.<a name="line.506"></a>
-<span class="sourceLineNo">507</span>      return false;<a name="line.507"></a>
-<span class="sourceLineNo">508</span>    } else {<a name="line.508"></a>
-<span class="sourceLineNo">509</span>      return true;<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><a name="line.512"></a>
-<span class="sourceLineNo">513</span>  /**<a name="line.513"></a>
-<span class="sourceLineNo">514</span>   * Set the row when there is change in row<a name="line.514"></a>
-<span class="sourceLineNo">515</span>   * @param curCell<a name="line.515"></a>
-<span class="sourceLineNo">516</span>   */<a name="line.516"></a>
-<span class="sourceLineNo">517</span>  public void setToNewRow(Cell curCell) {<a name="line.517"></a>
-<span class="sourceLineNo">518</span>    checkPartialDropDeleteRange(curCell);<a name="line.518"></a>
-<span class="sourceLineNo">519</span>    this.curCell = curCell;<a name="line.519"></a>
-<span class="sourceLineNo">520</span>    reset();<a name="line.520"></a>
-<span class="sourceLineNo">521</span>  }<a name="line.521"></a>
-<span class="sourceLineNo">522</span><a name="line.522"></a>
-<span class="sourceLineNo">523</span>  public void reset() {<a name="line.523"></a>
-<span class="sourceLineNo">524</span>    this.deletes.reset();<a name="line.524"></a>
-<span class="sourceLineNo">525</span>    this.columns.reset();<a name="line.525"></a>
-<span class="sourceLineNo">526</span><a name="line.526"></a>
-<span class="sourceLineNo">527</span>    stickyNextRow = false;<a name="line.527"></a>
-<span class="sourceLineNo">528</span>  }<a name="line.528"></a>
-<span class="sourceLineNo">529</span><a name="line.529"></a>
-<span class="sourceLineNo">530</span>  /**<a name="line.530"></a>
-<span class="sourceLineNo">531</span>   *<a name="line.531"></a>
-<span class="sourceLineNo">532</span>   * @return the start key<a name="line.532"></a>
-<span class="sourceLineNo">533</span>   */<a name="line.533"></a>
-<span class="sourceLineNo">534</span>  public Cell getStartKey() {<a name="line.534"></a>
-<span class="sourceLineNo">535</span>    return this.startKey;<a name="line.535"></a>
-<span class="sourceLineNo">536</span>  }<a name="line.536"></a>
-<span class="sourceLineNo">537</span><a name="line.537"></a>
-<span class="sourceLineNo">538</span>  /**<a name="line.538"></a>
-<span class="sourceLineNo">539</span>   *<a name="line.539"></a>
-<span class="sourceLineNo">540</span>   * @return the Filter<a name="line.540"></a>
-<span class="sourceLineNo">541</span>   */<a name="line.541"></a>
-<span class="sourceLineNo">542</span>  Filter getFilter() {<a name="line.542"></a>
-<span class="sourceLineNo">543</span>    return this.filter;<a name="line.543"></a>
-<span class="sourceLineNo">544</span>  }<a name="line.544"></a>
-<span class="sourceLineNo">545</span><a name="line.545"></a>
-<span class="sourceLineNo">546</span>  public Cell getNextKeyHint(Cell kv) throws IOException {<a name="line.546"></a>
-<span class="sourceLineNo">547</span>    if (filter == null) {<a name="line.547"></a>
-<span class="sourceLineNo">548</span>      return null;<a name="line.548"></a>
-<span class="sourceLineNo">549</span>    } else {<a name="line.549"></a>
-<span class="sourceLineNo">550</span>      return filter.getNextCellHint(kv);<a name="line.550"></a>
-<span class="sourceLineNo">551</span>    }<a name="line.551"></a>
-<span class="sourceLineNo">552</span>  }<a name="line.552"></a>
-<span class="sourceLineNo">553</span><a name="line.553"></a>
-<span class="sourceLineNo">554</span>  public Cell getKeyForNextColumn(Cell kv) {<a name="line.554"></a>
-<span class="sourceLineNo">555</span>    ColumnCount nextColumn = columns.getColumnHint();<a name="line.555"></a>
-<span class="sourceLineNo">556</span>    if (nextColumn == null) {<a name="line.556"></a>
-<span class="sourceLineNo">557</span>      return CellUtil.createLastOnRowCol(kv);<a name="line.557"></a>
-<span class="sourceLineNo">558</span>    } else {<a name="line.558"></a>
-<span class="sourceLineNo">559</span>      return CellUtil.createFirstOnRowCol(kv, nextColumn.getBuffer(), nextColumn.getOffset(),<a name="line.559"></a>
-<span class="sourceLineNo">560</span>          nextColumn.getLength());<a name="line.560"></a>
-<span class="sourceLineNo">561</span>    }<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>  public Cell getKeyForNextRow(Cell c) {<a name="line.564"></a>
-<span class="sourceLineNo">565</span>    return CellUtil.createLastOnRow(c);<a name="line.565"></a>
-<span class="sourceLineNo">566</span>  }<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>   * @param nextIndexed the key of the next entry in the block index (if any)<a name="line.569"></a>
-<span class="sourceLineNo">570</span>   * @param kv The Cell we're using to calculate the seek key<a name="line.570"></a>
-<span class="sourceLineNo">571</span>   * @return result of the compare between the indexed key and the key portion of the passed cell<a name="line.571"></a>
-<span class="sourceLineNo">572</span>   */<a name="line.572"></a>
-<span class="sourceLineNo">573</span>  public int compareKeyForNextRow(Cell nextIndexed, Cell kv) {<a name="line.573"></a>
-<span class="sourceLineNo">574</span>    return rowComparator.compareKeyBasedOnColHint(nextIndexed, kv, 0, 0, null, 0, 0,<a name="line.574"></a>
-<span class="sourceLineNo">575</span>        HConstants.OLDEST_TIMESTAMP, Type.Minimum.getCode());<a name="line.575"></a>
-<span class="sourceLineNo">576</span>  }<a name="line.576"></a>
-<span class="sourceLineNo">577</span><a name="line.577"></a>
-<span class="sourceLineNo">578</span>  /**<a name="line.578"></a>
-<span class="sourceLineNo">579</span>   * @param nextIndexed the key of the next entry in the block index (if any)<a name="line.579"></a>
-<span class="sourceLineNo">580</span>   * @param currentCell The Cell we're using to calculate the seek key<a name="line.580"></a>
-<span class="sourceLineNo">581</span>   * @return result of the compare between the indexed key and the key portion of the passed cell<a name="line.581"></a>
-<span class="sourceLineNo">582</span>   */<a name="line.582"></a>
-<span class="sourceLineNo">583</span>  public int compareKeyForNextColumn(Cell nextIndexed, Cell currentCell) {<a name="line.583"></a>
-<span class="sourceLineNo">584</span>    ColumnCount nextColumn = columns.getColumnHint();<a name="line.584"></a>
-<span class="sourceLineNo">585</span>    if (nextColumn == null) {<a name="line.585"></a>
-<span class="sourceLineNo">586</span>      return rowComparator.compareKeyBasedOnColHint(nextIndexed, currentCell, 0, 0, null, 0, 0,<a name="line.586"></a>
-<span class="sourceLineNo">587</span>          HConstants.OLDEST_TIMESTAMP, Type.Minimum.getCode());<a name="line.587"></a>
-<span class="sourceLineNo">588</span>    } else {<a name="line.588"></a>
-<span class="sourceLineNo">589</span>      return rowComparator.compareKeyBasedOnColHint(nextIndexed, currentCell,<a name="line.589"></a>
-<span class="sourceLineNo">590</span>          currentCell.getFamilyOffset(), currentCell.getFamilyLength(), nextColumn.getBuffer(),<a name="line.590"></a>
-<span class="sourceLineNo">591</span>          nextColumn.getOffset(), nextColumn.getLength(), HConstants.LATEST_TIMESTAMP,<a name="line.591"></a>
-<span class="sourceLineNo">592</span>          Type.Maximum.getCode());<a name="line.592"></a>
-<span class="sourceLineNo">593</span>    }<a name="line.593"></a>
-<span class="sourceLineNo">594</span>  }<a name="line.594"></a>
-<span class="sourceLineNo">595</span><a name="line.595"></a>
-<span class="sourceLineNo">596</span>  //Used only for testing purposes<a name="line.596"></a>
-<span class="sourceLineNo">597</span>  static MatchCode checkColumn(ColumnTracker columnTracker, byte[] bytes, int offset,<a name="line.597"></a>
-<span class="sourceLineNo">598</span>      int length, long ttl, byte type, boolean ignoreCount) throws IOException {<a name="line.598"></a>
-<span class="sourceLineNo">599</span>    KeyValue kv = KeyValueUtil.createFirstOnRow(HConstants.EMPTY_BYTE_ARRAY, 0, 0,<a name="line.599"></a>
-<span class="sourceLineNo">600</span>        HConstants.EMPTY_BYTE_ARRAY, 0, 0, bytes, offset, length);<a name="line.600"></a>
-<span class="sourceLineNo">601</span>    MatchCode matchCode = columnTracker.checkColumn(kv, type);<a name="line.601"></a>
-<span class="sourceLineNo">602</span>    if (matchCode == MatchCode.INCLUDE) {<a name="line.602"></a>
-<span class="sourceLineNo">603</span>      return columnTracker.checkVersions(kv, ttl, type, ignoreCount);<a name="line.603"></a>
-<span class="sourceLineNo">604</span>    }<a name="line.604"></a>
-<span class="sourceLineNo">605</span>    return matchCode;<a name="line.605"></a>
-<span class="sourceLineNo">606</span>  }<a name="line.606"></a>
-<span class="sourceLineNo">607</span><a name="line.607"></a>
-<span class="sourceLineNo">608</span>  /**<a name="line.608"></a>
-<span class="sourceLineNo">609</span>   * {@link #match} return codes.  These instruct the scanner moving through<a name="line.609"></a>
-<span class="sourceLineNo">610</span>   * memstores and StoreFiles what to do with the current KeyValue.<a name="line.610"></a>
-<span class="sourceLineNo">611</span>   * &lt;p&gt;<a name="line.611"></a>
-<span class="sourceLineNo">612</span>   * Additionally, this contains "early-out" language to tell the scanner to<a name="line.612"></a>
-<span class="sourceLineNo">613</span>   * move on to the next File (memstore or Storefile), or to return immediately.<a name="line.613"></a>
-<span class="sourceLineNo">614</span>   */<a name="line.614"></a>
-<span class="sourceLineNo">615</span>  public static enum MatchCode {<a name="line.615"></a>
-<span class="sourceLineNo">616</span>    /**<a name="line.616"></a>
-<span class="sourceLineNo">617</span>     * Include KeyValue in the returned result<a name="line.617"></a>
-<span class="sourceLineNo">618</span>     */<a name="line.618"></a>
-<span class="sourceLineNo">619</span>    INCLUDE,<a name="line.619"></a>
-<span class="sourceLineNo">620</span><a name="line.620"></a>
+<span class="sourceLineNo">308</span>    if (this.columns.done()) {<a name="line.308"></a>
+<span class="sourceLineNo">309</span>      stickyNextRow = true;<a name="line.309"></a>
+<span class="sourceLineNo">310</span>      return MatchCode.SEEK_NEXT_ROW;<a name="line.310"></a>
+<span class="sourceLineNo">311</span>    }<a name="line.311"></a>
+<span class="sourceLineNo">312</span><a name="line.312"></a>
+<span class="sourceLineNo">313</span>    long timestamp = cell.getTimestamp();<a name="line.313"></a>
+<span class="sourceLineNo">314</span>    // check for early out based on timestamp alone<a name="line.314"></a>
+<span class="sourceLineNo">315</span>    if (columns.isDone(timestamp)) {<a name="line.315"></a>
+<span class="sourceLineNo">316</span>      return columns.getNextRowOrNextColumn(cell);<a name="line.316"></a>
+<span class="sourceLineNo">317</span>    }<a name="line.317"></a>
+<span class="sourceLineNo">318</span>    // check if the cell is expired by cell TTL<a name="line.318"></a>
+<span class="sourceLineNo">319</span>    if (HStore.isCellTTLExpired(cell, this.oldestUnexpiredTS, this.now)) {<a name="line.319"></a>
+<span class="sourceLineNo">320</span>      return MatchCode.SKIP;<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>    /*<a name="line.323"></a>
+<span class="sourceLineNo">324</span>     * The delete logic is pretty complicated now.<a name="line.324"></a>
+<span class="sourceLineNo">325</span>     * This is corroborated by the following:<a name="line.325"></a>
+<span class="sourceLineNo">326</span>     * 1. The store might be instructed to keep deleted rows around.<a name="line.326"></a>
+<span class="sourceLineNo">327</span>     * 2. A scan can optionally see past a delete marker now.<a name="line.327"></a>
+<span class="sourceLineNo">328</span>     * 3. If deleted rows are kept, we have to find out when we can<a name="line.328"></a>
+<span class="sourceLineNo">329</span>     *    remove the delete markers.<a name="line.329"></a>
+<span class="sourceLineNo">330</span>     * 4. Family delete markers are always first (regardless of their TS)<a name="line.330"></a>
+<span class="sourceLineNo">331</span>     * 5. Delete markers should not be counted as version<a name="line.331"></a>
+<span class="sourceLineNo">332</span>     * 6. Delete markers affect puts of the *same* TS<a name="line.332"></a>
+<span class="sourceLineNo">333</span>     * 7. Delete marker need to be version counted together with puts<a name="line.333"></a>
+<span class="sourceLineNo">334</span>     *    they affect<a name="line.334"></a>
+<span class="sourceLineNo">335</span>     */<a name="line.335"></a>
+<span class="sourceLineNo">336</span>    byte typeByte = cell.getTypeByte();<a name="line.336"></a>
+<span class="sourceLineNo">337</span>    long mvccVersion = cell.getSequenceId();<a name="line.337"></a>
+<span class="sourceLineNo">338</span>    if (CellUtil.isDelete(cell)) {<a name="line.338"></a>
+<span class="sourceLineNo">339</span>      if (keepDeletedCells == KeepDeletedCells.FALSE<a name="line.339"></a>
+<span class="sourceLineNo">340</span>          || (keepDeletedCells == KeepDeletedCells.TTL &amp;&amp; timestamp &lt; ttl)) {<a name="line.340"></a>
+<span class="sourceLineNo">341</span>        // first ignore delete markers if the scanner can do so, and the<a name="line.341"></a>
+<span class="sourceLineNo">342</span>        // range does not include the marker<a name="line.342"></a>
+<span class="sourceLineNo">343</span>        //<a name="line.343"></a>
+<span class="sourceLineNo">344</span>        // during flushes and compactions also ignore delete markers newer<a name="line.344"></a>
+<span class="sourceLineNo">345</span>        // than the readpoint of any open scanner, this prevents deleted<a name="line.345"></a>
+<span class="sourceLineNo">346</span>        // rows that could still be seen by a scanner from being collected<a name="line.346"></a>
+<span class="sourceLineNo">347</span>        boolean includeDeleteMarker = seePastDeleteMarkers ?<a name="line.347"></a>
+<span class="sourceLineNo">348</span>            tr.withinTimeRange(timestamp) :<a name="line.348"></a>
+<span class="sourceLineNo">349</span>            tr.withinOrAfterTimeRange(timestamp);<a name="line.349"></a>
+<span class="sourceLineNo">350</span>        if (includeDeleteMarker<a name="line.350"></a>
+<span class="sourceLineNo">351</span>            &amp;&amp; mvccVersion &lt;= maxReadPointToTrackVersions) {<a name="line.351"></a>
+<span class="sourceLineNo">352</span>          this.deletes.add(cell);<a name="line.352"></a>
+<span class="sourceLineNo">353</span>        }<a name="line.353"></a>
+<span class="sourceLineNo">354</span>        // Can't early out now, because DelFam come before any other keys<a name="line.354"></a>
+<span class="sourceLineNo">355</span>      }<a name="line.355"></a>
+<span class="sourceLineNo">356</span>     <a name="line.356"></a>
+<span class="sourceLineNo">357</span>      if ((!isUserScan)<a name="line.357"></a>
+<span class="sourceLineNo">358</span>          &amp;&amp; timeToPurgeDeletes &gt; 0<a name="line.358"></a>
+<span class="sourceLineNo">359</span>          &amp;&amp; (EnvironmentEdgeManager.currentTime() - timestamp) <a name="line.359"></a>
+<span class="sourceLineNo">360</span>            &lt;= timeToPurgeDeletes) {<a name="line.360"></a>
+<span class="sourceLineNo">361</span>        return MatchCode.INCLUDE;<a name="line.361"></a>
+<span class="sourceLineNo">362</span>      } else if (retainDeletesInOutput || mvccVersion &gt; maxReadPointToTrackVersions) {<a name="line.362"></a>
+<span class="sourceLineNo">363</span>        // always include or it is not time yet to check whether it is OK<a name="line.363"></a>
+<span class="sourceLineNo">364</span>        // to purge deltes or not<a name="line.364"></a>
+<span class="sourceLineNo">365</span>        if (!isUserScan) {<a name="line.365"></a>
+<span class="sourceLineNo">366</span>          // if this is not a user scan (compaction), we can filter this deletemarker right here<a name="line.366"></a>
+<span class="sourceLineNo">367</span>          // otherwise (i.e. a "raw" scan) we fall through to normal version and timerange checking<a name="line.367"></a>
+<span class="sourceLineNo">368</span>          return MatchCode.INCLUDE;<a name="line.368"></a>
+<span class="sourceLineNo">369</span>        }<a name="line.369"></a>
+<span class="sourceLineNo">370</span>      } else if (keepDeletedCells == KeepDeletedCells.TRUE<a name="line.370"></a>
+<span class="sourceLineNo">371</span>          || (keepDeletedCells == KeepDeletedCells.TTL &amp;&amp; timestamp &gt;= ttl)) {<a name="line.371"></a>
+<span class="sourceLineNo">372</span>        if (timestamp &lt; earliestPutTs) {<a name="line.372"></a>
+<span class="sourceLineNo">373</span>          // keeping delete rows, but there are no puts older than<a name="line.373"></a>
+<span class="sourceLineNo">374</span>          // this delete in the store files.<a name="line.374"></a>
+<span class="sourceLineNo">375</span>          return columns.getNextRowOrNextColumn(cell);<a name="line.375"></a>
+<span class="sourceLineNo">376</span>        }<a name="line.376"></a>
+<span class="sourceLineNo">377</span>        // else: fall through and do version counting on the<a name="line.377"></a>
+<span class="sourceLineNo">378</span>        // delete markers<a name="line.378"></a>
+<span class="sourceLineNo">379</span>      } else {<a name="line.379"></a>
+<span class="sourceLineNo">380</span>        return MatchCode.SKIP;<a name="line.380"></a>
+<span class="sourceLineNo">381</span>      }<a name="line.381"></a>
+<span class="sourceLineNo">382</span>      // note the following next else if...<a name="line.382"></a>
+<span class="sourceLineNo">383</span>      // delete marker are not subject to other delete markers<a name="line.383"></a>
+<span class="sourceLineNo">384</span>    } else if (!this.deletes.isEmpty()) {<a name="line.384"></a>
+<span class="sourceLineNo">385</span>      DeleteResult deleteResult = deletes.isDeleted(cell);<a name="line.385"></a>
+<span class="sourceLineNo">386</span>      switch (deleteResult) {<a name="line.386"></a>
+<span class="sourceLineNo">387</span>        case FAMILY_DELETED:<a name="line.387"></a>
+<span class="sourceLineNo">388</span>        case COLUMN_DELETED:<a name="line.388"></a>
+<span class="sourceLineNo">389</span>          return columns.getNextRowOrNextColumn(cell);<a name="line.389"></a>
+<span class="sourceLineNo">390</span>        case VERSION_DELETED:<a name="line.390"></a>
+<span class="sourceLineNo">391</span>        case FAMILY_VERSION_DELETED:<a name="line.391"></a>
+<span class="sourceLineNo">392</span>          return MatchCode.SKIP;<a name="line.392"></a>
+<span class="sourceLineNo">393</span>        case NOT_DELETED:<a name="line.393"></a>
+<span class="sourceLineNo">394</span>          break;<a name="line.394"></a>
+<span class="sourceLineNo">395</span>        default:<a name="line.395"></a>
+<span class="sourceLineNo">396</span>          throw new RuntimeException("UNEXPECTED");<a name="line.396"></a>
+<span class="sourceLineNo">397</span>        }<a name="line.397"></a>
+<span class="sourceLineNo">398</span>    }<a name="line.398"></a>
+<span class="sourceLineNo">399</span><a name="line.399"></a>
+<span class="sourceLineNo">400</span>    int timestampComparison = tr.compare(timestamp);<a name="line.400"></a>
+<span class="sourceLineNo">401</span>    if (timestampComparison &gt;= 1) {<a name="line.401"></a>
+<span class="sourceLineNo">402</span>      return MatchCode.SKIP;<a name="line.402"></a>
+<span class="sourceLineNo">403</span>    } else if (timestampComparison &lt;= -1) {<a name="line.403"></a>
+<span class="sourceLineNo">404</span>      return columns.getNextRowOrNextColumn(cell);<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>    // STEP 1: Check if the column is part of the requested columns<a name="line.407"></a>
+<span class="sourceLineNo">408</span>    MatchCode colChecker = columns.checkColumn(cell, typeByte);<a name="line.408"></a>
+<span class="sourceLineNo">409</span>    if (colChecker == MatchCode.INCLUDE) {<a name="line.409"></a>
+<span class="sourceLineNo">410</span>      ReturnCode filterResponse = ReturnCode.SKIP;<a name="line.410"></a>
+<span class="sourceLineNo">411</span>      // STEP 2: Yes, the column is part of the requested columns. Check if filter is present<a name="line.411"></a>
+<span class="sourceLineNo">412</span>      if (filter != null) {<a name="line.412"></a>
+<span class="sourceLineNo">413</span>        // STEP 3: Filter the key value and return if it filters out<a name="line.413"></a>
+<span class="sourceLineNo">414</span>        filterResponse = filter.filterKeyValue(cell);<a name="line.414"></a>
+<span class="sourceLineNo">415</span>        switch (filterResponse) {<a name="line.415"></a>
+<span class="sourceLineNo">416</span>        case SKIP:<a name="line.416"></a>
+<span class="sourceLineNo">417</span>          return MatchCode.SKIP;<a name="line.417"></a>
+<span class="sourceLineNo">418</span>        case NEXT_COL:<a name="line.418"></a>
+<span class="sourceLineNo">419</span>          return columns.getNextRowOrNextColumn(cell);<a name="line.419"></a>
+<span class="sourceLineNo">420</span>        case NEXT_ROW:<a name="line.420"></a>
+<span class="sourceLineNo">421</span>          stickyNextRow = true;<a name="line.421"></a>
+<span class="sourceLineNo">422</span>          return MatchCode.SEEK_NEXT_ROW;<a name="line.422"></a>
+<span class="sourceLineNo">423</span>        case SEEK_NEXT_USING_HINT:<a name="line.423"></a>
+<span class="sourceLineNo">424</span>          return MatchCode.SEEK_NEXT_USING_HINT;<a name="line.424"></a>
+<span class="sourceLineNo">425</span>        default:<a name="line.425"></a>
+<span class="sourceLineNo">426</span>          //It means it is either include or include and seek next<a name="line.426"></a>
+<span class="sourceLineNo">427</span>          break;<a name="line.427"></a>
+<span class="sourceLineNo">428</span>        }<a name="line.428"></a>
+<span class="sourceLineNo">429</span>      }<a name="line.429"></a>
+<span class="sourceLineNo">430</span>      /*<a name="line.430"></a>
+<span class="sourceLineNo">431</span>       * STEP 4: Reaching this step means the column is part of the requested columns and either<a name="line.431"></a>
+<span class="sourceLineNo">432</span>       * the filter is null or the filter has returned INCLUDE or INCLUDE_AND_NEXT_COL response.<a name="line.432"></a>
+<span class="sourceLineNo">433</span>       * Now check the number of versions needed. This method call returns SKIP, INCLUDE,<a name="line.433"></a>
+<span class="sourceLineNo">434</span>       * INCLUDE_AND_SEEK_NEXT_ROW, INCLUDE_AND_SEEK_NEXT_COL.<a name="line.434"></a>
+<span class="sourceLineNo">435</span>       *<a name="line.435"></a>
+<span class="sourceLineNo">436</span>       * FilterResponse            ColumnChecker               Desired behavior<a name="line.436"></a>
+<span class="sourceLineNo">437</span>       * INCLUDE                   SKIP                        row has already been included, SKIP.<a name="line.437"></a>
+<span class="sourceLineNo">438</span>       * INCLUDE                   INCLUDE                     INCLUDE<a name="line.438"></a>
+<span class="sourceLineNo">439</span>       * INCLUDE                   INCLUDE_AND_SEEK_NEXT_COL   INCLUDE_AND_SEEK_NEXT_COL<a name="line.439"></a>
+<span class="sourceLineNo">440</span>       * INCLUDE                   INCLUDE_AND_SEEK_NEXT_ROW   INCLUDE_AND_SEEK_NEXT_ROW<a name="line.440"></a>
+<span class="sourceLineNo">441</span>       * INCLUDE_AND_SEEK_NEXT_COL SKIP                        row has already been included, SKIP.<a name="line.441"></a>
+<span class="sourceLineNo">442</span>       * INCLUDE_AND_SEEK_NEXT_COL INCLUDE                     INCLUDE_AND_SEEK_NEXT_COL<a name="line.442"></a>
+<span class="sourceLineNo">443</span>       * INCLUDE_AND_SEEK_NEXT_COL INCLUDE_AND_SEEK_NEXT_COL   INCLUDE_AND_SEEK_NEXT_COL<a name="line.443"></a>
+<span class="sourceLineNo">444</span>       * INCLUDE_AND_SEEK_NEXT_COL INCLUDE_AND_SEEK_NEXT_ROW   INCLUDE_AND_SEEK_NEXT_ROW<a name="line.444"></a>
+<span class="sourceLineNo">445</span>       *<a name="line.445"></a>
+<span class="sourceLineNo">446</span>       * In all the above scenarios, we return the column checker return value except for<a name="line.446"></a>
+<span class="sourceLineNo">447</span>       * FilterResponse (INCLUDE_AND_SEEK_NEXT_COL) and ColumnChecker(INCLUDE)<a name="line.447"></a>
+<span class="sourceLineNo">448</span>       */<a name="line.448"></a>
+<span class="sourceLineNo">449</span>      colChecker = columns.checkVersions(cell, timestamp, typeByte,<a name="line.449"></a>
+<span class="sourceLineNo">450</span>          mvccVersion &gt; maxReadPointToTrackVersions);<a name="line.450"></a>
+<span class="sourceLineNo">451</span>      //Optimize with stickyNextRow<a name="line.451"></a>
+<span class="sourceLineNo">452</span>      boolean seekNextRowFromEssential = filterResponse == ReturnCode.INCLUDE_AND_SEEK_NEXT_ROW &amp;&amp;<a name="line.452"></a>
+<span class="sourceLineNo">453</span>          filter.isFamilyEssential(cell.getFamilyArray());<a name="line.453"></a>
+<span class="sourceLineNo">454</span>      if (colChecker == MatchCode.INCLUDE_AND_SEEK_NEXT_ROW || seekNextRowFromEssential) {<a name="line.454"></a>
+<span class="sourceLineNo">455</span>        stickyNextRow = true;<a name="line.455"></a>
+<span class="sourceLineNo">456</span>      }<a name="line.456"></a>
+<span class="sourceLineNo">457</span>      if (filterResponse == ReturnCode.INCLUDE_AND_SEEK_NEXT_ROW) {<a name="line.457"></a>
+<span class="sourceLineNo">458</span>        if (colChecker != MatchCode.SKIP) {<a name="line.458"></a>
+<span class="sourceLineNo">459</span>          return MatchCode.INCLUDE_AND_SEEK_NEXT_ROW;<a name="line.459"></a>
+<span class="sourceLineNo">460</span>        }<a name="line.460"></a>
+<span class="sourceLineNo">461</span>        return MatchCode.SEEK_NEXT_ROW;<a name="line.461"></a>
+<span class="sourceLineNo">462</span>      }<a name="line.462"></a>
+<span class="sourceLineNo">463</span>      return (filterResponse == ReturnCode.INCLUDE_AND_NEXT_COL &amp;&amp;<a name="line.463"></a>
+<span class="sourceLineNo">464</span>          colChecker == MatchCode.INCLUDE) ? MatchCode.INCLUDE_AND_SEEK_NEXT_COL<a name="line.464"></a>
+<span class="sourceLineNo">465</span>          : colChecker;<a name="line.465"></a>
+<span class="sourceLineNo">466</span>    }<a name="line.466"></a>
+<span class="sourceLineNo">467</span>    stickyNextRow = (colChecker == MatchCode.SEEK_NEXT_ROW) ? true<a name="line.467"></a>
+<span class="sourceLineNo">468</span>        : stickyNextRow;<a name="line.468"></a>
+<span class="sourceLineNo">469</span>    return colChecker;<a name="line.469"></a>
+<span class="sourceLineNo">470</span>  }<a name="line.470"></a>
+<span class="sourceLineNo">471</span><a name="line.471"></a>
+<span class="sourceLineNo">472</span>  /** Handle partial-drop-deletes. As we match keys in order, when we have a range from which<a name="line.472"></a>
+<span class="sourceLineNo">473</span>   * we can drop deletes, we can set retainDeletesInOutput to false for the duration of this<a name="line.473"></a>
+<span class="sourceLineNo">474</span>   * range only, and maintain consistency. */<a name="line.474"></a>
+<span class="sourceLineNo">475</span>  private void checkPartialDropDeleteRange(Cell curCell) {<a name="line.475"></a>
+<span class="sourceLineNo">476</span>    // If partial-drop-deletes are used, initially, dropDeletesFromRow and dropDeletesToRow<a name="line.476"></a>
+<span class="sourceLineNo">477</span>    // are both set, and the matcher is set to retain deletes. We assume ordered keys. When<a name="line.477"></a>
+<span class="sourceLineNo">478</span>    // dropDeletesFromRow is leq current kv, we start dropping deletes and reset<a name="line.478"></a>
+<span class="sourceLineNo">479</span>    // dropDeletesFromRow; thus the 2nd "if" starts to apply.<a name="line.479"></a>
+<span class="sourceLineNo">480</span>    if ((dropDeletesFromRow != null)<a name="line.480"></a>
+<span class="sourceLineNo">481</span>        &amp;&amp; (Arrays.equals(dropDeletesFromRow, HConstants.EMPTY_START_ROW) ||<a name="line.481"></a>
+<span class="sourceLineNo">482</span>            (CellComparator.COMPARATOR.compareRows(curCell, dropDeletesFromRow, 0,<a name="line.482"></a>
+<span class="sourceLineNo">483</span>                dropDeletesFromRow.length) &gt;= 0))) {<a name="line.483"></a>
+<span class="sourceLineNo">484</span>      retainDeletesInOutput = false;<a name="line.484"></a>
+<span class="sourceLineNo">485</span>      dropDeletesFromRow = null;<a name="line.485"></a>
+<span class="sourceLineNo">486</span>    }<a name="line.486"></a>
+<span class="sourceLineNo">487</span>    // If dropDeletesFromRow is null and dropDeletesToRow is set, we are inside the partial-<a name="line.487"></a>
+<span class="sourceLineNo">488</span>    // drop-deletes range. When dropDeletesToRow is leq current kv, we stop dropping deletes,<a name="line.488"></a>
+<span class="sourceLineNo">489</span>    // and reset dropDeletesToRow so that we don't do any more compares.<a name="line.489"></a>
+<span class="sourceLineNo">490</span>    if ((dropDeletesFromRow == null)<a name="line.490"></a>
+<span class="sourceLineNo">491</span>        &amp;&amp; (dropDeletesToRow != null)<a name="line.491"></a>
+<span class="sourceLineNo">492</span>        &amp;&amp; !Arrays.equals(dropDeletesToRow, HConstants.EMPTY_END_ROW)<a name="line.492"></a>
+<span class="sourceLineNo">493</span>        &amp;&amp; (CellComparator.COMPARATOR<a name="line.493"></a>
+<span class="sourceLineNo">494</span>            .compareRows(curCell, dropDeletesToRow, 0, dropDeletesToRow.length) &gt;= 0)) {<a name="line.494"></a>
+<span class="sourceLineNo">495</span>      retainDeletesInOutput = true;<a name="line.495"></a>
+<span class="sourceLineNo">496</span>      dropDeletesToRow = null;<a name="line.496"></a>
+<span class="sourceLineNo">497</span>    }<a name="line.497"></a>
+<span class="sourceLineNo">498</span>  }<a name="line.498"></a>
+<span class="sourceLineNo">499</span><a name="line.499"></a>
+<span class="sourceLineNo">500</span>  public boolean moreRowsMayExistAfter(Cell kv) {<a name="line.500"></a>
+<span class="sourceLineNo">501</span>    if (this.isReversed) {<a name="line.501"></a>
+<span class="sourceLineNo">502</span>      if (rowComparator.compareRows(kv, stopRow, 0, stopRow.length) &lt;= 0) {<a name="line.502"></a>
+<span class="sourceLineNo">503</span>        return false;<a name="line.503"></a>
+<span class="sourceLineNo">504</span>      } else {<a name="line.504"></a>
+<span class="sourceLineNo">505</span>        return true;<a name="line.505"></a>
+<span class="sourceLineNo">506</span>      }<a name="line.506"></a>
+<span class="sourceLineNo">507</span>    }<a name="line.507"></a>
+<span class="sourceLineNo">508</span>    if (!Bytes.equals(stopRow , HConstants.EMPTY_END_ROW) &amp;&amp;<a name="line.508"></a>
+<span class="sourceLineNo">509</span>        rowComparator.compareRows(kv, stopRow, 0, stopRow.length) &gt;= 0) {<a name="line.509"></a>
+<span class="sourceLineNo">510</span>      // KV &gt;= STOPROW<a name="line.510"></a>
+<span class="sourceLineNo">511</span>      // then NO there is nothing left.<a name="line.511"></a>
+<span class="sourceLineNo">512</span>      return false;<a name="line.512"></a>
+<span class="sourceLineNo">513</span>    } else {<a name="line.513"></a>
+<span class="sourceLineNo">514</span>      return true;<a name="line.514"></a>
+<span class="sourceLineNo">515</span>    }<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>   * Set the row when there is change in row<a name="line.519"></a>
+<span class="sourceLineNo">520</span>   * @param curCell<a name="line.520"></a>
+<span class="sourceLineNo">521</span>   */<a name="line.521"></a>
+<span class="sourceLineNo">522</span>  public void setToNewRow(Cell curCell) {<a name="line.522"></a>
+<span class="sourceLineNo">523</span>    checkPartialDropDeleteRange(curCell);<a name="line.523"></a>
+<span class="sourceLineNo">524</span>    this.curCell = curCell;<a name="line.524"></a>
+<span class="sourceLineNo">525</span>    reset();<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>  public void reset() {<a name="line.528"></a>
+<span class="sourceLineNo">529</span>    this.deletes.reset();<a name="line.529"></a>
+<span class="sourceLineNo">530</span>    this.columns.reset();<a name="line.530"></a>
+<span class="sourceLineNo">531</span><a name="line.531"></a>
+<span class="sourceLineNo">532</span>    stickyNextRow = false;<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>   *<a name="line.536"></a>
+<span class="sourceLineNo">537</span>   * @return the start key<a name="line.537"></a>
+<span class="sourceLineNo">538</span>   */<a name="line.538"></a>
+<span class="sourceLineNo">539</span>  public Cell getStartKey() {<a name="line.539"></a>
+<span class="sourceLineNo">540</span>    return this.startKey;<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>  /**<a name="line.543"></a>
+<span class="sourceLineNo">544</span>   *<a name="line.544"></a>
+<span class="sourceLineNo">545</span>   * @return the Filter<a name="line.545"></a>
+<span class="sourceLineNo">546</span>   */<a name="line.546"></a>
+<span class="sourceLineNo">547</span>  Filter getFilter() {<a name="line.547"></a>
+<span class="sourceLineNo">548</span>    return this.filter;<a name="line.548"></a>
+<span class="sourceLineNo">549</span>  }<a name="line.549"></a>
+<span class="sourceLineNo">550</span><a name="line.550"></a>
+<span class="sourceLineNo">551</span>  public Cell getNextKeyHint(Cell kv) throws IOException {<a name="line.551"></a>
+<span class="sourceLineNo">552</span>    if (filter == null) {<a name="line.552"></a>
+<span class="sourceLineNo">553</span>      return null;<a name="line.553"></a>
+<span class="sourceLineNo">554</span>    } else {<a name="line.554"></a>
+<span class="sourceLineNo">555</span>      return filter.getNextCellHint(kv);<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>  public Cell getKeyForNextColumn(Cell kv) {<a name="line.559"></a>
+<span class="sourceLineNo">560</span>    ColumnCount nextColumn = columns.getColumnHint();<a name="line.560"></a>
+<span class="sourceLineNo">561</span>    if (nextColumn == null) {<a name="line.561"></a>
+<span class="sourceLineNo">562</span>      return CellUtil.createLastOnRowCol(kv);<a name="line.562"></a>
+<span class="sourceLineNo">563</span>    } else {<a name="line.563"></a>
+<span class="sourceLineNo">564</span>      return CellUtil.createFirstOnRowCol(kv, nextColumn.getBuffer(), nextColumn.getOffset(),<a name="line.564"></a>
+<span class="sourceLineNo">565</span>          nextColumn.getLength());<a name="line.565"></a>
+<span class="sourceLineNo">566</span>    }<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>  public Cell getKeyForNextRow(Cell c) {<a name="line.569"></a>
+<span class="sourceLineNo">570</span>    return CellUtil.createLastOnRow(c);<a name="line.570"></a>
+<span class="sourceLineNo">571</span>  }<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>   * @param nextIndexed the key of the next entry in the block index (if any)<a name="line.574"></a>
+<span class="sourceLineNo">575</span>   * @param kv The Cell we're using to calculate the seek key<a name="line.575"></a>
+<span class="sourceLineNo">576</span>   * @return result of the compare between the indexed key and the key portion of the passed cell<a name="line.576"></a>
+<span class="sourceLineNo">577</span>   */<a name="line.577"></a>
+<span class="sourceLineNo">578</span>  public int compareKeyForNextRow(Cell nextIndexed, Cell kv) {<a name="line.578"></a>
+<span class="sourceLin

<TRUNCATED>

Mime
View raw message