hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject [14/52] [partial] hbase-site git commit: Published site at 26a94844f533b95db1f0a58d6a7cc3dc4a7a7098.
Date Sun, 05 Feb 2017 15:49:36 GMT
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/62e361eb/apidocs/src-html/org/apache/hadoop/hbase/client/Scan.html
----------------------------------------------------------------------
diff --git a/apidocs/src-html/org/apache/hadoop/hbase/client/Scan.html b/apidocs/src-html/org/apache/hadoop/hbase/client/Scan.html
index 899e364..c248583 100644
--- a/apidocs/src-html/org/apache/hadoop/hbase/client/Scan.html
+++ b/apidocs/src-html/org/apache/hadoop/hbase/client/Scan.html
@@ -54,965 +54,1135 @@
 <span class="sourceLineNo">046</span>/**<a name="line.46"></a>
 <span class="sourceLineNo">047</span> * Used to perform Scan operations.<a name="line.47"></a>
 <span class="sourceLineNo">048</span> * &lt;p&gt;<a name="line.48"></a>
-<span class="sourceLineNo">049</span> * All operations are identical to {@link Get} with the exception of<a name="line.49"></a>
-<span class="sourceLineNo">050</span> * instantiation.  Rather than specifying a single row, an optional startRow<a name="line.50"></a>
-<span class="sourceLineNo">051</span> * and stopRow may be defined.  If rows are not specified, the Scanner will<a name="line.51"></a>
-<span class="sourceLineNo">052</span> * iterate over all rows.<a name="line.52"></a>
-<span class="sourceLineNo">053</span> * &lt;p&gt;<a name="line.53"></a>
-<span class="sourceLineNo">054</span> * To get all columns from all rows of a Table, create an instance with no constraints; use the<a name="line.54"></a>
-<span class="sourceLineNo">055</span> * {@link #Scan()} constructor. To constrain the scan to specific column families,<a name="line.55"></a>
-<span class="sourceLineNo">056</span> * call {@link #addFamily(byte[]) addFamily} for each family to retrieve on your Scan instance.<a name="line.56"></a>
-<span class="sourceLineNo">057</span> * &lt;p&gt;<a name="line.57"></a>
-<span class="sourceLineNo">058</span> * To get specific columns, call {@link #addColumn(byte[], byte[]) addColumn}<a name="line.58"></a>
-<span class="sourceLineNo">059</span> * for each column to retrieve.<a name="line.59"></a>
-<span class="sourceLineNo">060</span> * &lt;p&gt;<a name="line.60"></a>
-<span class="sourceLineNo">061</span> * To only retrieve columns within a specific range of version timestamps,<a name="line.61"></a>
-<span class="sourceLineNo">062</span> * call {@link #setTimeRange(long, long) setTimeRange}.<a name="line.62"></a>
-<span class="sourceLineNo">063</span> * &lt;p&gt;<a name="line.63"></a>
-<span class="sourceLineNo">064</span> * To only retrieve columns with a specific timestamp, call<a name="line.64"></a>
-<span class="sourceLineNo">065</span> * {@link #setTimeStamp(long) setTimestamp}.<a name="line.65"></a>
-<span class="sourceLineNo">066</span> * &lt;p&gt;<a name="line.66"></a>
-<span class="sourceLineNo">067</span> * To limit the number of versions of each column to be returned, call<a name="line.67"></a>
-<span class="sourceLineNo">068</span> * {@link #setMaxVersions(int) setMaxVersions}.<a name="line.68"></a>
-<span class="sourceLineNo">069</span> * &lt;p&gt;<a name="line.69"></a>
-<span class="sourceLineNo">070</span> * To limit the maximum number of values returned for each call to next(),<a name="line.70"></a>
-<span class="sourceLineNo">071</span> * call {@link #setBatch(int) setBatch}.<a name="line.71"></a>
-<span class="sourceLineNo">072</span> * &lt;p&gt;<a name="line.72"></a>
-<span class="sourceLineNo">073</span> * To add a filter, call {@link #setFilter(org.apache.hadoop.hbase.filter.Filter) setFilter}.<a name="line.73"></a>
-<span class="sourceLineNo">074</span> * &lt;p&gt;<a name="line.74"></a>
-<span class="sourceLineNo">075</span> * Expert: To explicitly disable server-side block caching for this scan,<a name="line.75"></a>
-<span class="sourceLineNo">076</span> * execute {@link #setCacheBlocks(boolean)}.<a name="line.76"></a>
-<span class="sourceLineNo">077</span> * &lt;p&gt;&lt;em&gt;Note:&lt;/em&gt; Usage alters Scan instances. Internally, attributes are updated as the Scan<a name="line.77"></a>
-<span class="sourceLineNo">078</span> * runs and if enabled, metrics accumulate in the Scan instance. Be aware this is the case when<a name="line.78"></a>
-<span class="sourceLineNo">079</span> * you go to clone a Scan instance or if you go to reuse a created Scan instance; safer is create<a name="line.79"></a>
-<span class="sourceLineNo">080</span> * a Scan instance per usage.<a name="line.80"></a>
-<span class="sourceLineNo">081</span> */<a name="line.81"></a>
-<span class="sourceLineNo">082</span>@InterfaceAudience.Public<a name="line.82"></a>
-<span class="sourceLineNo">083</span>@InterfaceStability.Stable<a name="line.83"></a>
-<span class="sourceLineNo">084</span>public class Scan extends Query {<a name="line.84"></a>
-<span class="sourceLineNo">085</span>  private static final Log LOG = LogFactory.getLog(Scan.class);<a name="line.85"></a>
-<span class="sourceLineNo">086</span><a name="line.86"></a>
-<span class="sourceLineNo">087</span>  private static final String RAW_ATTR = "_raw_";<a name="line.87"></a>
-<span class="sourceLineNo">088</span><a name="line.88"></a>
-<span class="sourceLineNo">089</span>  private byte [] startRow = HConstants.EMPTY_START_ROW;<a name="line.89"></a>
-<span class="sourceLineNo">090</span>  private byte [] stopRow  = HConstants.EMPTY_END_ROW;<a name="line.90"></a>
-<span class="sourceLineNo">091</span>  private int maxVersions = 1;<a name="line.91"></a>
-<span class="sourceLineNo">092</span>  private int batch = -1;<a name="line.92"></a>
+<span class="sourceLineNo">049</span> * All operations are identical to {@link Get} with the exception of instantiation. Rather than<a name="line.49"></a>
+<span class="sourceLineNo">050</span> * specifying a single row, an optional startRow and stopRow may be defined. If rows are not<a name="line.50"></a>
+<span class="sourceLineNo">051</span> * specified, the Scanner will iterate over all rows.<a name="line.51"></a>
+<span class="sourceLineNo">052</span> * &lt;p&gt;<a name="line.52"></a>
+<span class="sourceLineNo">053</span> * To get all columns from all rows of a Table, create an instance with no constraints; use the<a name="line.53"></a>
+<span class="sourceLineNo">054</span> * {@link #Scan()} constructor. To constrain the scan to specific column families, call<a name="line.54"></a>
+<span class="sourceLineNo">055</span> * {@link #addFamily(byte[]) addFamily} for each family to retrieve on your Scan instance.<a name="line.55"></a>
+<span class="sourceLineNo">056</span> * &lt;p&gt;<a name="line.56"></a>
+<span class="sourceLineNo">057</span> * To get specific columns, call {@link #addColumn(byte[], byte[]) addColumn} for each column to<a name="line.57"></a>
+<span class="sourceLineNo">058</span> * retrieve.<a name="line.58"></a>
+<span class="sourceLineNo">059</span> * &lt;p&gt;<a name="line.59"></a>
+<span class="sourceLineNo">060</span> * To only retrieve columns within a specific range of version timestamps, call<a name="line.60"></a>
+<span class="sourceLineNo">061</span> * {@link #setTimeRange(long, long) setTimeRange}.<a name="line.61"></a>
+<span class="sourceLineNo">062</span> * &lt;p&gt;<a name="line.62"></a>
+<span class="sourceLineNo">063</span> * To only retrieve columns with a specific timestamp, call {@link #setTimeStamp(long) setTimestamp}<a name="line.63"></a>
+<span class="sourceLineNo">064</span> * .<a name="line.64"></a>
+<span class="sourceLineNo">065</span> * &lt;p&gt;<a name="line.65"></a>
+<span class="sourceLineNo">066</span> * To limit the number of versions of each column to be returned, call {@link #setMaxVersions(int)<a name="line.66"></a>
+<span class="sourceLineNo">067</span> * setMaxVersions}.<a name="line.67"></a>
+<span class="sourceLineNo">068</span> * &lt;p&gt;<a name="line.68"></a>
+<span class="sourceLineNo">069</span> * To limit the maximum number of values returned for each call to next(), call<a name="line.69"></a>
+<span class="sourceLineNo">070</span> * {@link #setBatch(int) setBatch}.<a name="line.70"></a>
+<span class="sourceLineNo">071</span> * &lt;p&gt;<a name="line.71"></a>
+<span class="sourceLineNo">072</span> * To add a filter, call {@link #setFilter(org.apache.hadoop.hbase.filter.Filter) setFilter}.<a name="line.72"></a>
+<span class="sourceLineNo">073</span> * &lt;p&gt;<a name="line.73"></a>
+<span class="sourceLineNo">074</span> * For small scan, it is deprecated in 2.0.0. Now we have a {@link #setLimit(int)} method in Scan<a name="line.74"></a>
+<span class="sourceLineNo">075</span> * object which is used to tell RS how many rows we want. If the rows return reaches the limit, the<a name="line.75"></a>
+<span class="sourceLineNo">076</span> * RS will close the RegionScanner automatically. And we will also fetch data when openScanner in<a name="line.76"></a>
+<span class="sourceLineNo">077</span> * the new implementation, this means we can also finish a scan operation in one rpc call. And we<a name="line.77"></a>
+<span class="sourceLineNo">078</span> * have also introduced a {@link #setReadType(ReadType)} method. You can use this method to tell RS<a name="line.78"></a>
+<span class="sourceLineNo">079</span> * to use pread explicitly.<a name="line.79"></a>
+<span class="sourceLineNo">080</span> * &lt;p&gt;<a name="line.80"></a>
+<span class="sourceLineNo">081</span> * Expert: To explicitly disable server-side block caching for this scan, execute<a name="line.81"></a>
+<span class="sourceLineNo">082</span> * {@link #setCacheBlocks(boolean)}.<a name="line.82"></a>
+<span class="sourceLineNo">083</span> * &lt;p&gt;<a name="line.83"></a>
+<span class="sourceLineNo">084</span> * &lt;em&gt;Note:&lt;/em&gt; Usage alters Scan instances. Internally, attributes are updated as the Scan runs<a name="line.84"></a>
+<span class="sourceLineNo">085</span> * and if enabled, metrics accumulate in the Scan instance. Be aware this is the case when you go to<a name="line.85"></a>
+<span class="sourceLineNo">086</span> * clone a Scan instance or if you go to reuse a created Scan instance; safer is create a Scan<a name="line.86"></a>
+<span class="sourceLineNo">087</span> * instance per usage.<a name="line.87"></a>
+<span class="sourceLineNo">088</span> */<a name="line.88"></a>
+<span class="sourceLineNo">089</span>@InterfaceAudience.Public<a name="line.89"></a>
+<span class="sourceLineNo">090</span>@InterfaceStability.Stable<a name="line.90"></a>
+<span class="sourceLineNo">091</span>public class Scan extends Query {<a name="line.91"></a>
+<span class="sourceLineNo">092</span>  private static final Log LOG = LogFactory.getLog(Scan.class);<a name="line.92"></a>
 <span class="sourceLineNo">093</span><a name="line.93"></a>
-<span class="sourceLineNo">094</span>  /**<a name="line.94"></a>
-<span class="sourceLineNo">095</span>   * Partial {@link Result}s are {@link Result}s must be combined to form a complete {@link Result}.<a name="line.95"></a>
-<span class="sourceLineNo">096</span>   * The {@link Result}s had to be returned in fragments (i.e. as partials) because the size of the<a name="line.96"></a>
-<span class="sourceLineNo">097</span>   * cells in the row exceeded max result size on the server. Typically partial results will be<a name="line.97"></a>
-<span class="sourceLineNo">098</span>   * combined client side into complete results before being delivered to the caller. However, if<a name="line.98"></a>
-<span class="sourceLineNo">099</span>   * this flag is set, the caller is indicating that they do not mind seeing partial results (i.e.<a name="line.99"></a>
-<span class="sourceLineNo">100</span>   * they understand that the results returned from the Scanner may only represent part of a<a name="line.100"></a>
-<span class="sourceLineNo">101</span>   * particular row). In such a case, any attempt to combine the partials into a complete result on<a name="line.101"></a>
-<span class="sourceLineNo">102</span>   * the client side will be skipped, and the caller will be able to see the exact results returned<a name="line.102"></a>
-<span class="sourceLineNo">103</span>   * from the server.<a name="line.103"></a>
-<span class="sourceLineNo">104</span>   */<a name="line.104"></a>
-<span class="sourceLineNo">105</span>  private boolean allowPartialResults = false;<a name="line.105"></a>
-<span class="sourceLineNo">106</span><a name="line.106"></a>
-<span class="sourceLineNo">107</span>  private int storeLimit = -1;<a name="line.107"></a>
-<span class="sourceLineNo">108</span>  private int storeOffset = 0;<a name="line.108"></a>
-<span class="sourceLineNo">109</span>  private boolean getScan;<a name="line.109"></a>
-<span class="sourceLineNo">110</span><a name="line.110"></a>
-<span class="sourceLineNo">111</span>  /**<a name="line.111"></a>
-<span class="sourceLineNo">112</span>   * @deprecated since 1.0.0. Use {@link #setScanMetricsEnabled(boolean)}<a name="line.112"></a>
+<span class="sourceLineNo">094</span>  private static final String RAW_ATTR = "_raw_";<a name="line.94"></a>
+<span class="sourceLineNo">095</span><a name="line.95"></a>
+<span class="sourceLineNo">096</span>  private byte[] startRow = HConstants.EMPTY_START_ROW;<a name="line.96"></a>
+<span class="sourceLineNo">097</span>  private boolean includeStartRow = true;<a name="line.97"></a>
+<span class="sourceLineNo">098</span>  private byte[] stopRow  = HConstants.EMPTY_END_ROW;<a name="line.98"></a>
+<span class="sourceLineNo">099</span>  private boolean includeStopRow = false;<a name="line.99"></a>
+<span class="sourceLineNo">100</span>  private int maxVersions = 1;<a name="line.100"></a>
+<span class="sourceLineNo">101</span>  private int batch = -1;<a name="line.101"></a>
+<span class="sourceLineNo">102</span><a name="line.102"></a>
+<span class="sourceLineNo">103</span>  /**<a name="line.103"></a>
+<span class="sourceLineNo">104</span>   * Partial {@link Result}s are {@link Result}s must be combined to form a complete {@link Result}.<a name="line.104"></a>
+<span class="sourceLineNo">105</span>   * The {@link Result}s had to be returned in fragments (i.e. as partials) because the size of the<a name="line.105"></a>
+<span class="sourceLineNo">106</span>   * cells in the row exceeded max result size on the server. Typically partial results will be<a name="line.106"></a>
+<span class="sourceLineNo">107</span>   * combined client side into complete results before being delivered to the caller. However, if<a name="line.107"></a>
+<span class="sourceLineNo">108</span>   * this flag is set, the caller is indicating that they do not mind seeing partial results (i.e.<a name="line.108"></a>
+<span class="sourceLineNo">109</span>   * they understand that the results returned from the Scanner may only represent part of a<a name="line.109"></a>
+<span class="sourceLineNo">110</span>   * particular row). In such a case, any attempt to combine the partials into a complete result on<a name="line.110"></a>
+<span class="sourceLineNo">111</span>   * the client side will be skipped, and the caller will be able to see the exact results returned<a name="line.111"></a>
+<span class="sourceLineNo">112</span>   * from the server.<a name="line.112"></a>
 <span class="sourceLineNo">113</span>   */<a name="line.113"></a>
-<span class="sourceLineNo">114</span>  // Make private or remove.<a name="line.114"></a>
-<span class="sourceLineNo">115</span>  @Deprecated<a name="line.115"></a>
-<span class="sourceLineNo">116</span>  static public final String SCAN_ATTRIBUTES_METRICS_ENABLE = "scan.attributes.metrics.enable";<a name="line.116"></a>
-<span class="sourceLineNo">117</span><a name="line.117"></a>
-<span class="sourceLineNo">118</span>  /**<a name="line.118"></a>
-<span class="sourceLineNo">119</span>   * Use {@link #getScanMetrics()}<a name="line.119"></a>
-<span class="sourceLineNo">120</span>   */<a name="line.120"></a>
-<span class="sourceLineNo">121</span>  // Make this private or remove.<a name="line.121"></a>
-<span class="sourceLineNo">122</span>  @Deprecated<a name="line.122"></a>
-<span class="sourceLineNo">123</span>  static public final String SCAN_ATTRIBUTES_METRICS_DATA = "scan.attributes.metrics.data";<a name="line.123"></a>
-<span class="sourceLineNo">124</span><a name="line.124"></a>
-<span class="sourceLineNo">125</span>  // If an application wants to use multiple scans over different tables each scan must<a name="line.125"></a>
-<span class="sourceLineNo">126</span>  // define this attribute with the appropriate table name by calling<a name="line.126"></a>
-<span class="sourceLineNo">127</span>  // scan.setAttribute(Scan.SCAN_ATTRIBUTES_TABLE_NAME, Bytes.toBytes(tableName))<a name="line.127"></a>
-<span class="sourceLineNo">128</span>  static public final String SCAN_ATTRIBUTES_TABLE_NAME = "scan.attributes.table.name";<a name="line.128"></a>
-<span class="sourceLineNo">129</span><a name="line.129"></a>
-<span class="sourceLineNo">130</span>  /**<a name="line.130"></a>
-<span class="sourceLineNo">131</span>   * -1 means no caching specified and the value of {@link HConstants#HBASE_CLIENT_SCANNER_CACHING}<a name="line.131"></a>
-<span class="sourceLineNo">132</span>   * (default to {@link HConstants#DEFAULT_HBASE_CLIENT_SCANNER_CACHING}) will be used<a name="line.132"></a>
-<span class="sourceLineNo">133</span>   */<a name="line.133"></a>
-<span class="sourceLineNo">134</span>  private int caching = -1;<a name="line.134"></a>
-<span class="sourceLineNo">135</span>  private long maxResultSize = -1;<a name="line.135"></a>
-<span class="sourceLineNo">136</span>  private boolean cacheBlocks = true;<a name="line.136"></a>
-<span class="sourceLineNo">137</span>  private boolean reversed = false;<a name="line.137"></a>
-<span class="sourceLineNo">138</span>  private Map&lt;byte [], NavigableSet&lt;byte []&gt;&gt; familyMap =<a name="line.138"></a>
-<span class="sourceLineNo">139</span>    new TreeMap&lt;byte [], NavigableSet&lt;byte []&gt;&gt;(Bytes.BYTES_COMPARATOR);<a name="line.139"></a>
-<span class="sourceLineNo">140</span>  private Boolean asyncPrefetch = null;<a name="line.140"></a>
-<span class="sourceLineNo">141</span><a name="line.141"></a>
-<span class="sourceLineNo">142</span>  /**<a name="line.142"></a>
-<span class="sourceLineNo">143</span>   * Parameter name for client scanner sync/async prefetch toggle.<a name="line.143"></a>
-<span class="sourceLineNo">144</span>   * When using async scanner, prefetching data from the server is done at the background.<a name="line.144"></a>
-<span class="sourceLineNo">145</span>   * The parameter currently won't have any effect in the case that the user has set<a name="line.145"></a>
-<span class="sourceLineNo">146</span>   * Scan#setSmall or Scan#setReversed<a name="line.146"></a>
-<span class="sourceLineNo">147</span>   */<a name="line.147"></a>
-<span class="sourceLineNo">148</span>  public static final String HBASE_CLIENT_SCANNER_ASYNC_PREFETCH =<a name="line.148"></a>
-<span class="sourceLineNo">149</span>      "hbase.client.scanner.async.prefetch";<a name="line.149"></a>
-<span class="sourceLineNo">150</span><a name="line.150"></a>
-<span class="sourceLineNo">151</span>  /**<a name="line.151"></a>
-<span class="sourceLineNo">152</span>   * Default value of {@link #HBASE_CLIENT_SCANNER_ASYNC_PREFETCH}.<a name="line.152"></a>
-<span class="sourceLineNo">153</span>   */<a name="line.153"></a>
-<span class="sourceLineNo">154</span>  public static final boolean DEFAULT_HBASE_CLIENT_SCANNER_ASYNC_PREFETCH = false;<a name="line.154"></a>
-<span class="sourceLineNo">155</span><a name="line.155"></a>
-<span class="sourceLineNo">156</span>  /**<a name="line.156"></a>
-<span class="sourceLineNo">157</span>   * Set it true for small scan to get better performance Small scan should use pread and big scan<a name="line.157"></a>
-<span class="sourceLineNo">158</span>   * can use seek + read seek + read is fast but can cause two problem (1) resource contention (2)<a name="line.158"></a>
-<span class="sourceLineNo">159</span>   * cause too much network io [89-fb] Using pread for non-compaction read request<a name="line.159"></a>
-<span class="sourceLineNo">160</span>   * https://issues.apache.org/jira/browse/HBASE-7266 On the other hand, if setting it true, we<a name="line.160"></a>
-<span class="sourceLineNo">161</span>   * would do openScanner,next,closeScanner in one RPC call. It means the better performance for<a name="line.161"></a>
-<span class="sourceLineNo">162</span>   * small scan. [HBASE-9488]. Generally, if the scan range is within one data block(64KB), it could<a name="line.162"></a>
-<span class="sourceLineNo">163</span>   * be considered as a small scan.<a name="line.163"></a>
-<span class="sourceLineNo">164</span>   */<a name="line.164"></a>
-<span class="sourceLineNo">165</span>  private boolean small = false;<a name="line.165"></a>
-<span class="sourceLineNo">166</span><a name="line.166"></a>
-<span class="sourceLineNo">167</span>  /**<a name="line.167"></a>
-<span class="sourceLineNo">168</span>   * The mvcc read point to use when open a scanner. Remember to clear it after switching regions as<a name="line.168"></a>
-<span class="sourceLineNo">169</span>   * the mvcc is only valid within region scope.<a name="line.169"></a>
-<span class="sourceLineNo">170</span>   */<a name="line.170"></a>
-<span class="sourceLineNo">171</span>  private long mvccReadPoint = -1L;<a name="line.171"></a>
-<span class="sourceLineNo">172</span><a name="line.172"></a>
-<span class="sourceLineNo">173</span>  /**<a name="line.173"></a>
-<span class="sourceLineNo">174</span>   * Create a Scan operation across all rows.<a name="line.174"></a>
-<span class="sourceLineNo">175</span>   */<a name="line.175"></a>
-<span class="sourceLineNo">176</span>  public Scan() {}<a name="line.176"></a>
-<span class="sourceLineNo">177</span><a name="line.177"></a>
-<span class="sourceLineNo">178</span>  public Scan(byte [] startRow, Filter filter) {<a name="line.178"></a>
-<span class="sourceLineNo">179</span>    this(startRow);<a name="line.179"></a>
-<span class="sourceLineNo">180</span>    this.filter = filter;<a name="line.180"></a>
-<span class="sourceLineNo">181</span>  }<a name="line.181"></a>
-<span class="sourceLineNo">182</span><a name="line.182"></a>
-<span class="sourceLineNo">183</span>  /**<a name="line.183"></a>
-<span class="sourceLineNo">184</span>   * Create a Scan operation starting at the specified row.<a name="line.184"></a>
-<span class="sourceLineNo">185</span>   * &lt;p&gt;<a name="line.185"></a>
-<span class="sourceLineNo">186</span>   * If the specified row does not exist, the Scanner will start from the<a name="line.186"></a>
-<span class="sourceLineNo">187</span>   * next closest row after the specified row.<a name="line.187"></a>
-<span class="sourceLineNo">188</span>   * @param startRow row to start scanner at or after<a name="line.188"></a>
+<span class="sourceLineNo">114</span>  private boolean allowPartialResults = false;<a name="line.114"></a>
+<span class="sourceLineNo">115</span><a name="line.115"></a>
+<span class="sourceLineNo">116</span>  private int storeLimit = -1;<a name="line.116"></a>
+<span class="sourceLineNo">117</span>  private int storeOffset = 0;<a name="line.117"></a>
+<span class="sourceLineNo">118</span><a name="line.118"></a>
+<span class="sourceLineNo">119</span>  /**<a name="line.119"></a>
+<span class="sourceLineNo">120</span>   * @deprecated since 1.0.0. Use {@link #setScanMetricsEnabled(boolean)}<a name="line.120"></a>
+<span class="sourceLineNo">121</span>   */<a name="line.121"></a>
+<span class="sourceLineNo">122</span>  // Make private or remove.<a name="line.122"></a>
+<span class="sourceLineNo">123</span>  @Deprecated<a name="line.123"></a>
+<span class="sourceLineNo">124</span>  static public final String SCAN_ATTRIBUTES_METRICS_ENABLE = "scan.attributes.metrics.enable";<a name="line.124"></a>
+<span class="sourceLineNo">125</span><a name="line.125"></a>
+<span class="sourceLineNo">126</span>  /**<a name="line.126"></a>
+<span class="sourceLineNo">127</span>   * Use {@link #getScanMetrics()}<a name="line.127"></a>
+<span class="sourceLineNo">128</span>   */<a name="line.128"></a>
+<span class="sourceLineNo">129</span>  // Make this private or remove.<a name="line.129"></a>
+<span class="sourceLineNo">130</span>  @Deprecated<a name="line.130"></a>
+<span class="sourceLineNo">131</span>  static public final String SCAN_ATTRIBUTES_METRICS_DATA = "scan.attributes.metrics.data";<a name="line.131"></a>
+<span class="sourceLineNo">132</span><a name="line.132"></a>
+<span class="sourceLineNo">133</span>  // If an application wants to use multiple scans over different tables each scan must<a name="line.133"></a>
+<span class="sourceLineNo">134</span>  // define this attribute with the appropriate table name by calling<a name="line.134"></a>
+<span class="sourceLineNo">135</span>  // scan.setAttribute(Scan.SCAN_ATTRIBUTES_TABLE_NAME, Bytes.toBytes(tableName))<a name="line.135"></a>
+<span class="sourceLineNo">136</span>  static public final String SCAN_ATTRIBUTES_TABLE_NAME = "scan.attributes.table.name";<a name="line.136"></a>
+<span class="sourceLineNo">137</span><a name="line.137"></a>
+<span class="sourceLineNo">138</span>  /**<a name="line.138"></a>
+<span class="sourceLineNo">139</span>   * -1 means no caching specified and the value of {@link HConstants#HBASE_CLIENT_SCANNER_CACHING}<a name="line.139"></a>
+<span class="sourceLineNo">140</span>   * (default to {@link HConstants#DEFAULT_HBASE_CLIENT_SCANNER_CACHING}) will be used<a name="line.140"></a>
+<span class="sourceLineNo">141</span>   */<a name="line.141"></a>
+<span class="sourceLineNo">142</span>  private int caching = -1;<a name="line.142"></a>
+<span class="sourceLineNo">143</span>  private long maxResultSize = -1;<a name="line.143"></a>
+<span class="sourceLineNo">144</span>  private boolean cacheBlocks = true;<a name="line.144"></a>
+<span class="sourceLineNo">145</span>  private boolean reversed = false;<a name="line.145"></a>
+<span class="sourceLineNo">146</span>  private Map&lt;byte[], NavigableSet&lt;byte[]&gt;&gt; familyMap =<a name="line.146"></a>
+<span class="sourceLineNo">147</span>      new TreeMap&lt;byte[], NavigableSet&lt;byte[]&gt;&gt;(Bytes.BYTES_COMPARATOR);<a name="line.147"></a>
+<span class="sourceLineNo">148</span>  private Boolean asyncPrefetch = null;<a name="line.148"></a>
+<span class="sourceLineNo">149</span><a name="line.149"></a>
+<span class="sourceLineNo">150</span>  /**<a name="line.150"></a>
+<span class="sourceLineNo">151</span>   * Parameter name for client scanner sync/async prefetch toggle.<a name="line.151"></a>
+<span class="sourceLineNo">152</span>   * When using async scanner, prefetching data from the server is done at the background.<a name="line.152"></a>
+<span class="sourceLineNo">153</span>   * The parameter currently won't have any effect in the case that the user has set<a name="line.153"></a>
+<span class="sourceLineNo">154</span>   * Scan#setSmall or Scan#setReversed<a name="line.154"></a>
+<span class="sourceLineNo">155</span>   */<a name="line.155"></a>
+<span class="sourceLineNo">156</span>  public static final String HBASE_CLIENT_SCANNER_ASYNC_PREFETCH =<a name="line.156"></a>
+<span class="sourceLineNo">157</span>      "hbase.client.scanner.async.prefetch";<a name="line.157"></a>
+<span class="sourceLineNo">158</span><a name="line.158"></a>
+<span class="sourceLineNo">159</span>  /**<a name="line.159"></a>
+<span class="sourceLineNo">160</span>   * Default value of {@link #HBASE_CLIENT_SCANNER_ASYNC_PREFETCH}.<a name="line.160"></a>
+<span class="sourceLineNo">161</span>   */<a name="line.161"></a>
+<span class="sourceLineNo">162</span>  public static final boolean DEFAULT_HBASE_CLIENT_SCANNER_ASYNC_PREFETCH = false;<a name="line.162"></a>
+<span class="sourceLineNo">163</span><a name="line.163"></a>
+<span class="sourceLineNo">164</span>  /**<a name="line.164"></a>
+<span class="sourceLineNo">165</span>   * Set it true for small scan to get better performance Small scan should use pread and big scan<a name="line.165"></a>
+<span class="sourceLineNo">166</span>   * can use seek + read seek + read is fast but can cause two problem (1) resource contention (2)<a name="line.166"></a>
+<span class="sourceLineNo">167</span>   * cause too much network io [89-fb] Using pread for non-compaction read request<a name="line.167"></a>
+<span class="sourceLineNo">168</span>   * https://issues.apache.org/jira/browse/HBASE-7266 On the other hand, if setting it true, we<a name="line.168"></a>
+<span class="sourceLineNo">169</span>   * would do openScanner,next,closeScanner in one RPC call. It means the better performance for<a name="line.169"></a>
+<span class="sourceLineNo">170</span>   * small scan. [HBASE-9488]. Generally, if the scan range is within one data block(64KB), it could<a name="line.170"></a>
+<span class="sourceLineNo">171</span>   * be considered as a small scan.<a name="line.171"></a>
+<span class="sourceLineNo">172</span>   */<a name="line.172"></a>
+<span class="sourceLineNo">173</span>  private boolean small = false;<a name="line.173"></a>
+<span class="sourceLineNo">174</span><a name="line.174"></a>
+<span class="sourceLineNo">175</span>  /**<a name="line.175"></a>
+<span class="sourceLineNo">176</span>   * The mvcc read point to use when open a scanner. Remember to clear it after switching regions as<a name="line.176"></a>
+<span class="sourceLineNo">177</span>   * the mvcc is only valid within region scope.<a name="line.177"></a>
+<span class="sourceLineNo">178</span>   */<a name="line.178"></a>
+<span class="sourceLineNo">179</span>  private long mvccReadPoint = -1L;<a name="line.179"></a>
+<span class="sourceLineNo">180</span><a name="line.180"></a>
+<span class="sourceLineNo">181</span>  /**<a name="line.181"></a>
+<span class="sourceLineNo">182</span>   * The number of rows we want for this scan. We will terminate the scan if the number of return<a name="line.182"></a>
+<span class="sourceLineNo">183</span>   * rows reaches this value.<a name="line.183"></a>
+<span class="sourceLineNo">184</span>   */<a name="line.184"></a>
+<span class="sourceLineNo">185</span>  private int limit = -1;<a name="line.185"></a>
+<span class="sourceLineNo">186</span><a name="line.186"></a>
+<span class="sourceLineNo">187</span>  /**<a name="line.187"></a>
+<span class="sourceLineNo">188</span>   * Control whether to use pread at server side.<a name="line.188"></a>
 <span class="sourceLineNo">189</span>   */<a name="line.189"></a>
-<span class="sourceLineNo">190</span>  public Scan(byte [] startRow) {<a name="line.190"></a>
-<span class="sourceLineNo">191</span>    this.startRow = startRow;<a name="line.191"></a>
-<span class="sourceLineNo">192</span>  }<a name="line.192"></a>
-<span class="sourceLineNo">193</span><a name="line.193"></a>
-<span class="sourceLineNo">194</span>  /**<a name="line.194"></a>
-<span class="sourceLineNo">195</span>   * Create a Scan operation for the range of rows specified.<a name="line.195"></a>
-<span class="sourceLineNo">196</span>   * @param startRow row to start scanner at or after (inclusive)<a name="line.196"></a>
-<span class="sourceLineNo">197</span>   * @param stopRow row to stop scanner before (exclusive)<a name="line.197"></a>
+<span class="sourceLineNo">190</span>  private ReadType readType = ReadType.DEFAULT;<a name="line.190"></a>
+<span class="sourceLineNo">191</span>  /**<a name="line.191"></a>
+<span class="sourceLineNo">192</span>   * Create a Scan operation across all rows.<a name="line.192"></a>
+<span class="sourceLineNo">193</span>   */<a name="line.193"></a>
+<span class="sourceLineNo">194</span>  public Scan() {}<a name="line.194"></a>
+<span class="sourceLineNo">195</span><a name="line.195"></a>
+<span class="sourceLineNo">196</span>  /**<a name="line.196"></a>
+<span class="sourceLineNo">197</span>   * @deprecated use {@code new Scan().withStartRow(startRow).setFilter(filter)} instead.<a name="line.197"></a>
 <span class="sourceLineNo">198</span>   */<a name="line.198"></a>
-<span class="sourceLineNo">199</span>  public Scan(byte [] startRow, byte [] stopRow) {<a name="line.199"></a>
-<span class="sourceLineNo">200</span>    this.startRow = startRow;<a name="line.200"></a>
-<span class="sourceLineNo">201</span>    this.stopRow = stopRow;<a name="line.201"></a>
-<span class="sourceLineNo">202</span>    //if the startRow and stopRow both are empty, it is not a Get<a name="line.202"></a>
-<span class="sourceLineNo">203</span>    this.getScan = isStartRowAndEqualsStopRow();<a name="line.203"></a>
-<span class="sourceLineNo">204</span>  }<a name="line.204"></a>
-<span class="sourceLineNo">205</span><a name="line.205"></a>
-<span class="sourceLineNo">206</span>  /**<a name="line.206"></a>
-<span class="sourceLineNo">207</span>   * Creates a new instance of this class while copying all values.<a name="line.207"></a>
-<span class="sourceLineNo">208</span>   *<a name="line.208"></a>
-<span class="sourceLineNo">209</span>   * @param scan  The scan instance to copy from.<a name="line.209"></a>
-<span class="sourceLineNo">210</span>   * @throws IOException When copying the values fails.<a name="line.210"></a>
-<span class="sourceLineNo">211</span>   */<a name="line.211"></a>
-<span class="sourceLineNo">212</span>  public Scan(Scan scan) throws IOException {<a name="line.212"></a>
-<span class="sourceLineNo">213</span>    startRow = scan.getStartRow();<a name="line.213"></a>
-<span class="sourceLineNo">214</span>    stopRow  = scan.getStopRow();<a name="line.214"></a>
-<span class="sourceLineNo">215</span>    maxVersions = scan.getMaxVersions();<a name="line.215"></a>
-<span class="sourceLineNo">216</span>    batch = scan.getBatch();<a name="line.216"></a>
-<span class="sourceLineNo">217</span>    storeLimit = scan.getMaxResultsPerColumnFamily();<a name="line.217"></a>
-<span class="sourceLineNo">218</span>    storeOffset = scan.getRowOffsetPerColumnFamily();<a name="line.218"></a>
-<span class="sourceLineNo">219</span>    caching = scan.getCaching();<a name="line.219"></a>
-<span class="sourceLineNo">220</span>    maxResultSize = scan.getMaxResultSize();<a name="line.220"></a>
-<span class="sourceLineNo">221</span>    cacheBlocks = scan.getCacheBlocks();<a name="line.221"></a>
-<span class="sourceLineNo">222</span>    getScan = scan.isGetScan();<a name="line.222"></a>
-<span class="sourceLineNo">223</span>    filter = scan.getFilter(); // clone?<a name="line.223"></a>
-<span class="sourceLineNo">224</span>    loadColumnFamiliesOnDemand = scan.getLoadColumnFamiliesOnDemandValue();<a name="line.224"></a>
-<span class="sourceLineNo">225</span>    consistency = scan.getConsistency();<a name="line.225"></a>
-<span class="sourceLineNo">226</span>    this.setIsolationLevel(scan.getIsolationLevel());<a name="line.226"></a>
-<span class="sourceLineNo">227</span>    reversed = scan.isReversed();<a name="line.227"></a>
-<span class="sourceLineNo">228</span>    asyncPrefetch = scan.isAsyncPrefetch();<a name="line.228"></a>
-<span class="sourceLineNo">229</span>    small = scan.isSmall();<a name="line.229"></a>
-<span class="sourceLineNo">230</span>    allowPartialResults = scan.getAllowPartialResults();<a name="line.230"></a>
-<span class="sourceLineNo">231</span>    TimeRange ctr = scan.getTimeRange();<a name="line.231"></a>
-<span class="sourceLineNo">232</span>    tr = new TimeRange(ctr.getMin(), ctr.getMax());<a name="line.232"></a>
-<span class="sourceLineNo">233</span>    Map&lt;byte[], NavigableSet&lt;byte[]&gt;&gt; fams = scan.getFamilyMap();<a name="line.233"></a>
-<span class="sourceLineNo">234</span>    for (Map.Entry&lt;byte[],NavigableSet&lt;byte[]&gt;&gt; entry : fams.entrySet()) {<a name="line.234"></a>
-<span class="sourceLineNo">235</span>      byte [] fam = entry.getKey();<a name="line.235"></a>
-<span class="sourceLineNo">236</span>      NavigableSet&lt;byte[]&gt; cols = entry.getValue();<a name="line.236"></a>
-<span class="sourceLineNo">237</span>      if (cols != null &amp;&amp; cols.size() &gt; 0) {<a name="line.237"></a>
-<span class="sourceLineNo">238</span>        for (byte[] col : cols) {<a name="line.238"></a>
-<span class="sourceLineNo">239</span>          addColumn(fam, col);<a name="line.239"></a>
-<span class="sourceLineNo">240</span>        }<a name="line.240"></a>
-<span class="sourceLineNo">241</span>      } else {<a name="line.241"></a>
-<span class="sourceLineNo">242</span>        addFamily(fam);<a name="line.242"></a>
-<span class="sourceLineNo">243</span>      }<a name="line.243"></a>
-<span class="sourceLineNo">244</span>    }<a name="line.244"></a>
-<span class="sourceLineNo">245</span>    for (Map.Entry&lt;String, byte[]&gt; attr : scan.getAttributesMap().entrySet()) {<a name="line.245"></a>
-<span class="sourceLineNo">246</span>      setAttribute(attr.getKey(), attr.getValue());<a name="line.246"></a>
-<span class="sourceLineNo">247</span>    }<a name="line.247"></a>
-<span class="sourceLineNo">248</span>    for (Map.Entry&lt;byte[], TimeRange&gt; entry : scan.getColumnFamilyTimeRange().entrySet()) {<a name="line.248"></a>
-<span class="sourceLineNo">249</span>      TimeRange tr = entry.getValue();<a name="line.249"></a>
-<span class="sourceLineNo">250</span>      setColumnFamilyTimeRange(entry.getKey(), tr.getMin(), tr.getMax());<a name="line.250"></a>
-<span class="sourceLineNo">251</span>    }<a name="line.251"></a>
-<span class="sourceLineNo">252</span>    this.mvccReadPoint = scan.getMvccReadPoint();<a name="line.252"></a>
-<span class="sourceLineNo">253</span>  }<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>   * Builds a scan object with the same specs as get.<a name="line.256"></a>
-<span class="sourceLineNo">257</span>   * @param get get to model scan after<a name="line.257"></a>
-<span class="sourceLineNo">258</span>   */<a name="line.258"></a>
-<span class="sourceLineNo">259</span>  public Scan(Get get) {<a name="line.259"></a>
-<span class="sourceLineNo">260</span>    this.startRow = get.getRow();<a name="line.260"></a>
-<span class="sourceLineNo">261</span>    this.stopRow = get.getRow();<a name="line.261"></a>
-<span class="sourceLineNo">262</span>    this.filter = get.getFilter();<a name="line.262"></a>
-<span class="sourceLineNo">263</span>    this.cacheBlocks = get.getCacheBlocks();<a name="line.263"></a>
-<span class="sourceLineNo">264</span>    this.maxVersions = get.getMaxVersions();<a name="line.264"></a>
-<span class="sourceLineNo">265</span>    this.storeLimit = get.getMaxResultsPerColumnFamily();<a name="line.265"></a>
-<span class="sourceLineNo">266</span>    this.storeOffset = get.getRowOffsetPerColumnFamily();<a name="line.266"></a>
-<span class="sourceLineNo">267</span>    this.tr = get.getTimeRange();<a name="line.267"></a>
-<span class="sourceLineNo">268</span>    this.familyMap = get.getFamilyMap();<a name="line.268"></a>
-<span class="sourceLineNo">269</span>    this.getScan = true;<a name="line.269"></a>
-<span class="sourceLineNo">270</span>    this.asyncPrefetch = false;<a name="line.270"></a>
-<span class="sourceLineNo">271</span>    this.consistency = get.getConsistency();<a name="line.271"></a>
-<span class="sourceLineNo">272</span>    this.setIsolationLevel(get.getIsolationLevel());<a name="line.272"></a>
-<span class="sourceLineNo">273</span>    this.loadColumnFamiliesOnDemand = get.getLoadColumnFamiliesOnDemandValue();<a name="line.273"></a>
-<span class="sourceLineNo">274</span>    for (Map.Entry&lt;String, byte[]&gt; attr : get.getAttributesMap().entrySet()) {<a name="line.274"></a>
-<span class="sourceLineNo">275</span>      setAttribute(attr.getKey(), attr.getValue());<a name="line.275"></a>
-<span class="sourceLineNo">276</span>    }<a name="line.276"></a>
-<span class="sourceLineNo">277</span>    for (Map.Entry&lt;byte[], TimeRange&gt; entry : get.getColumnFamilyTimeRange().entrySet()) {<a name="line.277"></a>
-<span class="sourceLineNo">278</span>      TimeRange tr = entry.getValue();<a name="line.278"></a>
-<span class="sourceLineNo">279</span>      setColumnFamilyTimeRange(entry.getKey(), tr.getMin(), tr.getMax());<a name="line.279"></a>
-<span class="sourceLineNo">280</span>    }<a name="line.280"></a>
-<span class="sourceLineNo">281</span>    this.mvccReadPoint = -1L;<a name="line.281"></a>
-<span class="sourceLineNo">282</span>  }<a name="line.282"></a>
-<span class="sourceLineNo">283</span><a name="line.283"></a>
-<span class="sourceLineNo">284</span>  public boolean isGetScan() {<a name="line.284"></a>
-<span class="sourceLineNo">285</span>    return this.getScan || isStartRowAndEqualsStopRow();<a name="line.285"></a>
-<span class="sourceLineNo">286</span>  }<a name="line.286"></a>
-<span class="sourceLineNo">287</span><a name="line.287"></a>
-<span class="sourceLineNo">288</span>  private boolean isStartRowAndEqualsStopRow() {<a name="line.288"></a>
-<span class="sourceLineNo">289</span>    return this.startRow != null &amp;&amp; this.startRow.length &gt; 0 &amp;&amp;<a name="line.289"></a>
-<span class="sourceLineNo">290</span>        Bytes.equals(this.startRow, this.stopRow);<a name="line.290"></a>
-<span class="sourceLineNo">291</span>  }<a name="line.291"></a>
-<span class="sourceLineNo">292</span>  /**<a name="line.292"></a>
-<span class="sourceLineNo">293</span>   * Get all columns from the specified family.<a name="line.293"></a>
-<span class="sourceLineNo">294</span>   * &lt;p&gt;<a name="line.294"></a>
-<span class="sourceLineNo">295</span>   * Overrides previous calls to addColumn for this family.<a name="line.295"></a>
-<span class="sourceLineNo">296</span>   * @param family family name<a name="line.296"></a>
-<span class="sourceLineNo">297</span>   * @return this<a name="line.297"></a>
-<span class="sourceLineNo">298</span>   */<a name="line.298"></a>
-<span class="sourceLineNo">299</span>  public Scan addFamily(byte [] family) {<a name="line.299"></a>
-<span class="sourceLineNo">300</span>    familyMap.remove(family);<a name="line.300"></a>
-<span class="sourceLineNo">301</span>    familyMap.put(family, null);<a name="line.301"></a>
-<span class="sourceLineNo">302</span>    return this;<a name="line.302"></a>
-<span class="sourceLineNo">303</span>  }<a name="line.303"></a>
-<span class="sourceLineNo">304</span><a name="line.304"></a>
-<span class="sourceLineNo">305</span>  /**<a name="line.305"></a>
-<span class="sourceLineNo">306</span>   * Get the column from the specified family with the specified qualifier.<a name="line.306"></a>
-<span class="sourceLineNo">307</span>   * &lt;p&gt;<a name="line.307"></a>
-<span class="sourceLineNo">308</span>   * Overrides previous calls to addFamily for this family.<a name="line.308"></a>
-<span class="sourceLineNo">309</span>   * @param family family name<a name="line.309"></a>
-<span class="sourceLineNo">310</span>   * @param qualifier column qualifier<a name="line.310"></a>
-<span class="sourceLineNo">311</span>   * @return this<a name="line.311"></a>
-<span class="sourceLineNo">312</span>   */<a name="line.312"></a>
-<span class="sourceLineNo">313</span>  public Scan addColumn(byte [] family, byte [] qualifier) {<a name="line.313"></a>
-<span class="sourceLineNo">314</span>    NavigableSet&lt;byte []&gt; set = familyMap.get(family);<a name="line.314"></a>
-<span class="sourceLineNo">315</span>    if(set == null) {<a name="line.315"></a>
-<span class="sourceLineNo">316</span>      set = new TreeSet&lt;byte []&gt;(Bytes.BYTES_COMPARATOR);<a name="line.316"></a>
-<span class="sourceLineNo">317</span>    }<a name="line.317"></a>
-<span class="sourceLineNo">318</span>    if (qualifier == null) {<a name="line.318"></a>
-<span class="sourceLineNo">319</span>      qualifier = HConstants.EMPTY_BYTE_ARRAY;<a name="line.319"></a>
-<span class="sourceLineNo">320</span>    }<a name="line.320"></a>
-<span class="sourceLineNo">321</span>    set.add(qualifier);<a name="line.321"></a>
-<span class="sourceLineNo">322</span>    familyMap.put(family, set);<a name="line.322"></a>
-<span class="sourceLineNo">323</span>    return this;<a name="line.323"></a>
-<span class="sourceLineNo">324</span>  }<a name="line.324"></a>
-<span class="sourceLineNo">325</span><a name="line.325"></a>
-<span class="sourceLineNo">326</span>  /**<a name="line.326"></a>
-<span class="sourceLineNo">327</span>   * Set versions of columns only within the specified timestamp range,<a name="line.327"></a>
-<span class="sourceLineNo">328</span>   * [minStamp, maxStamp).  Note, default maximum versions to return is 1.  If<a name="line.328"></a>
-<span class="sourceLineNo">329</span>   * your time range spans more than one version and you want all versions<a name="line.329"></a>
-<span class="sourceLineNo">330</span>   * returned, up the number of versions beyond the default.<a name="line.330"></a>
-<span class="sourceLineNo">331</span>   * @param minStamp minimum timestamp value, inclusive<a name="line.331"></a>
-<span class="sourceLineNo">332</span>   * @param maxStamp maximum timestamp value, exclusive<a name="line.332"></a>
-<span class="sourceLineNo">333</span>   * @see #setMaxVersions()<a name="line.333"></a>
-<span class="sourceLineNo">334</span>   * @see #setMaxVersions(int)<a name="line.334"></a>
-<span class="sourceLineNo">335</span>   * @return this<a name="line.335"></a>
-<span class="sourceLineNo">336</span>   */<a name="line.336"></a>
-<span class="sourceLineNo">337</span>  @Override<a name="line.337"></a>
-<span class="sourceLineNo">338</span>  public Scan setTimeRange(long minStamp, long maxStamp) throws IOException {<a name="line.338"></a>
-<span class="sourceLineNo">339</span>    return (Scan) super.setTimeRange(minStamp, maxStamp);<a name="line.339"></a>
-<span class="sourceLineNo">340</span>  }<a name="line.340"></a>
-<span class="sourceLineNo">341</span><a name="line.341"></a>
-<span class="sourceLineNo">342</span>  /**<a name="line.342"></a>
-<span class="sourceLineNo">343</span>   * Set versions of columns only within the specified timestamp range,<a name="line.343"></a>
-<span class="sourceLineNo">344</span>   * @param tr Input TimeRange<a name="line.344"></a>
-<span class="sourceLineNo">345</span>   * @return this for invocation chaining<a name="line.345"></a>
-<span class="sourceLineNo">346</span>   */<a name="line.346"></a>
-<span class="sourceLineNo">347</span>  public Scan setTimeRange(TimeRange tr) {<a name="line.347"></a>
-<span class="sourceLineNo">348</span>    return (Scan) super.setTimeRange(tr);<a name="line.348"></a>
-<span class="sourceLineNo">349</span>  }<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>   * Get versions of columns with the specified timestamp. Note, default maximum<a name="line.352"></a>
-<span class="sourceLineNo">353</span>   * versions to return is 1.  If your time range spans more than one version<a name="line.353"></a>
-<span class="sourceLineNo">354</span>   * and you want all versions returned, up the number of versions beyond the<a name="line.354"></a>
-<span class="sourceLineNo">355</span>   * defaut.<a name="line.355"></a>
-<span class="sourceLineNo">356</span>   * @param timestamp version timestamp<a name="line.356"></a>
-<span class="sourceLineNo">357</span>   * @see #setMaxVersions()<a name="line.357"></a>
-<span class="sourceLineNo">358</span>   * @see #setMaxVersions(int)<a name="line.358"></a>
-<span class="sourceLineNo">359</span>   * @return this<a name="line.359"></a>
-<span class="sourceLineNo">360</span>   */<a name="line.360"></a>
-<span class="sourceLineNo">361</span>  public Scan setTimeStamp(long timestamp)<a name="line.361"></a>
-<span class="sourceLineNo">362</span>  throws IOException {<a name="line.362"></a>
-<span class="sourceLineNo">363</span>    try {<a name="line.363"></a>
-<span class="sourceLineNo">364</span>      super.setTimeRange(timestamp, timestamp + 1);<a name="line.364"></a>
-<span class="sourceLineNo">365</span>    } catch(Exception e) {<a name="line.365"></a>
-<span class="sourceLineNo">366</span>      // This should never happen, unless integer overflow or something extremely wrong...<a name="line.366"></a>
-<span class="sourceLineNo">367</span>      LOG.error("TimeRange failed, likely caused by integer overflow. ", e);<a name="line.367"></a>
-<span class="sourceLineNo">368</span>      throw e;<a name="line.368"></a>
-<span class="sourceLineNo">369</span>    }<a name="line.369"></a>
-<span class="sourceLineNo">370</span>    return this;<a name="line.370"></a>
-<span class="sourceLineNo">371</span>  }<a name="line.371"></a>
-<span class="sourceLineNo">372</span><a name="line.372"></a>
-<span class="sourceLineNo">373</span>  @Override<a name="line.373"></a>
-<span class="sourceLineNo">374</span>  public Scan setColumnFamilyTimeRange(byte[] cf, long minStamp, long maxStamp) {<a name="line.374"></a>
-<span class="sourceLineNo">375</span>    return (Scan) super.setColumnFamilyTimeRange(cf, minStamp, maxStamp);<a name="line.375"></a>
-<span class="sourceLineNo">376</span>  }<a name="line.376"></a>
-<span class="sourceLineNo">377</span><a name="line.377"></a>
-<span class="sourceLineNo">378</span>  @Override<a name="line.378"></a>
-<span class="sourceLineNo">379</span>  public Scan setColumnFamilyTimeRange(byte[] cf, TimeRange tr) {<a name="line.379"></a>
-<span class="sourceLineNo">380</span>    return (Scan) super.setColumnFamilyTimeRange(cf, tr);<a name="line.380"></a>
-<span class="sourceLineNo">381</span>  }<a name="line.381"></a>
-<span class="sourceLineNo">382</span><a name="line.382"></a>
-<span class="sourceLineNo">383</span>  /**<a name="line.383"></a>
-<span class="sourceLineNo">384</span>   * Set the start row of the scan.<a name="line.384"></a>
-<span class="sourceLineNo">385</span>   * &lt;p&gt;<a name="line.385"></a>
-<span class="sourceLineNo">386</span>   * If the specified row does not exist, the Scanner will start from the<a name="line.386"></a>
-<span class="sourceLineNo">387</span>   * next closest row after the specified row.<a name="line.387"></a>
-<span class="sourceLineNo">388</span>   * @param startRow row to start scanner at or after<a name="line.388"></a>
-<span class="sourceLineNo">389</span>   * @return this<a name="line.389"></a>
-<span class="sourceLineNo">390</span>   * @throws IllegalArgumentException if startRow does not meet criteria<a name="line.390"></a>
-<span class="sourceLineNo">391</span>   * for a row key (when length exceeds {@link HConstants#MAX_ROW_LENGTH})<a name="line.391"></a>
-<span class="sourceLineNo">392</span>   */<a name="line.392"></a>
-<span class="sourceLineNo">393</span>  public Scan setStartRow(byte [] startRow) {<a name="line.393"></a>
-<span class="sourceLineNo">394</span>    if (Bytes.len(startRow) &gt; HConstants.MAX_ROW_LENGTH) {<a name="line.394"></a>
-<span class="sourceLineNo">395</span>      throw new IllegalArgumentException(<a name="line.395"></a>
-<span class="sourceLineNo">396</span>        "startRow's length must be less than or equal to " +<a name="line.396"></a>
-<span class="sourceLineNo">397</span>        HConstants.MAX_ROW_LENGTH + " to meet the criteria" +<a name="line.397"></a>
-<span class="sourceLineNo">398</span>        " for a row key.");<a name="line.398"></a>
-<span class="sourceLineNo">399</span>    }<a name="line.399"></a>
-<span class="sourceLineNo">400</span>    this.startRow = startRow;<a name="line.400"></a>
-<span class="sourceLineNo">401</span>    return this;<a name="line.401"></a>
+<span class="sourceLineNo">199</span>  @Deprecated<a name="line.199"></a>
+<span class="sourceLineNo">200</span>  public Scan(byte[] startRow, Filter filter) {<a name="line.200"></a>
+<span class="sourceLineNo">201</span>    this(startRow);<a name="line.201"></a>
+<span class="sourceLineNo">202</span>    this.filter = filter;<a name="line.202"></a>
+<span class="sourceLineNo">203</span>  }<a name="line.203"></a>
+<span class="sourceLineNo">204</span><a name="line.204"></a>
+<span class="sourceLineNo">205</span>  /**<a name="line.205"></a>
+<span class="sourceLineNo">206</span>   * Create a Scan operation starting at the specified row.<a name="line.206"></a>
+<span class="sourceLineNo">207</span>   * &lt;p&gt;<a name="line.207"></a>
+<span class="sourceLineNo">208</span>   * If the specified row does not exist, the Scanner will start from the next closest row after the<a name="line.208"></a>
+<span class="sourceLineNo">209</span>   * specified row.<a name="line.209"></a>
+<span class="sourceLineNo">210</span>   * @param startRow row to start scanner at or after<a name="line.210"></a>
+<span class="sourceLineNo">211</span>   * @deprecated use {@code new Scan().withStartRow(startRow)} instead.<a name="line.211"></a>
+<span class="sourceLineNo">212</span>   */<a name="line.212"></a>
+<span class="sourceLineNo">213</span>  @Deprecated<a name="line.213"></a>
+<span class="sourceLineNo">214</span>  public Scan(byte[] startRow) {<a name="line.214"></a>
+<span class="sourceLineNo">215</span>    setStartRow(startRow);<a name="line.215"></a>
+<span class="sourceLineNo">216</span>  }<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>   * Create a Scan operation for the range of rows specified.<a name="line.219"></a>
+<span class="sourceLineNo">220</span>   * @param startRow row to start scanner at or after (inclusive)<a name="line.220"></a>
+<span class="sourceLineNo">221</span>   * @param stopRow row to stop scanner before (exclusive)<a name="line.221"></a>
+<span class="sourceLineNo">222</span>   * @deprecated use {@code new Scan().withStartRow(startRow).withStopRow(stopRow)} instead.<a name="line.222"></a>
+<span class="sourceLineNo">223</span>   */<a name="line.223"></a>
+<span class="sourceLineNo">224</span>  @Deprecated<a name="line.224"></a>
+<span class="sourceLineNo">225</span>  public Scan(byte[] startRow, byte[] stopRow) {<a name="line.225"></a>
+<span class="sourceLineNo">226</span>    setStartRow(startRow);<a name="line.226"></a>
+<span class="sourceLineNo">227</span>    setStopRow(stopRow);<a name="line.227"></a>
+<span class="sourceLineNo">228</span>  }<a name="line.228"></a>
+<span class="sourceLineNo">229</span><a name="line.229"></a>
+<span class="sourceLineNo">230</span>  /**<a name="line.230"></a>
+<span class="sourceLineNo">231</span>   * Creates a new instance of this class while copying all values.<a name="line.231"></a>
+<span class="sourceLineNo">232</span>   *<a name="line.232"></a>
+<span class="sourceLineNo">233</span>   * @param scan  The scan instance to copy from.<a name="line.233"></a>
+<span class="sourceLineNo">234</span>   * @throws IOException When copying the values fails.<a name="line.234"></a>
+<span class="sourceLineNo">235</span>   */<a name="line.235"></a>
+<span class="sourceLineNo">236</span>  public Scan(Scan scan) throws IOException {<a name="line.236"></a>
+<span class="sourceLineNo">237</span>    startRow = scan.getStartRow();<a name="line.237"></a>
+<span class="sourceLineNo">238</span>    includeStartRow = scan.includeStartRow();<a name="line.238"></a>
+<span class="sourceLineNo">239</span>    stopRow  = scan.getStopRow();<a name="line.239"></a>
+<span class="sourceLineNo">240</span>    includeStopRow = scan.includeStopRow();<a name="line.240"></a>
+<span class="sourceLineNo">241</span>    maxVersions = scan.getMaxVersions();<a name="line.241"></a>
+<span class="sourceLineNo">242</span>    batch = scan.getBatch();<a name="line.242"></a>
+<span class="sourceLineNo">243</span>    storeLimit = scan.getMaxResultsPerColumnFamily();<a name="line.243"></a>
+<span class="sourceLineNo">244</span>    storeOffset = scan.getRowOffsetPerColumnFamily();<a name="line.244"></a>
+<span class="sourceLineNo">245</span>    caching = scan.getCaching();<a name="line.245"></a>
+<span class="sourceLineNo">246</span>    maxResultSize = scan.getMaxResultSize();<a name="line.246"></a>
+<span class="sourceLineNo">247</span>    cacheBlocks = scan.getCacheBlocks();<a name="line.247"></a>
+<span class="sourceLineNo">248</span>    filter = scan.getFilter(); // clone?<a name="line.248"></a>
+<span class="sourceLineNo">249</span>    loadColumnFamiliesOnDemand = scan.getLoadColumnFamiliesOnDemandValue();<a name="line.249"></a>
+<span class="sourceLineNo">250</span>    consistency = scan.getConsistency();<a name="line.250"></a>
+<span class="sourceLineNo">251</span>    this.setIsolationLevel(scan.getIsolationLevel());<a name="line.251"></a>
+<span class="sourceLineNo">252</span>    reversed = scan.isReversed();<a name="line.252"></a>
+<span class="sourceLineNo">253</span>    asyncPrefetch = scan.isAsyncPrefetch();<a name="line.253"></a>
+<span class="sourceLineNo">254</span>    small = scan.isSmall();<a name="line.254"></a>
+<span class="sourceLineNo">255</span>    allowPartialResults = scan.getAllowPartialResults();<a name="line.255"></a>
+<span class="sourceLineNo">256</span>    tr = scan.getTimeRange(); // TimeRange is immutable<a name="line.256"></a>
+<span class="sourceLineNo">257</span>    Map&lt;byte[], NavigableSet&lt;byte[]&gt;&gt; fams = scan.getFamilyMap();<a name="line.257"></a>
+<span class="sourceLineNo">258</span>    for (Map.Entry&lt;byte[],NavigableSet&lt;byte[]&gt;&gt; entry : fams.entrySet()) {<a name="line.258"></a>
+<span class="sourceLineNo">259</span>      byte [] fam = entry.getKey();<a name="line.259"></a>
+<span class="sourceLineNo">260</span>      NavigableSet&lt;byte[]&gt; cols = entry.getValue();<a name="line.260"></a>
+<span class="sourceLineNo">261</span>      if (cols != null &amp;&amp; cols.size() &gt; 0) {<a name="line.261"></a>
+<span class="sourceLineNo">262</span>        for (byte[] col : cols) {<a name="line.262"></a>
+<span class="sourceLineNo">263</span>          addColumn(fam, col);<a name="line.263"></a>
+<span class="sourceLineNo">264</span>        }<a name="line.264"></a>
+<span class="sourceLineNo">265</span>      } else {<a name="line.265"></a>
+<span class="sourceLineNo">266</span>        addFamily(fam);<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>    for (Map.Entry&lt;String, byte[]&gt; attr : scan.getAttributesMap().entrySet()) {<a name="line.269"></a>
+<span class="sourceLineNo">270</span>      setAttribute(attr.getKey(), attr.getValue());<a name="line.270"></a>
+<span class="sourceLineNo">271</span>    }<a name="line.271"></a>
+<span class="sourceLineNo">272</span>    for (Map.Entry&lt;byte[], TimeRange&gt; entry : scan.getColumnFamilyTimeRange().entrySet()) {<a name="line.272"></a>
+<span class="sourceLineNo">273</span>      TimeRange tr = entry.getValue();<a name="line.273"></a>
+<span class="sourceLineNo">274</span>      setColumnFamilyTimeRange(entry.getKey(), tr.getMin(), tr.getMax());<a name="line.274"></a>
+<span class="sourceLineNo">275</span>    }<a name="line.275"></a>
+<span class="sourceLineNo">276</span>    this.mvccReadPoint = scan.getMvccReadPoint();<a name="line.276"></a>
+<span class="sourceLineNo">277</span>    this.limit = scan.getLimit();<a name="line.277"></a>
+<span class="sourceLineNo">278</span>  }<a name="line.278"></a>
+<span class="sourceLineNo">279</span><a name="line.279"></a>
+<span class="sourceLineNo">280</span>  /**<a name="line.280"></a>
+<span class="sourceLineNo">281</span>   * Builds a scan object with the same specs as get.<a name="line.281"></a>
+<span class="sourceLineNo">282</span>   * @param get get to model scan after<a name="line.282"></a>
+<span class="sourceLineNo">283</span>   */<a name="line.283"></a>
+<span class="sourceLineNo">284</span>  public Scan(Get get) {<a name="line.284"></a>
+<span class="sourceLineNo">285</span>    this.startRow = get.getRow();<a name="line.285"></a>
+<span class="sourceLineNo">286</span>    this.includeStartRow = true;<a name="line.286"></a>
+<span class="sourceLineNo">287</span>    this.stopRow = get.getRow();<a name="line.287"></a>
+<span class="sourceLineNo">288</span>    this.includeStopRow = true;<a name="line.288"></a>
+<span class="sourceLineNo">289</span>    this.filter = get.getFilter();<a name="line.289"></a>
+<span class="sourceLineNo">290</span>    this.cacheBlocks = get.getCacheBlocks();<a name="line.290"></a>
+<span class="sourceLineNo">291</span>    this.maxVersions = get.getMaxVersions();<a name="line.291"></a>
+<span class="sourceLineNo">292</span>    this.storeLimit = get.getMaxResultsPerColumnFamily();<a name="line.292"></a>
+<span class="sourceLineNo">293</span>    this.storeOffset = get.getRowOffsetPerColumnFamily();<a name="line.293"></a>
+<span class="sourceLineNo">294</span>    this.tr = get.getTimeRange();<a name="line.294"></a>
+<span class="sourceLineNo">295</span>    this.familyMap = get.getFamilyMap();<a name="line.295"></a>
+<span class="sourceLineNo">296</span>    this.asyncPrefetch = false;<a name="line.296"></a>
+<span class="sourceLineNo">297</span>    this.consistency = get.getConsistency();<a name="line.297"></a>
+<span class="sourceLineNo">298</span>    this.setIsolationLevel(get.getIsolationLevel());<a name="line.298"></a>
+<span class="sourceLineNo">299</span>    this.loadColumnFamiliesOnDemand = get.getLoadColumnFamiliesOnDemandValue();<a name="line.299"></a>
+<span class="sourceLineNo">300</span>    for (Map.Entry&lt;String, byte[]&gt; attr : get.getAttributesMap().entrySet()) {<a name="line.300"></a>
+<span class="sourceLineNo">301</span>      setAttribute(attr.getKey(), attr.getValue());<a name="line.301"></a>
+<span class="sourceLineNo">302</span>    }<a name="line.302"></a>
+<span class="sourceLineNo">303</span>    for (Map.Entry&lt;byte[], TimeRange&gt; entry : get.getColumnFamilyTimeRange().entrySet()) {<a name="line.303"></a>
+<span class="sourceLineNo">304</span>      TimeRange tr = entry.getValue();<a name="line.304"></a>
+<span class="sourceLineNo">305</span>      setColumnFamilyTimeRange(entry.getKey(), tr.getMin(), tr.getMax());<a name="line.305"></a>
+<span class="sourceLineNo">306</span>    }<a name="line.306"></a>
+<span class="sourceLineNo">307</span>    this.mvccReadPoint = -1L;<a name="line.307"></a>
+<span class="sourceLineNo">308</span>  }<a name="line.308"></a>
+<span class="sourceLineNo">309</span><a name="line.309"></a>
+<span class="sourceLineNo">310</span>  public boolean isGetScan() {<a name="line.310"></a>
+<span class="sourceLineNo">311</span>    return includeStartRow &amp;&amp; includeStopRow &amp;&amp; areStartRowAndStopRowEqual(startRow, stopRow);<a name="line.311"></a>
+<span class="sourceLineNo">312</span>  }<a name="line.312"></a>
+<span class="sourceLineNo">313</span><a name="line.313"></a>
+<span class="sourceLineNo">314</span>  private static boolean areStartRowAndStopRowEqual(byte[] startRow, byte[] stopRow) {<a name="line.314"></a>
+<span class="sourceLineNo">315</span>    return startRow != null &amp;&amp; startRow.length &gt; 0 &amp;&amp; Bytes.equals(startRow, stopRow);<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>   * Get all columns from the specified family.<a name="line.319"></a>
+<span class="sourceLineNo">320</span>   * &lt;p&gt;<a name="line.320"></a>
+<span class="sourceLineNo">321</span>   * Overrides previous calls to addColumn for this family.<a name="line.321"></a>
+<span class="sourceLineNo">322</span>   * @param family family name<a name="line.322"></a>
+<span class="sourceLineNo">323</span>   * @return this<a name="line.323"></a>
+<span class="sourceLineNo">324</span>   */<a name="line.324"></a>
+<span class="sourceLineNo">325</span>  public Scan addFamily(byte [] family) {<a name="line.325"></a>
+<span class="sourceLineNo">326</span>    familyMap.remove(family);<a name="line.326"></a>
+<span class="sourceLineNo">327</span>    familyMap.put(family, null);<a name="line.327"></a>
+<span class="sourceLineNo">328</span>    return this;<a name="line.328"></a>
+<span class="sourceLineNo">329</span>  }<a name="line.329"></a>
+<span class="sourceLineNo">330</span><a name="line.330"></a>
+<span class="sourceLineNo">331</span>  /**<a name="line.331"></a>
+<span class="sourceLineNo">332</span>   * Get the column from the specified family with the specified qualifier.<a name="line.332"></a>
+<span class="sourceLineNo">333</span>   * &lt;p&gt;<a name="line.333"></a>
+<span class="sourceLineNo">334</span>   * Overrides previous calls to addFamily for this family.<a name="line.334"></a>
+<span class="sourceLineNo">335</span>   * @param family family name<a name="line.335"></a>
+<span class="sourceLineNo">336</span>   * @param qualifier column qualifier<a name="line.336"></a>
+<span class="sourceLineNo">337</span>   * @return this<a name="line.337"></a>
+<span class="sourceLineNo">338</span>   */<a name="line.338"></a>
+<span class="sourceLineNo">339</span>  public Scan addColumn(byte [] family, byte [] qualifier) {<a name="line.339"></a>
+<span class="sourceLineNo">340</span>    NavigableSet&lt;byte []&gt; set = familyMap.get(family);<a name="line.340"></a>
+<span class="sourceLineNo">341</span>    if(set == null) {<a name="line.341"></a>
+<span class="sourceLineNo">342</span>      set = new TreeSet&lt;byte []&gt;(Bytes.BYTES_COMPARATOR);<a name="line.342"></a>
+<span class="sourceLineNo">343</span>    }<a name="line.343"></a>
+<span class="sourceLineNo">344</span>    if (qualifier == null) {<a name="line.344"></a>
+<span class="sourceLineNo">345</span>      qualifier = HConstants.EMPTY_BYTE_ARRAY;<a name="line.345"></a>
+<span class="sourceLineNo">346</span>    }<a name="line.346"></a>
+<span class="sourceLineNo">347</span>    set.add(qualifier);<a name="line.347"></a>
+<span class="sourceLineNo">348</span>    familyMap.put(family, set);<a name="line.348"></a>
+<span class="sourceLineNo">349</span>    return this;<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>  /**<a name="line.352"></a>
+<span class="sourceLineNo">353</span>   * Set versions of columns only within the specified timestamp range,<a name="line.353"></a>
+<span class="sourceLineNo">354</span>   * [minStamp, maxStamp).  Note, default maximum versions to return is 1.  If<a name="line.354"></a>
+<span class="sourceLineNo">355</span>   * your time range spans more than one version and you want all versions<a name="line.355"></a>
+<span class="sourceLineNo">356</span>   * returned, up the number of versions beyond the default.<a name="line.356"></a>
+<span class="sourceLineNo">357</span>   * @param minStamp minimum timestamp value, inclusive<a name="line.357"></a>
+<span class="sourceLineNo">358</span>   * @param maxStamp maximum timestamp value, exclusive<a name="line.358"></a>
+<span class="sourceLineNo">359</span>   * @see #setMaxVersions()<a name="line.359"></a>
+<span class="sourceLineNo">360</span>   * @see #setMaxVersions(int)<a name="line.360"></a>
+<span class="sourceLineNo">361</span>   * @return this<a name="line.361"></a>
+<span class="sourceLineNo">362</span>   */<a name="line.362"></a>
+<span class="sourceLineNo">363</span>  @Override<a name="line.363"></a>
+<span class="sourceLineNo">364</span>  public Scan setTimeRange(long minStamp, long maxStamp) throws IOException {<a name="line.364"></a>
+<span class="sourceLineNo">365</span>    return (Scan) super.setTimeRange(minStamp, maxStamp);<a name="line.365"></a>
+<span class="sourceLineNo">366</span>  }<a name="line.366"></a>
+<span class="sourceLineNo">367</span><a name="line.367"></a>
+<span class="sourceLineNo">368</span>  /**<a name="line.368"></a>
+<span class="sourceLineNo">369</span>   * Set versions of columns only within the specified timestamp range,<a name="line.369"></a>
+<span class="sourceLineNo">370</span>   * @param tr Input TimeRange<a name="line.370"></a>
+<span class="sourceLineNo">371</span>   * @return this for invocation chaining<a name="line.371"></a>
+<span class="sourceLineNo">372</span>   */<a name="line.372"></a>
+<span class="sourceLineNo">373</span>  public Scan setTimeRange(TimeRange tr) {<a name="line.373"></a>
+<span class="sourceLineNo">374</span>    return (Scan) super.setTimeRange(tr);<a name="line.374"></a>
+<span class="sourceLineNo">375</span>  }<a name="line.375"></a>
+<span class="sourceLineNo">376</span><a name="line.376"></a>
+<span class="sourceLineNo">377</span>  /**<a name="line.377"></a>
+<span class="sourceLineNo">378</span>   * Get versions of columns with the specified timestamp. Note, default maximum<a name="line.378"></a>
+<span class="sourceLineNo">379</span>   * versions to return is 1.  If your time range spans more than one version<a name="line.379"></a>
+<span class="sourceLineNo">380</span>   * and you want all versions returned, up the number of versions beyond the<a name="line.380"></a>
+<span class="sourceLineNo">381</span>   * defaut.<a name="line.381"></a>
+<span class="sourceLineNo">382</span>   * @param timestamp version timestamp<a name="line.382"></a>
+<span class="sourceLineNo">383</span>   * @see #setMaxVersions()<a name="line.383"></a>
+<span class="sourceLineNo">384</span>   * @see #setMaxVersions(int)<a name="line.384"></a>
+<span class="sourceLineNo">385</span>   * @return this<a name="line.385"></a>
+<span class="sourceLineNo">386</span>   */<a name="line.386"></a>
+<span class="sourceLineNo">387</span>  public Scan setTimeStamp(long timestamp)<a name="line.387"></a>
+<span class="sourceLineNo">388</span>  throws IOException {<a name="line.388"></a>
+<span class="sourceLineNo">389</span>    try {<a name="line.389"></a>
+<span class="sourceLineNo">390</span>      super.setTimeRange(timestamp, timestamp + 1);<a name="line.390"></a>
+<span class="sourceLineNo">391</span>    } catch(Exception e) {<a name="line.391"></a>
+<span class="sourceLineNo">392</span>      // This should never happen, unless integer overflow or something extremely wrong...<a name="line.392"></a>
+<span class="sourceLineNo">393</span>      LOG.error("TimeRange failed, likely caused by integer overflow. ", e);<a name="line.393"></a>
+<span class="sourceLineNo">394</span>      throw e;<a name="line.394"></a>
+<span class="sourceLineNo">395</span>    }<a name="line.395"></a>
+<span class="sourceLineNo">396</span>    return this;<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>  @Override<a name="line.399"></a>
+<span class="sourceLineNo">400</span>  public Scan setColumnFamilyTimeRange(byte[] cf, long minStamp, long maxStamp) {<a name="line.400"></a>
+<span class="sourceLineNo">401</span>    return (Scan) super.setColumnFamilyTimeRange(cf, minStamp, maxStamp);<a name="line.401"></a>
 <span class="sourceLineNo">402</span>  }<a name="line.402"></a>
 <span class="sourceLineNo">403</span><a name="line.403"></a>
-<span class="sourceLineNo">404</span>  /**<a name="line.404"></a>
-<span class="sourceLineNo">405</span>   * Set the stop row of the scan.<a name="line.405"></a>
-<span class="sourceLineNo">406</span>   * @param stopRow row to end at (exclusive)<a name="line.406"></a>
-<span class="sourceLineNo">407</span>   * &lt;p&gt;<a name="line.407"></a>
-<span class="sourceLineNo">408</span>   * The scan will include rows that are lexicographically less than<a name="line.408"></a>
-<span class="sourceLineNo">409</span>   * the provided stopRow.<a name="line.409"></a>
-<span class="sourceLineNo">410</span>   * &lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; When doing a filter for a rowKey &lt;u&gt;Prefix&lt;/u&gt;<a name="line.410"></a>
-<span class="sourceLineNo">411</span>   * use {@link #setRowPrefixFilter(byte[])}.<a name="line.411"></a>
-<span class="sourceLineNo">412</span>   * The 'trailing 0' will not yield the desired result.&lt;/p&gt;<a name="line.412"></a>
-<span class="sourceLineNo">413</span>   * @return this<a name="line.413"></a>
-<span class="sourceLineNo">414</span>   * @throws IllegalArgumentException if stopRow does not meet criteria<a name="line.414"></a>
-<span class="sourceLineNo">415</span>   * for a row key (when length exceeds {@link HConstants#MAX_ROW_LENGTH})<a name="line.415"></a>
-<span class="sourceLineNo">416</span>   */<a name="line.416"></a>
-<span class="sourceLineNo">417</span>  public Scan setStopRow(byte [] stopRow) {<a name="line.417"></a>
-<span class="sourceLineNo">418</span>    if (Bytes.len(stopRow) &gt; HConstants.MAX_ROW_LENGTH) {<a name="line.418"></a>
-<span class="sourceLineNo">419</span>      throw new IllegalArgumentException(<a name="line.419"></a>
-<span class="sourceLineNo">420</span>        "stopRow's length must be less than or equal to " +<a name="line.420"></a>
-<span class="sourceLineNo">421</span>        HConstants.MAX_ROW_LENGTH + " to meet the criteria" +<a name="line.421"></a>
-<span class="sourceLineNo">422</span>        " for a row key.");<a name="line.422"></a>
-<span class="sourceLineNo">423</span>    }<a name="line.423"></a>
-<span class="sourceLineNo">424</span>    this.stopRow = stopRow;<a name="line.424"></a>
-<span class="sourceLineNo">425</span>    return this;<a name="line.425"></a>
-<span class="sourceLineNo">426</span>  }<a name="line.426"></a>
-<span class="sourceLineNo">427</span><a name="line.427"></a>
-<span class="sourceLineNo">428</span>  /**<a name="line.428"></a>
-<span class="sourceLineNo">429</span>   * &lt;p&gt;Set a filter (using stopRow and startRow) so the result set only contains rows where the<a name="line.429"></a>
-<span class="sourceLineNo">430</span>   * rowKey starts with the specified prefix.&lt;/p&gt;<a name="line.430"></a>
-<span class="sourceLineNo">431</span>   * &lt;p&gt;This is a utility method that converts the desired rowPrefix into the appropriate values<a name="line.431"></a>
-<span class="sourceLineNo">432</span>   * for the startRow and stopRow to achieve the desired result.&lt;/p&gt;<a name="line.432"></a>
-<span class="sourceLineNo">433</span>   * &lt;p&gt;This can safely be used in combination with setFilter.&lt;/p&gt;<a name="line.433"></a>
-<span class="sourceLineNo">434</span>   * &lt;p&gt;&lt;b&gt;NOTE: Doing a {@link #setStartRow(byte[])} and/or {@link #setStopRow(byte[])}<a name="line.434"></a>
-<span class="sourceLineNo">435</span>   * after this method will yield undefined results.&lt;/b&gt;&lt;/p&gt;<a name="line.435"></a>
-<span class="sourceLineNo">436</span>   * @param rowPrefix the prefix all rows must start with. (Set &lt;i&gt;null&lt;/i&gt; to remove the filter.)<a name="line.436"></a>
+<span class="sourceLineNo">404</span>  @Override<a name="line.404"></a>
+<span class="sourceLineNo">405</span>  public Scan setColumnFamilyTimeRange(byte[] cf, TimeRange tr) {<a name="line.405"></a>
+<span class="sourceLineNo">406</span>    return (Scan) super.setColumnFamilyTimeRange(cf, tr);<a name="line.406"></a>
+<span class="sourceLineNo">407</span>  }<a name="line.407"></a>
+<span class="sourceLineNo">408</span><a name="line.408"></a>
+<span class="sourceLineNo">409</span>  /**<a name="line.409"></a>
+<span class="sourceLineNo">410</span>   * Set the start row of the scan.<a name="line.410"></a>
+<span class="sourceLineNo">411</span>   * &lt;p&gt;<a name="line.411"></a>
+<span class="sourceLineNo">412</span>   * If the specified row does not exist, the Scanner will start from the next closest row after the<a name="line.412"></a>
+<span class="sourceLineNo">413</span>   * specified row.<a name="line.413"></a>
+<span class="sourceLineNo">414</span>   * @param startRow row to start scanner at or after<a name="line.414"></a>
+<span class="sourceLineNo">415</span>   * @return this<a name="line.415"></a>
+<span class="sourceLineNo">416</span>   * @throws IllegalArgumentException if startRow does not meet criteria for a row key (when length<a name="line.416"></a>
+<span class="sourceLineNo">417</span>   *           exceeds {@link HConstants#MAX_ROW_LENGTH})<a name="line.417"></a>
+<span class="sourceLineNo">418</span>   * @deprecated use {@link #withStartRow(byte[])} instead. This method may change the inclusive of<a name="line.418"></a>
+<span class="sourceLineNo">419</span>   *             the stop row to keep compatible with the old behavior.<a name="line.419"></a>
+<span class="sourceLineNo">420</span>   */<a name="line.420"></a>
+<span class="sourceLineNo">421</span>  @Deprecated<a name="line.421"></a>
+<span class="sourceLineNo">422</span>  public Scan setStartRow(byte[] startRow) {<a name="line.422"></a>
+<span class="sourceLineNo">423</span>    withStartRow(startRow);<a name="line.423"></a>
+<span class="sourceLineNo">424</span>    if (areStartRowAndStopRowEqual(startRow, stopRow)) {<a name="line.424"></a>
+<span class="sourceLineNo">425</span>      // for keeping the old behavior that a scan with the same start and stop row is a get scan.<a name="line.425"></a>
+<span class="sourceLineNo">426</span>      this.includeStopRow = true;<a name="line.426"></a>
+<span class="sourceLineNo">427</span>    }<a name="line.427"></a>
+<span class="sourceLineNo">428</span>    return this;<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>  /**<a name="line.431"></a>
+<span class="sourceLineNo">432</span>   * Set the start row of the scan.<a name="line.432"></a>
+<span class="sourceLineNo">433</span>   * &lt;p&gt;<a name="line.433"></a>
+<span class="sourceLineNo">434</span>   * If the specified row does not exist, the Scanner will start from the next closest row after the<a name="line.434"></a>
+<span class="sourceLineNo">435</span>   * specified row.<a name="line.435"></a>
+<span class="sourceLineNo">436</span>   * @param startRow row to start scanner at or after<a name="line.436"></a>
 <span class="sourceLineNo">437</span>   * @return this<a name="line.437"></a>
-<span class="sourceLineNo">438</span>   */<a name="line.438"></a>
-<span class="sourceLineNo">439</span>  public Scan setRowPrefixFilter(byte[] rowPrefix) {<a name="line.439"></a>
-<span class="sourceLineNo">440</span>    if (rowPrefix == null) {<a name="line.440"></a>
-<span class="sourceLineNo">441</span>      setStartRow(HConstants.EMPTY_START_ROW);<a name="line.441"></a>
-<span class="sourceLineNo">442</span>      setStopRow(HConstants.EMPTY_END_ROW);<a name="line.442"></a>
-<span class="sourceLineNo">443</span>    } else {<a name="line.443"></a>
-<span class="sourceLineNo">444</span>      this.setStartRow(rowPrefix);<a name="line.444"></a>
-<span class="sourceLineNo">445</span>      this.setStopRow(calculateTheClosestNextRowKeyForPrefix(rowPrefix));<a name="line.445"></a>
-<span class="sourceLineNo">446</span>    }<a name="line.446"></a>
-<span class="sourceLineNo">447</span>    return this;<a name="line.447"></a>
-<span class="sourceLineNo">448</span>  }<a name="line.448"></a>
-<span class="sourceLineNo">449</span><a name="line.449"></a>
-<span class="sourceLineNo">450</span>  /**<a name="line.450"></a>
-<span class="sourceLineNo">451</span>   * &lt;p&gt;When scanning for a prefix the scan should stop immediately after the the last row that<a name="line.451"></a>
-<span class="sourceLineNo">452</span>   * has the specified prefix. This method calculates the closest next rowKey immediately following<a name="line.452"></a>
-<span class="sourceLineNo">453</span>   * the given rowKeyPrefix.&lt;/p&gt;<a name="line.453"></a>
-<span class="sourceLineNo">454</span>   * &lt;p&gt;&lt;b&gt;IMPORTANT: This converts a rowKey&lt;u&gt;Prefix&lt;/u&gt; into a rowKey&lt;/b&gt;.&lt;/p&gt;<a name="line.454"></a>
-<span class="sourceLineNo">455</span>   * &lt;p&gt;If the prefix is an 'ASCII' string put into a byte[] then this is easy because you can<a name="line.455"></a>
-<span class="sourceLineNo">456</span>   * simply increment the last byte of the array.<a name="line.456"></a>
-<span class="sourceLineNo">457</span>   * But if your application uses real binary rowids you may run into the scenario that your<a name="line.457"></a>
-<span class="sourceLineNo">458</span>   * prefix is something like:&lt;/p&gt;<a name="line.458"></a>
-<span class="sourceLineNo">459</span>   * &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;b&gt;{ 0x12, 0x23, 0xFF, 0xFF }&lt;/b&gt;&lt;br/&gt;<a name="line.459"></a>
-<span class="sourceLineNo">460</span>   * Then this stopRow needs to be fed into the actual scan&lt;br/&gt;<a name="line.460"></a>
-<span class="sourceLineNo">461</span>   * &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;b&gt;{ 0x12, 0x24 }&lt;/b&gt; (Notice that it is shorter now)&lt;br/&gt;<a name="line.461"></a>
-<span class="sourceLineNo">462</span>   * This method calculates the correct stop row value for this usecase.<a name="line.462"></a>
-<span class="sourceLineNo">463</span>   *<a name="line.463"></a>
-<span class="sourceLineNo">464</span>   * @param rowKeyPrefix the rowKey&lt;u&gt;Prefix&lt;/u&gt;.<a name="line.464"></a>
-<span class="sourceLineNo">465</span>   * @return the closest next rowKey immediately following the given rowKeyPrefix.<a name="line.465"></a>
-<span class="sourceLineNo">466</span>   */<a name="line.466"></a>
-<span class="sourceLineNo">467</span>  private byte[] calculateTheClosestNextRowKeyForPrefix(byte[] rowKeyPrefix) {<a name="line.467"></a>
-<span class="sourceLineNo">468</span>    // Essentially we are treating it like an 'unsigned very very long' and doing +1 manually.<a name="line.468"></a>
-<span class="sourceLineNo">469</span>    // Search for the place where the trailing 0xFFs start<a name="line.469"></a>
-<span class="sourceLineNo">470</span>    int offset = rowKeyPrefix.length;<a name="line.470"></a>
-<span class="sourceLineNo">471</span>    while (offset &gt; 0) {<a name="line.471"></a>
-<span class="sourceLineNo">472</span>      if (rowKeyPrefix[offset - 1] != (byte) 0xFF) {<a name="line.472"></a>
-<span class="sourceLineNo">473</span>        break;<a name="line.473"></a>
-<span class="sourceLineNo">474</span>      }<a name="line.474"></a>
-<span class="sourceLineNo">475</span>      offset--;<a name="line.475"></a>
-<span class="sourceLineNo">476</span>    }<a name="line.476"></a>
-<span class="sourceLineNo">477</span><a name="line.477"></a>
-<span class="sourceLineNo">478</span>    if (offset == 0) {<a name="line.478"></a>
-<span class="sourceLineNo">479</span>      // We got an 0xFFFF... (only FFs) stopRow value which is<a name="line.479"></a>
-<span class="sourceLineNo">480</span>      // the last possible prefix before the end of the table.<a name="line.480"></a>
-<span class="sourceLineNo">481</span>      // So set it to stop at the 'end of the table'<a name="line.481"></a>
-<span class="sourceLineNo">482</span>      return HConstants.EMPTY_END_ROW;<a name="line.482"></a>
-<span class="sourceLineNo">483</span>    }<a name="line.483"></a>
-<span class="sourceLineNo">484</span><a name="line.484"></a>
-<span class="sourceLineNo">485</span>    // Copy the right length of the original<a name="line.485"></a>
-<span class="sourceLineNo">486</span>    byte[] newStopRow = Arrays.copyOfRange(rowKeyPrefix, 0, offset);<a name="line.486"></a>
-<span class="sourceLineNo">487</span>    // And increment the last one<a name="line.487"></a>
-<span class="sourceLineNo">488</span>    newStopRow[newStopRow.length - 1]++;<a name="line.488"></a>
-<span class="sourceLineNo">489</span>    return newStopRow;<a name="line.489"></a>
-<span class="sourceLineNo">490</span>  }<a name="line.490"></a>
-<span class="sourceLineNo">491</span><a name="line.491"></a>
-<span class="sourceLineNo">492</span>  /**<a name="line.492"></a>
-<span class="sourceLineNo">493</span>   * Get all available versions.<a name="line.493"></a>
-<span class="sourceLineNo">494</span>   * @return this<a name="line.494"></a>
-<span class="sourceLineNo">495</span>   */<a name="line.495"></a>
-<span class="sourceLineNo">496</span>  public Scan setMaxVersions() {<a name="line.496"></a>
-<span class="sourceLineNo">497</span>    this.maxVersions = Integer.MAX_VALUE;<a name="line.497"></a>
-<span class="sourceLineNo">498</span>    return this;<a name="line.498"></a>
-<span class="sourceLineNo">499</span>  }<a name="line.499"></a>
-<span class="sourceLineNo">500</span><a name="line.500"></a>
-<span class="sourceLineNo">501</span>  /**<a name="line.501"></a>
-<span class="sourceLineNo">502</span>   * Get up to the specified number of versions of each column.<a name="line.502"></a>
-<span class="sourceLineNo">503</span>   * @param maxVersions maximum versions for each column<a name="line.503"></a>
-<span class="sourceLineNo">504</span>   * @return this<a name="line.504"></a>
-<span class="sourceLineNo">505</span>   */<a name="line.505"></a>
-<span class="sourceLineNo">506</span>  public Scan setMaxVersions(int maxVersions) {<a name="line.506"></a>
-<span class="sourceLineNo">507</span>    this.maxVersions = maxVersions;<a name="line.507"></a>
-<span class="sourceLineNo">508</span>    return this;<a name="line.508"></a>
-<span class="sourceLineNo">509</span>  }<a name="line.509"></a>
-<span class="sourceLineNo">510</span><a name="line.510"></a>
-<span class="sourceLineNo">511</span>  /**<a name="line.511"></a>
-<span class="sourceLineNo">512</span>   * Set the maximum number of values to return for each call to next().<a name="line.512"></a>
-<span class="sourceLineNo">513</span>   * Callers should be aware that invoking this method with any value<a name="line.513"></a>
-<span class="sourceLineNo">514</span>   * is equivalent to calling {@link #setAllowPartialResults(boolean)}<a name="line.514"></a>
-<span class="sourceLineNo">515</span>   * with a value of {@code true}; partial results may be returned if<a name="line.515"></a>
-<span class="sourceLineNo">516</span>   * this method is called. Use {@link #setMaxResultSize(long)}} to<a name="line.516"></a>
-<span class="sourceLineNo">517</span>   * limit the size of a Scan's Results instead.<a name="line.517"></a>
-<span class="sourceLineNo">518</span>   *<a name="line.518"></a>
-<span class="sourceLineNo">519</span>   * @param batch the maximum number of values<a name="line.519"></a>
-<span class="sourceLineNo">520</span>   */<a name="line.520"></a>
-<span class="sourceLineNo">521</span>  public Scan setBatch(int batch) {<a name="line.521"></a>
-<span class="sourceLineNo">522</span>    if (this.hasFilter() &amp;&amp; this.filter.hasFilterRow()) {<a name="line.522"></a>
-<span class="sourceLineNo">523</span>      throw new IncompatibleFilterException(<a name="line.523"></a>
-<span class="sourceLineNo">524</span>        "Cannot set batch on a scan using a filter" +<a name="line.524"></a>
-<span class="sourceLineNo">525</span>        " that returns true for filter.hasFilterRow");<a name="line.525"></a>
-<span class="sourceLineNo">526</span>    }<a name="line.526"></a>
-<span class="sourceLineNo">527</span>    this.batch = batch;<a name="line.527"></a>
-<span class="sourceLineNo">528</span>    return this;<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>   * Set the maximum number of values to return per row per Column Family<a name="line.532"></a>
-<span class="sourceLineNo">533</span>   * @param limit the maximum number of values returned / row / CF<a name="line.533"></a>
-<span class="sourceLineNo">534</span>   */<a name="line.534"></a>
-<span class="sourceLineNo">535</span>  public Scan setMaxResultsPerColumnFamily(int limit) {<a name="line.535"></a>
-<span class="sourceLineNo">536</span>    this.storeLimit = limit;<a name="line.536"></a>
-<span class="sourceLineNo">537</span>    return this;<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>  /**<a name="line.540"></a>
-<span class="sourceLineNo">541</span>   * Set offset for the row per Column Family.<a name="line.541"></a>
-<span class="sourceLineNo">542</span>   * @param offset is the number of kvs that will be skipped.<a name="line.542"></a>
-<span class="sourceLineNo">543</span>   */<a name="line.543"></a>
-<span class="sourceLineNo">544</span>  public Scan setRowOffsetPerColumnFamily(int offset) {<a name="line.544"></a>
-<span class="sourceLineNo">545</span>    this.storeOffset = offset;<a name="line.545"></a>
-<span class="sourceLineNo">546</span>    return this;<a name="line.546"></a>
-<span class="sourceLineNo">547</span>  }<a name="line.547"></a>
-<span class="sourceLineNo">548</span><a name="line.548"></a>
-<span class="sourceLineNo">549</span>  /**<a name="line.549"></a>
-<span class="sourceLineNo">550</span>   * Set the number of rows for caching that will be passed to scanners.<a name="line.550"></a>
-<span class="sourceLineNo">551</span>   * If not set, the Configuration setting {@link HCon

<TRUNCATED>

Mime
View raw message