hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mi...@apache.org
Subject [30/49] hbase-site git commit: Published site at 4b3e38705cb24aee82615b1b9af47ed549ea1358.
Date Thu, 03 Mar 2016 17:17:16 GMT
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/4ce8323f/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/AnnotationReadingPriorityFunction.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/AnnotationReadingPriorityFunction.html b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/AnnotationReadingPriorityFunction.html
index 6948cc6..f80501b 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/AnnotationReadingPriorityFunction.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/AnnotationReadingPriorityFunction.html
@@ -51,261 +51,247 @@
 <span class="sourceLineNo">043</span>import com.google.common.annotations.VisibleForTesting;<a name="line.43"></a>
 <span class="sourceLineNo">044</span>import com.google.protobuf.Message;<a name="line.44"></a>
 <span class="sourceLineNo">045</span>import com.google.protobuf.TextFormat;<a name="line.45"></a>
-<span class="sourceLineNo">046</span>import org.apache.hadoop.hbase.security.Superusers;<a name="line.46"></a>
-<span class="sourceLineNo">047</span>import org.apache.hadoop.hbase.security.User;<a name="line.47"></a>
-<span class="sourceLineNo">048</span><a name="line.48"></a>
-<span class="sourceLineNo">049</span>/**<a name="line.49"></a>
-<span class="sourceLineNo">050</span> * Reads special method annotations and table names to figure a priority for use by QoS facility in<a name="line.50"></a>
-<span class="sourceLineNo">051</span> * ipc; e.g: rpcs to hbase:meta get priority.<a name="line.51"></a>
-<span class="sourceLineNo">052</span> */<a name="line.52"></a>
-<span class="sourceLineNo">053</span>// TODO: Remove.  This is doing way too much work just to figure a priority.  Do as Elliott<a name="line.53"></a>
-<span class="sourceLineNo">054</span>// suggests and just have the client specify a priority.<a name="line.54"></a>
-<span class="sourceLineNo">055</span><a name="line.55"></a>
-<span class="sourceLineNo">056</span>//The logic for figuring out high priority RPCs is as follows:<a name="line.56"></a>
-<span class="sourceLineNo">057</span>//1. if the method is annotated with a QosPriority of QOS_HIGH,<a name="line.57"></a>
-<span class="sourceLineNo">058</span>//   that is honored<a name="line.58"></a>
-<span class="sourceLineNo">059</span>//2. parse out the protobuf message and see if the request is for meta<a name="line.59"></a>
-<span class="sourceLineNo">060</span>//   region, and if so, treat it as a high priority RPC<a name="line.60"></a>
-<span class="sourceLineNo">061</span>//Some optimizations for (2) are done here -<a name="line.61"></a>
-<span class="sourceLineNo">062</span>//Clients send the argument classname as part of making the RPC. The server<a name="line.62"></a>
-<span class="sourceLineNo">063</span>//decides whether to deserialize the proto argument message based on the<a name="line.63"></a>
-<span class="sourceLineNo">064</span>//pre-established set of argument classes (knownArgumentClasses below).<a name="line.64"></a>
-<span class="sourceLineNo">065</span>//This prevents the server from having to deserialize all proto argument<a name="line.65"></a>
-<span class="sourceLineNo">066</span>//messages prematurely.<a name="line.66"></a>
-<span class="sourceLineNo">067</span>//All the argument classes declare a 'getRegion' method that returns a<a name="line.67"></a>
-<span class="sourceLineNo">068</span>//RegionSpecifier object. Methods can be invoked on the returned object<a name="line.68"></a>
-<span class="sourceLineNo">069</span>//to figure out whether it is a meta region or not.<a name="line.69"></a>
-<span class="sourceLineNo">070</span>@InterfaceAudience.Private<a name="line.70"></a>
-<span class="sourceLineNo">071</span>public class AnnotationReadingPriorityFunction implements PriorityFunction {<a name="line.71"></a>
-<span class="sourceLineNo">072</span>  private static final Log LOG =<a name="line.72"></a>
-<span class="sourceLineNo">073</span>    LogFactory.getLog(AnnotationReadingPriorityFunction.class.getName());<a name="line.73"></a>
-<span class="sourceLineNo">074</span><a name="line.74"></a>
-<span class="sourceLineNo">075</span>  /** Used to control the scan delay, currently sqrt(numNextCall * weight) */<a name="line.75"></a>
-<span class="sourceLineNo">076</span>  public static final String SCAN_VTIME_WEIGHT_CONF_KEY = "hbase.ipc.server.scan.vtime.weight";<a name="line.76"></a>
-<span class="sourceLineNo">077</span><a name="line.77"></a>
-<span class="sourceLineNo">078</span>  protected final Map&lt;String, Integer&gt; annotatedQos;<a name="line.78"></a>
-<span class="sourceLineNo">079</span>  //We need to mock the regionserver instance for some unit tests (set via<a name="line.79"></a>
-<span class="sourceLineNo">080</span>  //setRegionServer method.<a name="line.80"></a>
-<span class="sourceLineNo">081</span>  private RSRpcServices rpcServices;<a name="line.81"></a>
-<span class="sourceLineNo">082</span>  @SuppressWarnings("unchecked")<a name="line.82"></a>
-<span class="sourceLineNo">083</span>  private final Class&lt;? extends Message&gt;[] knownArgumentClasses = new Class[]{<a name="line.83"></a>
-<span class="sourceLineNo">084</span>      GetRegionInfoRequest.class,<a name="line.84"></a>
-<span class="sourceLineNo">085</span>      GetStoreFileRequest.class,<a name="line.85"></a>
-<span class="sourceLineNo">086</span>      CloseRegionRequest.class,<a name="line.86"></a>
-<span class="sourceLineNo">087</span>      FlushRegionRequest.class,<a name="line.87"></a>
-<span class="sourceLineNo">088</span>      SplitRegionRequest.class,<a name="line.88"></a>
-<span class="sourceLineNo">089</span>      CompactRegionRequest.class,<a name="line.89"></a>
-<span class="sourceLineNo">090</span>      GetRequest.class,<a name="line.90"></a>
-<span class="sourceLineNo">091</span>      MutateRequest.class,<a name="line.91"></a>
-<span class="sourceLineNo">092</span>      ScanRequest.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>  // Some caches for helping performance<a name="line.95"></a>
-<span class="sourceLineNo">096</span>  private final Map&lt;String, Class&lt;? extends Message&gt;&gt; argumentToClassMap =<a name="line.96"></a>
-<span class="sourceLineNo">097</span>    new HashMap&lt;String, Class&lt;? extends Message&gt;&gt;();<a name="line.97"></a>
-<span class="sourceLineNo">098</span>  private final Map&lt;String, Map&lt;Class&lt;? extends Message&gt;, Method&gt;&gt; methodMap =<a name="line.98"></a>
-<span class="sourceLineNo">099</span>    new HashMap&lt;String, Map&lt;Class&lt;? extends Message&gt;, Method&gt;&gt;();<a name="line.99"></a>
-<span class="sourceLineNo">100</span><a name="line.100"></a>
-<span class="sourceLineNo">101</span>  private final float scanVirtualTimeWeight;<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>   * Calls {@link #AnnotationReadingPriorityFunction(RSRpcServices, Class)} using the result of<a name="line.104"></a>
-<span class="sourceLineNo">105</span>   * {@code rpcServices#getClass()}<a name="line.105"></a>
-<span class="sourceLineNo">106</span>   *<a name="line.106"></a>
-<span class="sourceLineNo">107</span>   * @param rpcServices<a name="line.107"></a>
-<span class="sourceLineNo">108</span>   *          The RPC server implementation<a name="line.108"></a>
-<span class="sourceLineNo">109</span>   */<a name="line.109"></a>
-<span class="sourceLineNo">110</span>  public AnnotationReadingPriorityFunction(final RSRpcServices rpcServices) {<a name="line.110"></a>
-<span class="sourceLineNo">111</span>    this(rpcServices, rpcServices.getClass());<a name="line.111"></a>
-<span class="sourceLineNo">112</span>  }<a name="line.112"></a>
-<span class="sourceLineNo">113</span><a name="line.113"></a>
-<span class="sourceLineNo">114</span>  /**<a name="line.114"></a>
-<span class="sourceLineNo">115</span>   * Constructs the priority function given the RPC server implementation and the annotations on the<a name="line.115"></a>
-<span class="sourceLineNo">116</span>   * methods in the provided {@code clz}.<a name="line.116"></a>
-<span class="sourceLineNo">117</span>   *<a name="line.117"></a>
-<span class="sourceLineNo">118</span>   * @param rpcServices<a name="line.118"></a>
-<span class="sourceLineNo">119</span>   *          The RPC server implementation<a name="line.119"></a>
-<span class="sourceLineNo">120</span>   * @param clz<a name="line.120"></a>
-<span class="sourceLineNo">121</span>   *          The concrete RPC server implementation's class<a name="line.121"></a>
-<span class="sourceLineNo">122</span>   */<a name="line.122"></a>
-<span class="sourceLineNo">123</span>  public AnnotationReadingPriorityFunction(final RSRpcServices rpcServices,<a name="line.123"></a>
-<span class="sourceLineNo">124</span>      Class&lt;? extends RSRpcServices&gt; clz) {<a name="line.124"></a>
-<span class="sourceLineNo">125</span>    Map&lt;String,Integer&gt; qosMap = new HashMap&lt;String,Integer&gt;();<a name="line.125"></a>
-<span class="sourceLineNo">126</span>    for (Method m : clz.getMethods()) {<a name="line.126"></a>
-<span class="sourceLineNo">127</span>      QosPriority p = m.getAnnotation(QosPriority.class);<a name="line.127"></a>
-<span class="sourceLineNo">128</span>      if (p != null) {<a name="line.128"></a>
-<span class="sourceLineNo">129</span>        // Since we protobuf'd, and then subsequently, when we went with pb style, method names<a name="line.129"></a>
-<span class="sourceLineNo">130</span>        // are capitalized.  This meant that this brittle compare of method names gotten by<a name="line.130"></a>
-<span class="sourceLineNo">131</span>        // reflection no longer matched the method names coming in over pb.  TODO: Get rid of this<a name="line.131"></a>
-<span class="sourceLineNo">132</span>        // check.  For now, workaround is to capitalize the names we got from reflection so they<a name="line.132"></a>
-<span class="sourceLineNo">133</span>        // have chance of matching the pb ones.<a name="line.133"></a>
-<span class="sourceLineNo">134</span>        String capitalizedMethodName = capitalize(m.getName());<a name="line.134"></a>
-<span class="sourceLineNo">135</span>        qosMap.put(capitalizedMethodName, p.priority());<a name="line.135"></a>
-<span class="sourceLineNo">136</span>      }<a name="line.136"></a>
-<span class="sourceLineNo">137</span>    }<a name="line.137"></a>
-<span class="sourceLineNo">138</span>    this.rpcServices = rpcServices;<a name="line.138"></a>
-<span class="sourceLineNo">139</span>    this.annotatedQos = qosMap;<a name="line.139"></a>
-<span class="sourceLineNo">140</span>    if (methodMap.get("getRegion") == null) {<a name="line.140"></a>
-<span class="sourceLineNo">141</span>      methodMap.put("hasRegion", new HashMap&lt;Class&lt;? extends Message&gt;, Method&gt;());<a name="line.141"></a>
-<span class="sourceLineNo">142</span>      methodMap.put("getRegion", new HashMap&lt;Class&lt;? extends Message&gt;, Method&gt;());<a name="line.142"></a>
-<span class="sourceLineNo">143</span>    }<a name="line.143"></a>
-<span class="sourceLineNo">144</span>    for (Class&lt;? extends Message&gt; cls : knownArgumentClasses) {<a name="line.144"></a>
-<span class="sourceLineNo">145</span>      argumentToClassMap.put(cls.getName(), cls);<a name="line.145"></a>
-<span class="sourceLineNo">146</span>      try {<a name="line.146"></a>
-<span class="sourceLineNo">147</span>        methodMap.get("hasRegion").put(cls, cls.getDeclaredMethod("hasRegion"));<a name="line.147"></a>
-<span class="sourceLineNo">148</span>        methodMap.get("getRegion").put(cls, cls.getDeclaredMethod("getRegion"));<a name="line.148"></a>
-<span class="sourceLineNo">149</span>      } catch (Exception e) {<a name="line.149"></a>
-<span class="sourceLineNo">150</span>        throw new RuntimeException(e);<a name="line.150"></a>
-<span class="sourceLineNo">151</span>      }<a name="line.151"></a>
-<span class="sourceLineNo">152</span>    }<a name="line.152"></a>
-<span class="sourceLineNo">153</span><a name="line.153"></a>
-<span class="sourceLineNo">154</span>    Configuration conf = rpcServices.getConfiguration();<a name="line.154"></a>
-<span class="sourceLineNo">155</span>    scanVirtualTimeWeight = conf.getFloat(SCAN_VTIME_WEIGHT_CONF_KEY, 1.0f);<a name="line.155"></a>
-<span class="sourceLineNo">156</span>  }<a name="line.156"></a>
-<span class="sourceLineNo">157</span><a name="line.157"></a>
-<span class="sourceLineNo">158</span>  private String capitalize(final String s) {<a name="line.158"></a>
-<span class="sourceLineNo">159</span>    StringBuilder strBuilder = new StringBuilder(s);<a name="line.159"></a>
-<span class="sourceLineNo">160</span>    strBuilder.setCharAt(0, Character.toUpperCase(strBuilder.charAt(0)));<a name="line.160"></a>
-<span class="sourceLineNo">161</span>    return strBuilder.toString();<a name="line.161"></a>
-<span class="sourceLineNo">162</span>  }<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>   * Returns a 'priority' based on the request type.<a name="line.165"></a>
-<span class="sourceLineNo">166</span>   *<a name="line.166"></a>
-<span class="sourceLineNo">167</span>   * Currently the returned priority is used for queue selection.<a name="line.167"></a>
-<span class="sourceLineNo">168</span>   * See the SimpleRpcScheduler as example. It maintains a queue per 'priory type'<a name="line.168"></a>
-<span class="sourceLineNo">169</span>   * HIGH_QOS (meta requests), REPLICATION_QOS (replication requests),<a name="line.169"></a>
-<span class="sourceLineNo">170</span>   * NORMAL_QOS (user requests).<a name="line.170"></a>
-<span class="sourceLineNo">171</span>   */<a name="line.171"></a>
-<span class="sourceLineNo">172</span>  @Override<a name="line.172"></a>
-<span class="sourceLineNo">173</span>  public int getPriority(RequestHeader header, Message param, User user) {<a name="line.173"></a>
-<span class="sourceLineNo">174</span>    int priorityByAnnotation = getAnnotatedPriority(header);<a name="line.174"></a>
-<span class="sourceLineNo">175</span><a name="line.175"></a>
-<span class="sourceLineNo">176</span>    if (priorityByAnnotation &gt;= 0) {<a name="line.176"></a>
-<span class="sourceLineNo">177</span>      return priorityByAnnotation;<a name="line.177"></a>
-<span class="sourceLineNo">178</span>    }<a name="line.178"></a>
-<span class="sourceLineNo">179</span><a name="line.179"></a>
-<span class="sourceLineNo">180</span>    // all requests executed by super users have high QoS<a name="line.180"></a>
-<span class="sourceLineNo">181</span>    try {<a name="line.181"></a>
-<span class="sourceLineNo">182</span>      if (Superusers.isSuperUser(user)) {<a name="line.182"></a>
-<span class="sourceLineNo">183</span>        return HConstants.ADMIN_QOS;<a name="line.183"></a>
-<span class="sourceLineNo">184</span>      }<a name="line.184"></a>
-<span class="sourceLineNo">185</span>    } catch (IllegalStateException ex) {<a name="line.185"></a>
-<span class="sourceLineNo">186</span>      // Not good throwing an exception out of here, a runtime anyways.  Let the query go into the<a name="line.186"></a>
-<span class="sourceLineNo">187</span>      // server and have it throw the exception if still an issue.  Just mark it normal priority.<a name="line.187"></a>
-<span class="sourceLineNo">188</span>      if (LOG.isTraceEnabled()) LOG.trace("Marking normal priority after getting exception=" + ex);<a name="line.188"></a>
-<span class="sourceLineNo">189</span>      return HConstants.NORMAL_QOS;<a name="line.189"></a>
-<span class="sourceLineNo">190</span>    }<a name="line.190"></a>
-<span class="sourceLineNo">191</span><a name="line.191"></a>
-<span class="sourceLineNo">192</span>    return getBasePriority(header, param);<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>  /**<a name="line.195"></a>
-<span class="sourceLineNo">196</span>   * See if the method has an annotation.<a name="line.196"></a>
-<span class="sourceLineNo">197</span>   * @param header<a name="line.197"></a>
-<span class="sourceLineNo">198</span>   * @return Return the priority from the annotation. If there isn't<a name="line.198"></a>
-<span class="sourceLineNo">199</span>   * an annotation, this returns something below zero.<a name="line.199"></a>
+<span class="sourceLineNo">046</span>import org.apache.hadoop.hbase.security.User;<a name="line.46"></a>
+<span class="sourceLineNo">047</span><a name="line.47"></a>
+<span class="sourceLineNo">048</span>/**<a name="line.48"></a>
+<span class="sourceLineNo">049</span> * Reads special method annotations and table names to figure a priority for use by QoS facility in<a name="line.49"></a>
+<span class="sourceLineNo">050</span> * ipc; e.g: rpcs to hbase:meta get priority.<a name="line.50"></a>
+<span class="sourceLineNo">051</span> */<a name="line.51"></a>
+<span class="sourceLineNo">052</span>// TODO: Remove.  This is doing way too much work just to figure a priority.  Do as Elliott<a name="line.52"></a>
+<span class="sourceLineNo">053</span>// suggests and just have the client specify a priority.<a name="line.53"></a>
+<span class="sourceLineNo">054</span><a name="line.54"></a>
+<span class="sourceLineNo">055</span>//The logic for figuring out high priority RPCs is as follows:<a name="line.55"></a>
+<span class="sourceLineNo">056</span>//1. if the method is annotated with a QosPriority of QOS_HIGH,<a name="line.56"></a>
+<span class="sourceLineNo">057</span>//   that is honored<a name="line.57"></a>
+<span class="sourceLineNo">058</span>//2. parse out the protobuf message and see if the request is for meta<a name="line.58"></a>
+<span class="sourceLineNo">059</span>//   region, and if so, treat it as a high priority RPC<a name="line.59"></a>
+<span class="sourceLineNo">060</span>//Some optimizations for (2) are done here -<a name="line.60"></a>
+<span class="sourceLineNo">061</span>//Clients send the argument classname as part of making the RPC. The server<a name="line.61"></a>
+<span class="sourceLineNo">062</span>//decides whether to deserialize the proto argument message based on the<a name="line.62"></a>
+<span class="sourceLineNo">063</span>//pre-established set of argument classes (knownArgumentClasses below).<a name="line.63"></a>
+<span class="sourceLineNo">064</span>//This prevents the server from having to deserialize all proto argument<a name="line.64"></a>
+<span class="sourceLineNo">065</span>//messages prematurely.<a name="line.65"></a>
+<span class="sourceLineNo">066</span>//All the argument classes declare a 'getRegion' method that returns a<a name="line.66"></a>
+<span class="sourceLineNo">067</span>//RegionSpecifier object. Methods can be invoked on the returned object<a name="line.67"></a>
+<span class="sourceLineNo">068</span>//to figure out whether it is a meta region or not.<a name="line.68"></a>
+<span class="sourceLineNo">069</span>@InterfaceAudience.Private<a name="line.69"></a>
+<span class="sourceLineNo">070</span>public class AnnotationReadingPriorityFunction implements PriorityFunction {<a name="line.70"></a>
+<span class="sourceLineNo">071</span>  private static final Log LOG =<a name="line.71"></a>
+<span class="sourceLineNo">072</span>    LogFactory.getLog(AnnotationReadingPriorityFunction.class.getName());<a name="line.72"></a>
+<span class="sourceLineNo">073</span><a name="line.73"></a>
+<span class="sourceLineNo">074</span>  /** Used to control the scan delay, currently sqrt(numNextCall * weight) */<a name="line.74"></a>
+<span class="sourceLineNo">075</span>  public static final String SCAN_VTIME_WEIGHT_CONF_KEY = "hbase.ipc.server.scan.vtime.weight";<a name="line.75"></a>
+<span class="sourceLineNo">076</span><a name="line.76"></a>
+<span class="sourceLineNo">077</span>  protected final Map&lt;String, Integer&gt; annotatedQos;<a name="line.77"></a>
+<span class="sourceLineNo">078</span>  //We need to mock the regionserver instance for some unit tests (set via<a name="line.78"></a>
+<span class="sourceLineNo">079</span>  //setRegionServer method.<a name="line.79"></a>
+<span class="sourceLineNo">080</span>  private RSRpcServices rpcServices;<a name="line.80"></a>
+<span class="sourceLineNo">081</span>  @SuppressWarnings("unchecked")<a name="line.81"></a>
+<span class="sourceLineNo">082</span>  private final Class&lt;? extends Message&gt;[] knownArgumentClasses = new Class[]{<a name="line.82"></a>
+<span class="sourceLineNo">083</span>      GetRegionInfoRequest.class,<a name="line.83"></a>
+<span class="sourceLineNo">084</span>      GetStoreFileRequest.class,<a name="line.84"></a>
+<span class="sourceLineNo">085</span>      CloseRegionRequest.class,<a name="line.85"></a>
+<span class="sourceLineNo">086</span>      FlushRegionRequest.class,<a name="line.86"></a>
+<span class="sourceLineNo">087</span>      SplitRegionRequest.class,<a name="line.87"></a>
+<span class="sourceLineNo">088</span>      CompactRegionRequest.class,<a name="line.88"></a>
+<span class="sourceLineNo">089</span>      GetRequest.class,<a name="line.89"></a>
+<span class="sourceLineNo">090</span>      MutateRequest.class,<a name="line.90"></a>
+<span class="sourceLineNo">091</span>      ScanRequest.class<a name="line.91"></a>
+<span class="sourceLineNo">092</span>  };<a name="line.92"></a>
+<span class="sourceLineNo">093</span><a name="line.93"></a>
+<span class="sourceLineNo">094</span>  // Some caches for helping performance<a name="line.94"></a>
+<span class="sourceLineNo">095</span>  private final Map&lt;String, Class&lt;? extends Message&gt;&gt; argumentToClassMap =<a name="line.95"></a>
+<span class="sourceLineNo">096</span>    new HashMap&lt;String, Class&lt;? extends Message&gt;&gt;();<a name="line.96"></a>
+<span class="sourceLineNo">097</span>  private final Map&lt;String, Map&lt;Class&lt;? extends Message&gt;, Method&gt;&gt; methodMap =<a name="line.97"></a>
+<span class="sourceLineNo">098</span>    new HashMap&lt;String, Map&lt;Class&lt;? extends Message&gt;, Method&gt;&gt;();<a name="line.98"></a>
+<span class="sourceLineNo">099</span><a name="line.99"></a>
+<span class="sourceLineNo">100</span>  private final float scanVirtualTimeWeight;<a name="line.100"></a>
+<span class="sourceLineNo">101</span><a name="line.101"></a>
+<span class="sourceLineNo">102</span>  /**<a name="line.102"></a>
+<span class="sourceLineNo">103</span>   * Calls {@link #AnnotationReadingPriorityFunction(RSRpcServices, Class)} using the result of<a name="line.103"></a>
+<span class="sourceLineNo">104</span>   * {@code rpcServices#getClass()}<a name="line.104"></a>
+<span class="sourceLineNo">105</span>   *<a name="line.105"></a>
+<span class="sourceLineNo">106</span>   * @param rpcServices<a name="line.106"></a>
+<span class="sourceLineNo">107</span>   *          The RPC server implementation<a name="line.107"></a>
+<span class="sourceLineNo">108</span>   */<a name="line.108"></a>
+<span class="sourceLineNo">109</span>  public AnnotationReadingPriorityFunction(final RSRpcServices rpcServices) {<a name="line.109"></a>
+<span class="sourceLineNo">110</span>    this(rpcServices, rpcServices.getClass());<a name="line.110"></a>
+<span class="sourceLineNo">111</span>  }<a name="line.111"></a>
+<span class="sourceLineNo">112</span><a name="line.112"></a>
+<span class="sourceLineNo">113</span>  /**<a name="line.113"></a>
+<span class="sourceLineNo">114</span>   * Constructs the priority function given the RPC server implementation and the annotations on the<a name="line.114"></a>
+<span class="sourceLineNo">115</span>   * methods in the provided {@code clz}.<a name="line.115"></a>
+<span class="sourceLineNo">116</span>   *<a name="line.116"></a>
+<span class="sourceLineNo">117</span>   * @param rpcServices<a name="line.117"></a>
+<span class="sourceLineNo">118</span>   *          The RPC server implementation<a name="line.118"></a>
+<span class="sourceLineNo">119</span>   * @param clz<a name="line.119"></a>
+<span class="sourceLineNo">120</span>   *          The concrete RPC server implementation's class<a name="line.120"></a>
+<span class="sourceLineNo">121</span>   */<a name="line.121"></a>
+<span class="sourceLineNo">122</span>  public AnnotationReadingPriorityFunction(final RSRpcServices rpcServices,<a name="line.122"></a>
+<span class="sourceLineNo">123</span>      Class&lt;? extends RSRpcServices&gt; clz) {<a name="line.123"></a>
+<span class="sourceLineNo">124</span>    Map&lt;String,Integer&gt; qosMap = new HashMap&lt;String,Integer&gt;();<a name="line.124"></a>
+<span class="sourceLineNo">125</span>    for (Method m : clz.getMethods()) {<a name="line.125"></a>
+<span class="sourceLineNo">126</span>      QosPriority p = m.getAnnotation(QosPriority.class);<a name="line.126"></a>
+<span class="sourceLineNo">127</span>      if (p != null) {<a name="line.127"></a>
+<span class="sourceLineNo">128</span>        // Since we protobuf'd, and then subsequently, when we went with pb style, method names<a name="line.128"></a>
+<span class="sourceLineNo">129</span>        // are capitalized.  This meant that this brittle compare of method names gotten by<a name="line.129"></a>
+<span class="sourceLineNo">130</span>        // reflection no longer matched the method names coming in over pb.  TODO: Get rid of this<a name="line.130"></a>
+<span class="sourceLineNo">131</span>        // check.  For now, workaround is to capitalize the names we got from reflection so they<a name="line.131"></a>
+<span class="sourceLineNo">132</span>        // have chance of matching the pb ones.<a name="line.132"></a>
+<span class="sourceLineNo">133</span>        String capitalizedMethodName = capitalize(m.getName());<a name="line.133"></a>
+<span class="sourceLineNo">134</span>        qosMap.put(capitalizedMethodName, p.priority());<a name="line.134"></a>
+<span class="sourceLineNo">135</span>      }<a name="line.135"></a>
+<span class="sourceLineNo">136</span>    }<a name="line.136"></a>
+<span class="sourceLineNo">137</span>    this.rpcServices = rpcServices;<a name="line.137"></a>
+<span class="sourceLineNo">138</span>    this.annotatedQos = qosMap;<a name="line.138"></a>
+<span class="sourceLineNo">139</span>    if (methodMap.get("getRegion") == null) {<a name="line.139"></a>
+<span class="sourceLineNo">140</span>      methodMap.put("hasRegion", new HashMap&lt;Class&lt;? extends Message&gt;, Method&gt;());<a name="line.140"></a>
+<span class="sourceLineNo">141</span>      methodMap.put("getRegion", new HashMap&lt;Class&lt;? extends Message&gt;, Method&gt;());<a name="line.141"></a>
+<span class="sourceLineNo">142</span>    }<a name="line.142"></a>
+<span class="sourceLineNo">143</span>    for (Class&lt;? extends Message&gt; cls : knownArgumentClasses) {<a name="line.143"></a>
+<span class="sourceLineNo">144</span>      argumentToClassMap.put(cls.getName(), cls);<a name="line.144"></a>
+<span class="sourceLineNo">145</span>      try {<a name="line.145"></a>
+<span class="sourceLineNo">146</span>        methodMap.get("hasRegion").put(cls, cls.getDeclaredMethod("hasRegion"));<a name="line.146"></a>
+<span class="sourceLineNo">147</span>        methodMap.get("getRegion").put(cls, cls.getDeclaredMethod("getRegion"));<a name="line.147"></a>
+<span class="sourceLineNo">148</span>      } catch (Exception e) {<a name="line.148"></a>
+<span class="sourceLineNo">149</span>        throw new RuntimeException(e);<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><a name="line.152"></a>
+<span class="sourceLineNo">153</span>    Configuration conf = rpcServices.getConfiguration();<a name="line.153"></a>
+<span class="sourceLineNo">154</span>    scanVirtualTimeWeight = conf.getFloat(SCAN_VTIME_WEIGHT_CONF_KEY, 1.0f);<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>  private String capitalize(final String s) {<a name="line.157"></a>
+<span class="sourceLineNo">158</span>    StringBuilder strBuilder = new StringBuilder(s);<a name="line.158"></a>
+<span class="sourceLineNo">159</span>    strBuilder.setCharAt(0, Character.toUpperCase(strBuilder.charAt(0)));<a name="line.159"></a>
+<span class="sourceLineNo">160</span>    return strBuilder.toString();<a name="line.160"></a>
+<span class="sourceLineNo">161</span>  }<a name="line.161"></a>
+<span class="sourceLineNo">162</span><a name="line.162"></a>
+<span class="sourceLineNo">163</span>  /**<a name="line.163"></a>
+<span class="sourceLineNo">164</span>   * Returns a 'priority' based on the request type.<a name="line.164"></a>
+<span class="sourceLineNo">165</span>   *<a name="line.165"></a>
+<span class="sourceLineNo">166</span>   * Currently the returned priority is used for queue selection.<a name="line.166"></a>
+<span class="sourceLineNo">167</span>   * See the SimpleRpcScheduler as example. It maintains a queue per 'priory type'<a name="line.167"></a>
+<span class="sourceLineNo">168</span>   * HIGH_QOS (meta requests), REPLICATION_QOS (replication requests),<a name="line.168"></a>
+<span class="sourceLineNo">169</span>   * NORMAL_QOS (user requests).<a name="line.169"></a>
+<span class="sourceLineNo">170</span>   */<a name="line.170"></a>
+<span class="sourceLineNo">171</span>  @Override<a name="line.171"></a>
+<span class="sourceLineNo">172</span>  public int getPriority(RequestHeader header, Message param, User user) {<a name="line.172"></a>
+<span class="sourceLineNo">173</span>    int priorityByAnnotation = getAnnotatedPriority(header);<a name="line.173"></a>
+<span class="sourceLineNo">174</span><a name="line.174"></a>
+<span class="sourceLineNo">175</span>    if (priorityByAnnotation &gt;= 0) {<a name="line.175"></a>
+<span class="sourceLineNo">176</span>      return priorityByAnnotation;<a name="line.176"></a>
+<span class="sourceLineNo">177</span>    }<a name="line.177"></a>
+<span class="sourceLineNo">178</span>    return getBasePriority(header, param);<a name="line.178"></a>
+<span class="sourceLineNo">179</span>  }<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>   * See if the method has an annotation.<a name="line.182"></a>
+<span class="sourceLineNo">183</span>   * @param header<a name="line.183"></a>
+<span class="sourceLineNo">184</span>   * @return Return the priority from the annotation. If there isn't<a name="line.184"></a>
+<span class="sourceLineNo">185</span>   * an annotation, this returns something below zero.<a name="line.185"></a>
+<span class="sourceLineNo">186</span>   */<a name="line.186"></a>
+<span class="sourceLineNo">187</span>  protected int getAnnotatedPriority(RequestHeader header) {<a name="line.187"></a>
+<span class="sourceLineNo">188</span>    String methodName = header.getMethodName();<a name="line.188"></a>
+<span class="sourceLineNo">189</span>    Integer priorityByAnnotation = annotatedQos.get(methodName);<a name="line.189"></a>
+<span class="sourceLineNo">190</span>    if (priorityByAnnotation != null) {<a name="line.190"></a>
+<span class="sourceLineNo">191</span>      return priorityByAnnotation;<a name="line.191"></a>
+<span class="sourceLineNo">192</span>    }<a name="line.192"></a>
+<span class="sourceLineNo">193</span>    return -1;<a name="line.193"></a>
+<span class="sourceLineNo">194</span>  }<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>   * Get the priority for a given request from the header and the param<a name="line.197"></a>
+<span class="sourceLineNo">198</span>   * This doesn't consider which user is sending the request at all.<a name="line.198"></a>
+<span class="sourceLineNo">199</span>   * This doesn't consider annotations<a name="line.199"></a>
 <span class="sourceLineNo">200</span>   */<a name="line.200"></a>
-<span class="sourceLineNo">201</span>  protected int getAnnotatedPriority(RequestHeader header) {<a name="line.201"></a>
-<span class="sourceLineNo">202</span>    String methodName = header.getMethodName();<a name="line.202"></a>
-<span class="sourceLineNo">203</span>    Integer priorityByAnnotation = annotatedQos.get(methodName);<a name="line.203"></a>
-<span class="sourceLineNo">204</span>    if (priorityByAnnotation != null) {<a name="line.204"></a>
-<span class="sourceLineNo">205</span>      return priorityByAnnotation;<a name="line.205"></a>
-<span class="sourceLineNo">206</span>    }<a name="line.206"></a>
-<span class="sourceLineNo">207</span>    return -1;<a name="line.207"></a>
-<span class="sourceLineNo">208</span>  }<a name="line.208"></a>
-<span class="sourceLineNo">209</span><a name="line.209"></a>
-<span class="sourceLineNo">210</span>  /**<a name="line.210"></a>
-<span class="sourceLineNo">211</span>   * Get the priority for a given request from the header and the param<a name="line.211"></a>
-<span class="sourceLineNo">212</span>   * This doesn't consider which user is sending the request at all.<a name="line.212"></a>
-<span class="sourceLineNo">213</span>   * This doesn't consider annotations<a name="line.213"></a>
-<span class="sourceLineNo">214</span>   */<a name="line.214"></a>
-<span class="sourceLineNo">215</span>  protected int getBasePriority(RequestHeader header, Message param) {<a name="line.215"></a>
-<span class="sourceLineNo">216</span>    if (param == null) {<a name="line.216"></a>
-<span class="sourceLineNo">217</span>      return HConstants.NORMAL_QOS;<a name="line.217"></a>
-<span class="sourceLineNo">218</span>    }<a name="line.218"></a>
-<span class="sourceLineNo">219</span><a name="line.219"></a>
-<span class="sourceLineNo">220</span>    // Trust the client-set priorities if set<a name="line.220"></a>
-<span class="sourceLineNo">221</span>    if (header.hasPriority()) {<a name="line.221"></a>
-<span class="sourceLineNo">222</span>      return header.getPriority();<a name="line.222"></a>
-<span class="sourceLineNo">223</span>    }<a name="line.223"></a>
-<span class="sourceLineNo">224</span><a name="line.224"></a>
-<span class="sourceLineNo">225</span>    String cls = param.getClass().getName();<a name="line.225"></a>
-<span class="sourceLineNo">226</span>    Class&lt;? extends Message&gt; rpcArgClass = argumentToClassMap.get(cls);<a name="line.226"></a>
-<span class="sourceLineNo">227</span>    RegionSpecifier regionSpecifier = null;<a name="line.227"></a>
-<span class="sourceLineNo">228</span>    //check whether the request has reference to meta region or now.<a name="line.228"></a>
-<span class="sourceLineNo">229</span>    try {<a name="line.229"></a>
-<span class="sourceLineNo">230</span>      // Check if the param has a region specifier; the pb methods are hasRegion and getRegion if<a name="line.230"></a>
-<span class="sourceLineNo">231</span>      // hasRegion returns true.  Not all listed methods have region specifier each time.  For<a name="line.231"></a>
-<span class="sourceLineNo">232</span>      // example, the ScanRequest has it on setup but thereafter relies on the scannerid rather than<a name="line.232"></a>
-<span class="sourceLineNo">233</span>      // send the region over every time.<a name="line.233"></a>
-<span class="sourceLineNo">234</span>      Method hasRegion = methodMap.get("hasRegion").get(rpcArgClass);<a name="line.234"></a>
-<span class="sourceLineNo">235</span>      if (hasRegion != null &amp;&amp; (Boolean)hasRegion.invoke(param, (Object[])null)) {<a name="line.235"></a>
-<span class="sourceLineNo">236</span>        Method getRegion = methodMap.get("getRegion").get(rpcArgClass);<a name="line.236"></a>
-<span class="sourceLineNo">237</span>        regionSpecifier = (RegionSpecifier)getRegion.invoke(param, (Object[])null);<a name="line.237"></a>
-<span class="sourceLineNo">238</span>        Region region = rpcServices.getRegion(regionSpecifier);<a name="line.238"></a>
-<span class="sourceLineNo">239</span>        if (region.getRegionInfo().isSystemTable()) {<a name="line.239"></a>
-<span class="sourceLineNo">240</span>          if (LOG.isTraceEnabled()) {<a name="line.240"></a>
-<span class="sourceLineNo">241</span>            LOG.trace("High priority because region=" +<a name="line.241"></a>
-<span class="sourceLineNo">242</span>              region.getRegionInfo().getRegionNameAsString());<a name="line.242"></a>
-<span class="sourceLineNo">243</span>          }<a name="line.243"></a>
-<span class="sourceLineNo">244</span>          return HConstants.SYSTEMTABLE_QOS;<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>    } catch (Exception ex) {<a name="line.247"></a>
-<span class="sourceLineNo">248</span>      // Not good throwing an exception out of here, a runtime anyways.  Let the query go into the<a name="line.248"></a>
-<span class="sourceLineNo">249</span>      // server and have it throw the exception if still an issue.  Just mark it normal priority.<a name="line.249"></a>
-<span class="sourceLineNo">250</span>      if (LOG.isTraceEnabled()) LOG.trace("Marking normal priority after getting exception=" + ex);<a name="line.250"></a>
-<span class="sourceLineNo">251</span>      return HConstants.NORMAL_QOS;<a name="line.251"></a>
-<span class="sourceLineNo">252</span>    }<a name="line.252"></a>
-<span class="sourceLineNo">253</span><a name="line.253"></a>
-<span class="sourceLineNo">254</span>    if (param instanceof ScanRequest) { // scanner methods...<a name="line.254"></a>
-<span class="sourceLineNo">255</span>      ScanRequest request = (ScanRequest)param;<a name="line.255"></a>
-<span class="sourceLineNo">256</span>      if (!request.hasScannerId()) {<a name="line.256"></a>
-<span class="sourceLineNo">257</span>        return HConstants.NORMAL_QOS;<a name="line.257"></a>
-<span class="sourceLineNo">258</span>      }<a name="line.258"></a>
-<span class="sourceLineNo">259</span>      RegionScanner scanner = rpcServices.getScanner(request.getScannerId());<a name="line.259"></a>
-<span class="sourceLineNo">260</span>      if (scanner != null &amp;&amp; scanner.getRegionInfo().isSystemTable()) {<a name="line.260"></a>
-<span class="sourceLineNo">261</span>        if (LOG.isTraceEnabled()) {<a name="line.261"></a>
-<span class="sourceLineNo">262</span>          // Scanner requests are small in size so TextFormat version should not overwhelm log.<a name="line.262"></a>
-<span class="sourceLineNo">263</span>          LOG.trace("High priority scanner request " + TextFormat.shortDebugString(request));<a name="line.263"></a>
-<span class="sourceLineNo">264</span>        }<a name="line.264"></a>
-<span class="sourceLineNo">265</span>        return HConstants.SYSTEMTABLE_QOS;<a name="line.265"></a>
-<span class="sourceLineNo">266</span>      }<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>    return HConstants.NORMAL_QOS;<a name="line.269"></a>
-<span class="sourceLineNo">270</span>  }<a name="line.270"></a>
-<span class="sourceLineNo">271</span><a name="line.271"></a>
-<span class="sourceLineNo">272</span>  /**<a name="line.272"></a>
-<span class="sourceLineNo">273</span>   * Based on the request content, returns the deadline of the request.<a name="line.273"></a>
-<span class="sourceLineNo">274</span>   *<a name="line.274"></a>
-<span class="sourceLineNo">275</span>   * @param header<a name="line.275"></a>
-<span class="sourceLineNo">276</span>   * @param param<a name="line.276"></a>
-<span class="sourceLineNo">277</span>   * @return Deadline of this request. 0 now, otherwise msec of 'delay'<a name="line.277"></a>
-<span class="sourceLineNo">278</span>   */<a name="line.278"></a>
-<span class="sourceLineNo">279</span>  @Override<a name="line.279"></a>
-<span class="sourceLineNo">280</span>  public long getDeadline(RequestHeader header, Message param) {<a name="line.280"></a>
-<span class="sourceLineNo">281</span>    if (param instanceof ScanRequest) {<a name="line.281"></a>
-<span class="sourceLineNo">282</span>      ScanRequest request = (ScanRequest)param;<a name="line.282"></a>
-<span class="sourceLineNo">283</span>      if (!request.hasScannerId()) {<a name="line.283"></a>
-<span class="sourceLineNo">284</span>        return 0;<a name="line.284"></a>
-<span class="sourceLineNo">285</span>      }<a name="line.285"></a>
-<span class="sourceLineNo">286</span><a name="line.286"></a>
-<span class="sourceLineNo">287</span>      // get the 'virtual time' of the scanner, and applies sqrt() to get a<a name="line.287"></a>
-<span class="sourceLineNo">288</span>      // nice curve for the delay. More a scanner is used the less priority it gets.<a name="line.288"></a>
-<span class="sourceLineNo">289</span>      // The weight is used to have more control on the delay.<a name="line.289"></a>
-<span class="sourceLineNo">290</span>      long vtime = rpcServices.getScannerVirtualTime(request.getScannerId());<a name="line.290"></a>
-<span class="sourceLineNo">291</span>      return Math.round(Math.sqrt(vtime * scanVirtualTimeWeight));<a name="line.291"></a>
-<span class="sourceLineNo">292</span>    }<a name="line.292"></a>
-<span class="sourceLineNo">293</span>    return 0;<a name="line.293"></a>
-<span class="sourceLineNo">294</span>  }<a name="line.294"></a>
-<span class="sourceLineNo">295</span><a name="line.295"></a>
-<span class="sourceLineNo">296</span>  @VisibleForTesting<a name="line.296"></a>
-<span class="sourceLineNo">297</span>  void setRegionServer(final HRegionServer hrs) {<a name="line.297"></a>
-<span class="sourceLineNo">298</span>    this.rpcServices = hrs.getRSRpcServices();<a name="line.298"></a>
-<span class="sourceLineNo">299</span>  }<a name="line.299"></a>
-<span class="sourceLineNo">300</span>}<a name="line.300"></a>
+<span class="sourceLineNo">201</span>  protected int getBasePriority(RequestHeader header, Message param) {<a name="line.201"></a>
+<span class="sourceLineNo">202</span>    if (param == null) {<a name="line.202"></a>
+<span class="sourceLineNo">203</span>      return HConstants.NORMAL_QOS;<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>    // Trust the client-set priorities if set<a name="line.206"></a>
+<span class="sourceLineNo">207</span>    if (header.hasPriority()) {<a name="line.207"></a>
+<span class="sourceLineNo">208</span>      return header.getPriority();<a name="line.208"></a>
+<span class="sourceLineNo">209</span>    }<a name="line.209"></a>
+<span class="sourceLineNo">210</span><a name="line.210"></a>
+<span class="sourceLineNo">211</span>    String cls = param.getClass().getName();<a name="line.211"></a>
+<span class="sourceLineNo">212</span>    Class&lt;? extends Message&gt; rpcArgClass = argumentToClassMap.get(cls);<a name="line.212"></a>
+<span class="sourceLineNo">213</span>    RegionSpecifier regionSpecifier = null;<a name="line.213"></a>
+<span class="sourceLineNo">214</span>    //check whether the request has reference to meta region or now.<a name="line.214"></a>
+<span class="sourceLineNo">215</span>    try {<a name="line.215"></a>
+<span class="sourceLineNo">216</span>      // Check if the param has a region specifier; the pb methods are hasRegion and getRegion if<a name="line.216"></a>
+<span class="sourceLineNo">217</span>      // hasRegion returns true.  Not all listed methods have region specifier each time.  For<a name="line.217"></a>
+<span class="sourceLineNo">218</span>      // example, the ScanRequest has it on setup but thereafter relies on the scannerid rather than<a name="line.218"></a>
+<span class="sourceLineNo">219</span>      // send the region over every time.<a name="line.219"></a>
+<span class="sourceLineNo">220</span>      Method hasRegion = methodMap.get("hasRegion").get(rpcArgClass);<a name="line.220"></a>
+<span class="sourceLineNo">221</span>      if (hasRegion != null &amp;&amp; (Boolean)hasRegion.invoke(param, (Object[])null)) {<a name="line.221"></a>
+<span class="sourceLineNo">222</span>        Method getRegion = methodMap.get("getRegion").get(rpcArgClass);<a name="line.222"></a>
+<span class="sourceLineNo">223</span>        regionSpecifier = (RegionSpecifier)getRegion.invoke(param, (Object[])null);<a name="line.223"></a>
+<span class="sourceLineNo">224</span>        Region region = rpcServices.getRegion(regionSpecifier);<a name="line.224"></a>
+<span class="sourceLineNo">225</span>        if (region.getRegionInfo().isSystemTable()) {<a name="line.225"></a>
+<span class="sourceLineNo">226</span>          if (LOG.isTraceEnabled()) {<a name="line.226"></a>
+<span class="sourceLineNo">227</span>            LOG.trace("High priority because region=" +<a name="line.227"></a>
+<span class="sourceLineNo">228</span>              region.getRegionInfo().getRegionNameAsString());<a name="line.228"></a>
+<span class="sourceLineNo">229</span>          }<a name="line.229"></a>
+<span class="sourceLineNo">230</span>          return HConstants.SYSTEMTABLE_QOS;<a name="line.230"></a>
+<span class="sourceLineNo">231</span>        }<a name="line.231"></a>
+<span class="sourceLineNo">232</span>      }<a name="line.232"></a>
+<span class="sourceLineNo">233</span>    } catch (Exception ex) {<a name="line.233"></a>
+<span class="sourceLineNo">234</span>      // Not good throwing an exception out of here, a runtime anyways.  Let the query go into the<a name="line.234"></a>
+<span class="sourceLineNo">235</span>      // server and have it throw the exception if still an issue.  Just mark it normal priority.<a name="line.235"></a>
+<span class="sourceLineNo">236</span>      if (LOG.isTraceEnabled()) LOG.trace("Marking normal priority after getting exception=" + ex);<a name="line.236"></a>
+<span class="sourceLineNo">237</span>      return HConstants.NORMAL_QOS;<a name="line.237"></a>
+<span class="sourceLineNo">238</span>    }<a name="line.238"></a>
+<span class="sourceLineNo">239</span><a name="line.239"></a>
+<span class="sourceLineNo">240</span>    if (param instanceof ScanRequest) { // scanner methods...<a name="line.240"></a>
+<span class="sourceLineNo">241</span>      ScanRequest request = (ScanRequest)param;<a name="line.241"></a>
+<span class="sourceLineNo">242</span>      if (!request.hasScannerId()) {<a name="line.242"></a>
+<span class="sourceLineNo">243</span>        return HConstants.NORMAL_QOS;<a name="line.243"></a>
+<span class="sourceLineNo">244</span>      }<a name="line.244"></a>
+<span class="sourceLineNo">245</span>      RegionScanner scanner = rpcServices.getScanner(request.getScannerId());<a name="line.245"></a>
+<span class="sourceLineNo">246</span>      if (scanner != null &amp;&amp; scanner.getRegionInfo().isSystemTable()) {<a name="line.246"></a>
+<span class="sourceLineNo">247</span>        if (LOG.isTraceEnabled()) {<a name="line.247"></a>
+<span class="sourceLineNo">248</span>          // Scanner requests are small in size so TextFormat version should not overwhelm log.<a name="line.248"></a>
+<span class="sourceLineNo">249</span>          LOG.trace("High priority scanner request " + TextFormat.shortDebugString(request));<a name="line.249"></a>
+<span class="sourceLineNo">250</span>        }<a name="line.250"></a>
+<span class="sourceLineNo">251</span>        return HConstants.SYSTEMTABLE_QOS;<a name="line.251"></a>
+<span class="sourceLineNo">252</span>      }<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>    return HConstants.NORMAL_QOS;<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>  /**<a name="line.258"></a>
+<span class="sourceLineNo">259</span>   * Based on the request content, returns the deadline of the request.<a name="line.259"></a>
+<span class="sourceLineNo">260</span>   *<a name="line.260"></a>
+<span class="sourceLineNo">261</span>   * @param header<a name="line.261"></a>
+<span class="sourceLineNo">262</span>   * @param param<a name="line.262"></a>
+<span class="sourceLineNo">263</span>   * @return Deadline of this request. 0 now, otherwise msec of 'delay'<a name="line.263"></a>
+<span class="sourceLineNo">264</span>   */<a name="line.264"></a>
+<span class="sourceLineNo">265</span>  @Override<a name="line.265"></a>
+<span class="sourceLineNo">266</span>  public long getDeadline(RequestHeader header, Message param) {<a name="line.266"></a>
+<span class="sourceLineNo">267</span>    if (param instanceof ScanRequest) {<a name="line.267"></a>
+<span class="sourceLineNo">268</span>      ScanRequest request = (ScanRequest)param;<a name="line.268"></a>
+<span class="sourceLineNo">269</span>      if (!request.hasScannerId()) {<a name="line.269"></a>
+<span class="sourceLineNo">270</span>        return 0;<a name="line.270"></a>
+<span class="sourceLineNo">271</span>      }<a name="line.271"></a>
+<span class="sourceLineNo">272</span><a name="line.272"></a>
+<span class="sourceLineNo">273</span>      // get the 'virtual time' of the scanner, and applies sqrt() to get a<a name="line.273"></a>
+<span class="sourceLineNo">274</span>      // nice curve for the delay. More a scanner is used the less priority it gets.<a name="line.274"></a>
+<span class="sourceLineNo">275</span>      // The weight is used to have more control on the delay.<a name="line.275"></a>
+<span class="sourceLineNo">276</span>      long vtime = rpcServices.getScannerVirtualTime(request.getScannerId());<a name="line.276"></a>
+<span class="sourceLineNo">277</span>      return Math.round(Math.sqrt(vtime * scanVirtualTimeWeight));<a name="line.277"></a>
+<span class="sourceLineNo">278</span>    }<a name="line.278"></a>
+<span class="sourceLineNo">279</span>    return 0;<a name="line.279"></a>
+<span class="sourceLineNo">280</span>  }<a name="line.280"></a>
+<span class="sourceLineNo">281</span><a name="line.281"></a>
+<span class="sourceLineNo">282</span>  @VisibleForTesting<a name="line.282"></a>
+<span class="sourceLineNo">283</span>  void setRegionServer(final HRegionServer hrs) {<a name="line.283"></a>
+<span class="sourceLineNo">284</span>    this.rpcServices = hrs.getRSRpcServices();<a name="line.284"></a>
+<span class="sourceLineNo">285</span>  }<a name="line.285"></a>
+<span class="sourceLineNo">286</span>}<a name="line.286"></a>
 
 
 

http://git-wip-us.apache.org/repos/asf/hbase-site/blob/4ce8323f/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/DefaultMemStore.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/DefaultMemStore.html b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/DefaultMemStore.html
index 5d3c7c4..4fad2a6 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/DefaultMemStore.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/DefaultMemStore.html
@@ -126,94 +126,80 @@
 <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>  /**<a name="line.120"></a>
-<span class="sourceLineNo">121</span>   * Remove n key from the memstore. Only cells that have the same key and the<a name="line.121"></a>
-<span class="sourceLineNo">122</span>   * same memstoreTS are removed.  It is ok to not update timeRangeTracker<a name="line.122"></a>
-<span class="sourceLineNo">123</span>   * in this call. It is possible that we can optimize this method by using<a name="line.123"></a>
-<span class="sourceLineNo">124</span>   * tailMap/iterator, but since this method is called rarely (only for<a name="line.124"></a>
-<span class="sourceLineNo">125</span>   * error recovery), we can leave those optimization for the future.<a name="line.125"></a>
-<span class="sourceLineNo">126</span>   * @param cell<a name="line.126"></a>
-<span class="sourceLineNo">127</span>   */<a name="line.127"></a>
-<span class="sourceLineNo">128</span>  @Override<a name="line.128"></a>
-<span class="sourceLineNo">129</span>  public void rollback(Cell cell) {<a name="line.129"></a>
-<span class="sourceLineNo">130</span>    rollbackInSnapshot(cell);<a name="line.130"></a>
-<span class="sourceLineNo">131</span>    rollbackInActive(cell);<a name="line.131"></a>
+<span class="sourceLineNo">121</span>   * @param cell Find the row that comes after this one.  If null, we return the<a name="line.121"></a>
+<span class="sourceLineNo">122</span>   * first.<a name="line.122"></a>
+<span class="sourceLineNo">123</span>   * @return Next row or null if none found.<a name="line.123"></a>
+<span class="sourceLineNo">124</span>   */<a name="line.124"></a>
+<span class="sourceLineNo">125</span>  Cell getNextRow(final Cell cell) {<a name="line.125"></a>
+<span class="sourceLineNo">126</span>    return getLowest(<a name="line.126"></a>
+<span class="sourceLineNo">127</span>        getNextRow(cell, getActive().getCellSet()),<a name="line.127"></a>
+<span class="sourceLineNo">128</span>        getNextRow(cell, getSnapshot().getCellSet()));<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>  @Override public void updateLowestUnflushedSequenceIdInWal(boolean onlyIfMoreRecent) {<a name="line.131"></a>
 <span class="sourceLineNo">132</span>  }<a name="line.132"></a>
 <span class="sourceLineNo">133</span><a name="line.133"></a>
 <span class="sourceLineNo">134</span>  /**<a name="line.134"></a>
-<span class="sourceLineNo">135</span>   * @param cell Find the row that comes after this one.  If null, we return the<a name="line.135"></a>
-<span class="sourceLineNo">136</span>   * first.<a name="line.136"></a>
-<span class="sourceLineNo">137</span>   * @return Next row or null if none found.<a name="line.137"></a>
-<span class="sourceLineNo">138</span>   */<a name="line.138"></a>
-<span class="sourceLineNo">139</span>  Cell getNextRow(final Cell cell) {<a name="line.139"></a>
-<span class="sourceLineNo">140</span>    return getLowest(<a name="line.140"></a>
-<span class="sourceLineNo">141</span>        getNextRow(cell, getActive().getCellSet()),<a name="line.141"></a>
-<span class="sourceLineNo">142</span>        getNextRow(cell, getSnapshot().getCellSet()));<a name="line.142"></a>
-<span class="sourceLineNo">143</span>  }<a name="line.143"></a>
-<span class="sourceLineNo">144</span><a name="line.144"></a>
-<span class="sourceLineNo">145</span>  @Override public void updateLowestUnflushedSequenceIdInWal(boolean onlyIfMoreRecent) {<a name="line.145"></a>
-<span class="sourceLineNo">146</span>  }<a name="line.146"></a>
-<span class="sourceLineNo">147</span><a name="line.147"></a>
-<span class="sourceLineNo">148</span>  /**<a name="line.148"></a>
-<span class="sourceLineNo">149</span>   * @return Total memory occupied by this MemStore.<a name="line.149"></a>
-<span class="sourceLineNo">150</span>   */<a name="line.150"></a>
+<span class="sourceLineNo">135</span>   * @return Total memory occupied by this MemStore.<a name="line.135"></a>
+<span class="sourceLineNo">136</span>   */<a name="line.136"></a>
+<span class="sourceLineNo">137</span>  @Override<a name="line.137"></a>
+<span class="sourceLineNo">138</span>  public long size() {<a name="line.138"></a>
+<span class="sourceLineNo">139</span>    return heapSize();<a name="line.139"></a>
+<span class="sourceLineNo">140</span>  }<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>   * Check whether anything need to be done based on the current active set size<a name="line.143"></a>
+<span class="sourceLineNo">144</span>   * Nothing need to be done for the DefaultMemStore<a name="line.144"></a>
+<span class="sourceLineNo">145</span>   */<a name="line.145"></a>
+<span class="sourceLineNo">146</span>  @Override<a name="line.146"></a>
+<span class="sourceLineNo">147</span>  protected void checkActiveSize() {<a name="line.147"></a>
+<span class="sourceLineNo">148</span>    return;<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>  @Override<a name="line.151"></a>
-<span class="sourceLineNo">152</span>  public long size() {<a name="line.152"></a>
-<span class="sourceLineNo">153</span>    return heapSize();<a name="line.153"></a>
-<span class="sourceLineNo">154</span>  }<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>   * Check whether anything need to be done based on the current active set size<a name="line.157"></a>
-<span class="sourceLineNo">158</span>   * Nothing need to be done for the DefaultMemStore<a name="line.158"></a>
-<span class="sourceLineNo">159</span>   */<a name="line.159"></a>
-<span class="sourceLineNo">160</span>  @Override<a name="line.160"></a>
-<span class="sourceLineNo">161</span>  protected void checkActiveSize() {<a name="line.161"></a>
-<span class="sourceLineNo">162</span>    return;<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>  @Override<a name="line.165"></a>
-<span class="sourceLineNo">166</span>  public void finalizeFlush() {<a name="line.166"></a>
-<span class="sourceLineNo">167</span>  }<a name="line.167"></a>
-<span class="sourceLineNo">168</span><a name="line.168"></a>
-<span class="sourceLineNo">169</span>  /**<a name="line.169"></a>
-<span class="sourceLineNo">170</span>   * Code to help figure if our approximation of object heap sizes is close<a name="line.170"></a>
-<span class="sourceLineNo">171</span>   * enough.  See hbase-900.  Fills memstores then waits so user can heap<a name="line.171"></a>
-<span class="sourceLineNo">172</span>   * dump and bring up resultant hprof in something like jprofiler which<a name="line.172"></a>
-<span class="sourceLineNo">173</span>   * allows you get 'deep size' on objects.<a name="line.173"></a>
-<span class="sourceLineNo">174</span>   * @param args main args<a name="line.174"></a>
-<span class="sourceLineNo">175</span>   */<a name="line.175"></a>
-<span class="sourceLineNo">176</span>  public static void main(String [] args) {<a name="line.176"></a>
-<span class="sourceLineNo">177</span>    RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean();<a name="line.177"></a>
-<span class="sourceLineNo">178</span>    LOG.info("vmName=" + runtime.getVmName() + ", vmVendor=" +<a name="line.178"></a>
-<span class="sourceLineNo">179</span>      runtime.getVmVendor() + ", vmVersion=" + runtime.getVmVersion());<a name="line.179"></a>
-<span class="sourceLineNo">180</span>    LOG.info("vmInputArguments=" + runtime.getInputArguments());<a name="line.180"></a>
-<span class="sourceLineNo">181</span>    DefaultMemStore memstore1 = new DefaultMemStore();<a name="line.181"></a>
-<span class="sourceLineNo">182</span>    // TODO: x32 vs x64<a name="line.182"></a>
-<span class="sourceLineNo">183</span>    long size = 0;<a name="line.183"></a>
-<span class="sourceLineNo">184</span>    final int count = 10000;<a name="line.184"></a>
-<span class="sourceLineNo">185</span>    byte [] fam = Bytes.toBytes("col");<a name="line.185"></a>
-<span class="sourceLineNo">186</span>    byte [] qf = Bytes.toBytes("umn");<a name="line.186"></a>
-<span class="sourceLineNo">187</span>    byte [] empty = new byte[0];<a name="line.187"></a>
-<span class="sourceLineNo">188</span>    for (int i = 0; i &lt; count; i++) {<a name="line.188"></a>
-<span class="sourceLineNo">189</span>      // Give each its own ts<a name="line.189"></a>
-<span class="sourceLineNo">190</span>      size += memstore1.add(new KeyValue(Bytes.toBytes(i), fam, qf, i, empty));<a name="line.190"></a>
-<span class="sourceLineNo">191</span>    }<a name="line.191"></a>
-<span class="sourceLineNo">192</span>    LOG.info("memstore1 estimated size=" + size);<a name="line.192"></a>
-<span class="sourceLineNo">193</span>    for (int i = 0; i &lt; count; i++) {<a name="line.193"></a>
-<span class="sourceLineNo">194</span>      size += memstore1.add(new KeyValue(Bytes.toBytes(i), fam, qf, i, empty));<a name="line.194"></a>
-<span class="sourceLineNo">195</span>    }<a name="line.195"></a>
-<span class="sourceLineNo">196</span>    LOG.info("memstore1 estimated size (2nd loading of same data)=" + size);<a name="line.196"></a>
-<span class="sourceLineNo">197</span>    // Make a variably sized memstore.<a name="line.197"></a>
-<span class="sourceLineNo">198</span>    DefaultMemStore memstore2 = new DefaultMemStore();<a name="line.198"></a>
-<span class="sourceLineNo">199</span>    for (int i = 0; i &lt; count; i++) {<a name="line.199"></a>
-<span class="sourceLineNo">200</span>      size += memstore2.add(new KeyValue(Bytes.toBytes(i), fam, qf, i, new byte[i]));<a name="line.200"></a>
-<span class="sourceLineNo">201</span>    }<a name="line.201"></a>
-<span class="sourceLineNo">202</span>    LOG.info("memstore2 estimated size=" + size);<a name="line.202"></a>
-<span class="sourceLineNo">203</span>    final int seconds = 30;<a name="line.203"></a>
-<span class="sourceLineNo">204</span>    LOG.info("Waiting " + seconds + " seconds while heap dump is taken");<a name="line.204"></a>
-<span class="sourceLineNo">205</span>    LOG.info("Exiting.");<a name="line.205"></a>
-<span class="sourceLineNo">206</span>  }<a name="line.206"></a>
-<span class="sourceLineNo">207</span><a name="line.207"></a>
-<span class="sourceLineNo">208</span>}<a name="line.208"></a>
+<span class="sourceLineNo">152</span>  public void finalizeFlush() {<a name="line.152"></a>
+<span class="sourceLineNo">153</span>  }<a name="line.153"></a>
+<span class="sourceLineNo">154</span><a name="line.154"></a>
+<span class="sourceLineNo">155</span>  /**<a name="line.155"></a>
+<span class="sourceLineNo">156</span>   * Code to help figure if our approximation of object heap sizes is close<a name="line.156"></a>
+<span class="sourceLineNo">157</span>   * enough.  See hbase-900.  Fills memstores then waits so user can heap<a name="line.157"></a>
+<span class="sourceLineNo">158</span>   * dump and bring up resultant hprof in something like jprofiler which<a name="line.158"></a>
+<span class="sourceLineNo">159</span>   * allows you get 'deep size' on objects.<a name="line.159"></a>
+<span class="sourceLineNo">160</span>   * @param args main args<a name="line.160"></a>
+<span class="sourceLineNo">161</span>   */<a name="line.161"></a>
+<span class="sourceLineNo">162</span>  public static void main(String [] args) {<a name="line.162"></a>
+<span class="sourceLineNo">163</span>    RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean();<a name="line.163"></a>
+<span class="sourceLineNo">164</span>    LOG.info("vmName=" + runtime.getVmName() + ", vmVendor=" +<a name="line.164"></a>
+<span class="sourceLineNo">165</span>      runtime.getVmVendor() + ", vmVersion=" + runtime.getVmVersion());<a name="line.165"></a>
+<span class="sourceLineNo">166</span>    LOG.info("vmInputArguments=" + runtime.getInputArguments());<a name="line.166"></a>
+<span class="sourceLineNo">167</span>    DefaultMemStore memstore1 = new DefaultMemStore();<a name="line.167"></a>
+<span class="sourceLineNo">168</span>    // TODO: x32 vs x64<a name="line.168"></a>
+<span class="sourceLineNo">169</span>    long size = 0;<a name="line.169"></a>
+<span class="sourceLineNo">170</span>    final int count = 10000;<a name="line.170"></a>
+<span class="sourceLineNo">171</span>    byte [] fam = Bytes.toBytes("col");<a name="line.171"></a>
+<span class="sourceLineNo">172</span>    byte [] qf = Bytes.toBytes("umn");<a name="line.172"></a>
+<span class="sourceLineNo">173</span>    byte [] empty = new byte[0];<a name="line.173"></a>
+<span class="sourceLineNo">174</span>    for (int i = 0; i &lt; count; i++) {<a name="line.174"></a>
+<span class="sourceLineNo">175</span>      // Give each its own ts<a name="line.175"></a>
+<span class="sourceLineNo">176</span>      size += memstore1.add(new KeyValue(Bytes.toBytes(i), fam, qf, i, empty));<a name="line.176"></a>
+<span class="sourceLineNo">177</span>    }<a name="line.177"></a>
+<span class="sourceLineNo">178</span>    LOG.info("memstore1 estimated size=" + size);<a name="line.178"></a>
+<span class="sourceLineNo">179</span>    for (int i = 0; i &lt; count; i++) {<a name="line.179"></a>
+<span class="sourceLineNo">180</span>      size += memstore1.add(new KeyValue(Bytes.toBytes(i), fam, qf, i, empty));<a name="line.180"></a>
+<span class="sourceLineNo">181</span>    }<a name="line.181"></a>
+<span class="sourceLineNo">182</span>    LOG.info("memstore1 estimated size (2nd loading of same data)=" + size);<a name="line.182"></a>
+<span class="sourceLineNo">183</span>    // Make a variably sized memstore.<a name="line.183"></a>
+<span class="sourceLineNo">184</span>    DefaultMemStore memstore2 = new DefaultMemStore();<a name="line.184"></a>
+<span class="sourceLineNo">185</span>    for (int i = 0; i &lt; count; i++) {<a name="line.185"></a>
+<span class="sourceLineNo">186</span>      size += memstore2.add(new KeyValue(Bytes.toBytes(i), fam, qf, i, new byte[i]));<a name="line.186"></a>
+<span class="sourceLineNo">187</span>    }<a name="line.187"></a>
+<span class="sourceLineNo">188</span>    LOG.info("memstore2 estimated size=" + size);<a name="line.188"></a>
+<span class="sourceLineNo">189</span>    final int seconds = 30;<a name="line.189"></a>
+<span class="sourceLineNo">190</span>    LOG.info("Waiting " + seconds + " seconds while heap dump is taken");<a name="line.190"></a>
+<span class="sourceLineNo">191</span>    LOG.info("Exiting.");<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>
 
 
 

http://git-wip-us.apache.org/repos/asf/hbase-site/blob/4ce8323f/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/ImmutableSegment.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/ImmutableSegment.html b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/ImmutableSegment.html
index 7157068..44be699 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/ImmutableSegment.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/ImmutableSegment.html
@@ -26,58 +26,32 @@
 <span class="sourceLineNo">018</span> */<a name="line.18"></a>
 <span class="sourceLineNo">019</span>package org.apache.hadoop.hbase.regionserver;<a name="line.19"></a>
 <span class="sourceLineNo">020</span><a name="line.20"></a>
-<span class="sourceLineNo">021</span>import org.apache.commons.lang.NotImplementedException;<a name="line.21"></a>
-<span class="sourceLineNo">022</span>import org.apache.hadoop.hbase.Cell;<a name="line.22"></a>
-<span class="sourceLineNo">023</span>import org.apache.hadoop.hbase.classification.InterfaceAudience;<a name="line.23"></a>
-<span class="sourceLineNo">024</span><a name="line.24"></a>
-<span class="sourceLineNo">025</span>/**<a name="line.25"></a>
-<span class="sourceLineNo">026</span> * ImmutableSegment is an abstract class that extends the API supported by a {@link Segment},<a name="line.26"></a>
-<span class="sourceLineNo">027</span> * and is not needed for a {@link MutableSegment}. Specifically, the method<a name="line.27"></a>
-<span class="sourceLineNo">028</span> * {@link ImmutableSegment#getKeyValueScanner()} builds a special scanner for the<a name="line.28"></a>
-<span class="sourceLineNo">029</span> * {@link MemStoreSnapshot} object.<a name="line.29"></a>
-<span class="sourceLineNo">030</span> * In addition, this class overrides methods that are not likely to be supported by an immutable<a name="line.30"></a>
-<span class="sourceLineNo">031</span> * segment, e.g. {@link Segment#rollback(Cell)} and {@link Segment#getCellSet()}, which<a name="line.31"></a>
-<span class="sourceLineNo">032</span> * can be very inefficient.<a name="line.32"></a>
-<span class="sourceLineNo">033</span> */<a name="line.33"></a>
-<span class="sourceLineNo">034</span>@InterfaceAudience.Private<a name="line.34"></a>
-<span class="sourceLineNo">035</span>public abstract class ImmutableSegment extends Segment {<a name="line.35"></a>
+<span class="sourceLineNo">021</span>import org.apache.hadoop.hbase.classification.InterfaceAudience;<a name="line.21"></a>
+<span class="sourceLineNo">022</span>import org.apache.hadoop.hbase.util.CollectionBackedScanner;<a name="line.22"></a>
+<span class="sourceLineNo">023</span><a name="line.23"></a>
+<span class="sourceLineNo">024</span>/**<a name="line.24"></a>
+<span class="sourceLineNo">025</span> * ImmutableSegment is an abstract class that extends the API supported by a {@link Segment},<a name="line.25"></a>
+<span class="sourceLineNo">026</span> * and is not needed for a {@link MutableSegment}. Specifically, the method<a name="line.26"></a>
+<span class="sourceLineNo">027</span> * {@link ImmutableSegment#getKeyValueScanner()} builds a special scanner for the<a name="line.27"></a>
+<span class="sourceLineNo">028</span> * {@link MemStoreSnapshot} object.<a name="line.28"></a>
+<span class="sourceLineNo">029</span> */<a name="line.29"></a>
+<span class="sourceLineNo">030</span>@InterfaceAudience.Private<a name="line.30"></a>
+<span class="sourceLineNo">031</span>public class ImmutableSegment extends Segment {<a name="line.31"></a>
+<span class="sourceLineNo">032</span><a name="line.32"></a>
+<span class="sourceLineNo">033</span>  protected ImmutableSegment(Segment segment) {<a name="line.33"></a>
+<span class="sourceLineNo">034</span>    super(segment);<a name="line.34"></a>
+<span class="sourceLineNo">035</span>  }<a name="line.35"></a>
 <span class="sourceLineNo">036</span><a name="line.36"></a>
-<span class="sourceLineNo">037</span>  public ImmutableSegment(Segment segment) {<a name="line.37"></a>
-<span class="sourceLineNo">038</span>    super(segment);<a name="line.38"></a>
-<span class="sourceLineNo">039</span>  }<a name="line.39"></a>
-<span class="sourceLineNo">040</span><a name="line.40"></a>
-<span class="sourceLineNo">041</span>  /**<a name="line.41"></a>
-<span class="sourceLineNo">042</span>   * Removes the given cell from this segment.<a name="line.42"></a>
-<span class="sourceLineNo">043</span>   * By default immutable store segment can not rollback<a name="line.43"></a>
-<span class="sourceLineNo">044</span>   * It may be invoked by tests in specific cases where it is known to be supported {@link<a name="line.44"></a>
-<span class="sourceLineNo">045</span>   * ImmutableSegmentAdapter}<a name="line.45"></a>
-<span class="sourceLineNo">046</span>   */<a name="line.46"></a>
-<span class="sourceLineNo">047</span>  @Override<a name="line.47"></a>
-<span class="sourceLineNo">048</span>  public long rollback(Cell cell) {<a name="line.48"></a>
-<span class="sourceLineNo">049</span>    return 0;<a name="line.49"></a>
-<span class="sourceLineNo">050</span>  }<a name="line.50"></a>
-<span class="sourceLineNo">051</span><a name="line.51"></a>
-<span class="sourceLineNo">052</span>  /**<a name="line.52"></a>
-<span class="sourceLineNo">053</span>   * Returns a set of all the cells in the segment.<a name="line.53"></a>
-<span class="sourceLineNo">054</span>   * The implementation of this method might be very inefficient for some immutable segments<a name="line.54"></a>
-<span class="sourceLineNo">055</span>   * that do not maintain a cell set. Therefore by default this method is not supported.<a name="line.55"></a>
-<span class="sourceLineNo">056</span>   * It may be invoked by tests in specific cases where it is known to be supported {@link<a name="line.56"></a>
-<span class="sourceLineNo">057</span>   * ImmutableSegmentAdapter}<a name="line.57"></a>
-<span class="sourceLineNo">058</span>   */<a name="line.58"></a>
-<span class="sourceLineNo">059</span>  @Override<a name="line.59"></a>
-<span class="sourceLineNo">060</span>  public CellSet getCellSet() {<a name="line.60"></a>
-<span class="sourceLineNo">061</span>    throw new NotImplementedException("Immutable Segment does not support this operation by " +<a name="line.61"></a>
-<span class="sourceLineNo">062</span>        "default");<a name="line.62"></a>
-<span class="sourceLineNo">063</span>  }<a name="line.63"></a>
-<span class="sourceLineNo">064</span><a name="line.64"></a>
-<span class="sourceLineNo">065</span>  /**<a name="line.65"></a>
-<span class="sourceLineNo">066</span>   * Builds a special scanner for the MemStoreSnapshot object that may be different than the<a name="line.66"></a>
-<span class="sourceLineNo">067</span>   * general segment scanner.<a name="line.67"></a>
-<span class="sourceLineNo">068</span>   * @return a special scanner for the MemStoreSnapshot object<a name="line.68"></a>
-<span class="sourceLineNo">069</span>   */<a name="line.69"></a>
-<span class="sourceLineNo">070</span>  public abstract KeyValueScanner getKeyValueScanner();<a name="line.70"></a>
-<span class="sourceLineNo">071</span><a name="line.71"></a>
-<span class="sourceLineNo">072</span>}<a name="line.72"></a>
+<span class="sourceLineNo">037</span>  /**<a name="line.37"></a>
+<span class="sourceLineNo">038</span>   * Builds a special scanner for the MemStoreSnapshot object that is different than the<a name="line.38"></a>
+<span class="sourceLineNo">039</span>   * general segment scanner.<a name="line.39"></a>
+<span class="sourceLineNo">040</span>   * @return a special scanner for the MemStoreSnapshot object<a name="line.40"></a>
+<span class="sourceLineNo">041</span>   */<a name="line.41"></a>
+<span class="sourceLineNo">042</span>  public KeyValueScanner getKeyValueScanner() {<a name="line.42"></a>
+<span class="sourceLineNo">043</span>    return new CollectionBackedScanner(getCellSet(), getComparator());<a name="line.43"></a>
+<span class="sourceLineNo">044</span>  }<a name="line.44"></a>
+<span class="sourceLineNo">045</span><a name="line.45"></a>
+<span class="sourceLineNo">046</span>}<a name="line.46"></a>
 
 
 

http://git-wip-us.apache.org/repos/asf/hbase-site/blob/4ce8323f/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/ImmutableSegmentAdapter.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/ImmutableSegmentAdapter.html b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/ImmutableSegmentAdapter.html
deleted file mode 100644
index cb291b7..0000000
--- a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/ImmutableSegmentAdapter.html
+++ /dev/null
@@ -1,179 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html lang="en">
-<head>
-<title>Source code</title>
-<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
-</head>
-<body>
-<div class="sourceContainer">
-<pre><span class="sourceLineNo">001</span>/**<a name="line.1"></a>
-<span class="sourceLineNo">002</span> *<a name="line.2"></a>
-<span class="sourceLineNo">003</span> * Licensed to the Apache Software Foundation (ASF) under one<a name="line.3"></a>
-<span class="sourceLineNo">004</span> * or more contributor license agreements.  See the NOTICE file<a name="line.4"></a>
-<span class="sourceLineNo">005</span> * distributed with this work for additional information<a name="line.5"></a>
-<span class="sourceLineNo">006</span> * regarding copyright ownership.  The ASF licenses this file<a name="line.6"></a>
-<span class="sourceLineNo">007</span> * to you under the Apache License, Version 2.0 (the<a name="line.7"></a>
-<span class="sourceLineNo">008</span> * "License"); you may not use this file except in compliance<a name="line.8"></a>
-<span class="sourceLineNo">009</span> * with the License.  You may obtain a copy of the License at<a name="line.9"></a>
-<span class="sourceLineNo">010</span> *<a name="line.10"></a>
-<span class="sourceLineNo">011</span> *     http://www.apache.org/licenses/LICENSE-2.0<a name="line.11"></a>
-<span class="sourceLineNo">012</span> *<a name="line.12"></a>
-<span class="sourceLineNo">013</span> * Unless required by applicable law or agreed to in writing, software<a name="line.13"></a>
-<span class="sourceLineNo">014</span> * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.14"></a>
-<span class="sourceLineNo">015</span> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.15"></a>
-<span class="sourceLineNo">016</span> * See the License for the specific language governing permissions and<a name="line.16"></a>
-<span class="sourceLineNo">017</span> * limitations under the License.<a name="line.17"></a>
-<span class="sourceLineNo">018</span> */<a name="line.18"></a>
-<span class="sourceLineNo">019</span>package org.apache.hadoop.hbase.regionserver;<a name="line.19"></a>
-<span class="sourceLineNo">020</span><a name="line.20"></a>
-<span class="sourceLineNo">021</span>import org.apache.commons.logging.Log;<a name="line.21"></a>
-<span class="sourceLineNo">022</span>import org.apache.hadoop.hbase.Cell;<a name="line.22"></a>
-<span class="sourceLineNo">023</span>import org.apache.hadoop.hbase.classification.InterfaceAudience;<a name="line.23"></a>
-<span class="sourceLineNo">024</span>import org.apache.hadoop.hbase.util.CollectionBackedScanner;<a name="line.24"></a>
-<span class="sourceLineNo">025</span><a name="line.25"></a>
-<span class="sourceLineNo">026</span>/**<a name="line.26"></a>
-<span class="sourceLineNo">027</span> * This segment is adapting a mutable segment making it into an immutable segment.<a name="line.27"></a>
-<span class="sourceLineNo">028</span> * This is used when a mutable segment is moved to being a snapshot or pushed into a compaction<a name="line.28"></a>
-<span class="sourceLineNo">029</span> * pipeline, that consists only of immutable segments.<a name="line.29"></a>
-<span class="sourceLineNo">030</span> * The compaction may generate different type of immutable segment<a name="line.30"></a>
-<span class="sourceLineNo">031</span> */<a name="line.31"></a>
-<span class="sourceLineNo">032</span>@InterfaceAudience.Private<a name="line.32"></a>
-<span class="sourceLineNo">033</span>public class ImmutableSegmentAdapter extends ImmutableSegment {<a name="line.33"></a>
-<span class="sourceLineNo">034</span><a name="line.34"></a>
-<span class="sourceLineNo">035</span>  final private MutableSegment adaptee;<a name="line.35"></a>
-<span class="sourceLineNo">036</span><a name="line.36"></a>
-<span class="sourceLineNo">037</span>  public ImmutableSegmentAdapter(MutableSegment segment) {<a name="line.37"></a>
-<span class="sourceLineNo">038</span>    super(segment);<a name="line.38"></a>
-<span class="sourceLineNo">039</span>    this.adaptee = segment;<a name="line.39"></a>
-<span class="sourceLineNo">040</span>  }<a name="line.40"></a>
-<span class="sourceLineNo">041</span><a name="line.41"></a>
-<span class="sourceLineNo">042</span>  @Override<a name="line.42"></a>
-<span class="sourceLineNo">043</span>  public KeyValueScanner getKeyValueScanner() {<a name="line.43"></a>
-<span class="sourceLineNo">044</span>    return new CollectionBackedScanner(adaptee.getCellSet(), adaptee.getComparator());<a name="line.44"></a>
-<span class="sourceLineNo">045</span>  }<a name="line.45"></a>
-<span class="sourceLineNo">046</span><a name="line.46"></a>
-<span class="sourceLineNo">047</span>  @Override<a name="line.47"></a>
-<span class="sourceLineNo">048</span>  public SegmentScanner getSegmentScanner(long readPoint) {<a name="line.48"></a>
-<span class="sourceLineNo">049</span>    return adaptee.getSegmentScanner(readPoint);<a name="line.49"></a>
-<span class="sourceLineNo">050</span>  }<a name="line.50"></a>
-<span class="sourceLineNo">051</span><a name="line.51"></a>
-<span class="sourceLineNo">052</span>  @Override<a name="line.52"></a>
-<span class="sourceLineNo">053</span>  public boolean isEmpty() {<a name="line.53"></a>
-<span class="sourceLineNo">054</span>    return adaptee.isEmpty();<a name="line.54"></a>
-<span class="sourceLineNo">055</span>  }<a name="line.55"></a>
-<span class="sourceLineNo">056</span><a name="line.56"></a>
-<span class="sourceLineNo">057</span>  @Override<a name="line.57"></a>
-<span class="sourceLineNo">058</span>  public int getCellsCount() {<a name="line.58"></a>
-<span class="sourceLineNo">059</span>    return adaptee.getCellsCount();<a name="line.59"></a>
-<span class="sourceLineNo">060</span>  }<a name="line.60"></a>
-<span class="sourceLineNo">061</span><a name="line.61"></a>
-<span class="sourceLineNo">062</span>  @Override<a name="line.62"></a>
-<span class="sourceLineNo">063</span>  public long add(Cell cell) {<a name="line.63"></a>
-<span class="sourceLineNo">064</span>    return adaptee.add(cell);<a name="line.64"></a>
-<span class="sourceLineNo">065</span>  }<a name="line.65"></a>
-<span class="sourceLineNo">066</span><a name="line.66"></a>
-<span class="sourceLineNo">067</span>  @Override<a name="line.67"></a>
-<span class="sourceLineNo">068</span>  public Cell getFirstAfter(Cell cell) {<a name="line.68"></a>
-<span class="sourceLineNo">069</span>    return adaptee.getFirstAfter(cell);<a name="line.69"></a>
-<span class="sourceLineNo">070</span>  }<a name="line.70"></a>
-<span class="sourceLineNo">071</span><a name="line.71"></a>
-<span class="sourceLineNo">072</span>  @Override<a name="line.72"></a>
-<span class="sourceLineNo">073</span>  public void close() {<a name="line.73"></a>
-<span class="sourceLineNo">074</span>    adaptee.close();<a name="line.74"></a>
-<span class="sourceLineNo">075</span>  }<a name="line.75"></a>
-<span class="sourceLineNo">076</span><a name="line.76"></a>
-<span class="sourceLineNo">077</span>  @Override<a name="line.77"></a>
-<span class="sourceLineNo">078</span>  public Cell maybeCloneWithAllocator(Cell cell) {<a name="line.78"></a>
-<span class="sourceLineNo">079</span>    return adaptee.maybeCloneWithAllocator(cell);<a name="line.79"></a>
-<span class="sourceLineNo">080</span>  }<a name="line.80"></a>
-<span class="sourceLineNo">081</span><a name="line.81"></a>
-<span class="sourceLineNo">082</span>  @Override<a name="line.82"></a>
-<span class="sourceLineNo">083</span>  public Segment setSize(long size) {<a name="line.83"></a>
-<span class="sourceLineNo">084</span>    adaptee.setSize(size);<a name="line.84"></a>
-<span class="sourceLineNo">085</span>    return this;<a name="line.85"></a>
-<span class="sourceLineNo">086</span>  }<a name="line.86"></a>
-<span class="sourceLineNo">087</span><a name="line.87"></a>
-<span class="sourceLineNo">088</span>  @Override<a name="line.88"></a>
-<span class="sourceLineNo">089</span>  public long getSize() {<a name="line.89"></a>
-<span class="sourceLineNo">090</span>    return adaptee.getSize();<a name="line.90"></a>
-<span class="sourceLineNo">091</span>  }<a name="line.91"></a>
-<span class="sourceLineNo">092</span><a name="line.92"></a>
-<span class="sourceLineNo">093</span>  @Override<a name="line.93"></a>
-<span class="sourceLineNo">094</span>  public long rollback(Cell cell) {<a name="line.94"></a>
-<span class="sourceLineNo">095</span>    return adaptee.rollback(cell);<a name="line.95"></a>
-<span class="sourceLineNo">096</span>  }<a name="line.96"></a>
-<span class="sourceLineNo">097</span><a name="line.97"></a>
-<span class="sourceLineNo">098</span>  @Override<a name="line.98"></a>
-<span class="sourceLineNo">099</span>  public CellSet getCellSet() {<a name="line.99"></a>
-<span class="sourceLineNo">100</span>    return adaptee.getCellSet();<a name="line.100"></a>
-<span class="sourceLineNo">101</span>  }<a name="line.101"></a>
-<span class="sourceLineNo">102</span><a name="line.102"></a>
-<span class="sourceLineNo">103</span>  @Override<a name="line.103"></a>
-<span class="sourceLineNo">104</span>  public void dump(Log log) {<a name="line.104"></a>
-<span class="sourceLineNo">105</span>    adaptee.dump(log);<a name="line.105"></a>
-<span class="sourceLineNo">106</span>  }<a name="line.106"></a>
-<span class="sourceLineNo">107</span>}<a name="line.107"></a>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-</pre>
-</div>
-</body>
-</html>


Mime
View raw message