hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From git-site-r...@apache.org
Subject [23/51] [partial] hbase-site git commit: Published site at .
Date Tue, 31 Oct 2017 15:17:11 GMT
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/35decbe4/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/RSRpcServices.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/RSRpcServices.html b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/RSRpcServices.html
index 9761535..a4d2378 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/RSRpcServices.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/RSRpcServices.html
@@ -1145,2347 +1145,2348 @@
 <span class="sourceLineNo">1137</span>      if (LOG.isWarnEnabled()) {<a name="line.1137"></a>
 <span class="sourceLineNo">1138</span>        LOG.warn("Large batch operation detected (greater than " + rowSizeWarnThreshold<a name="line.1138"></a>
 <span class="sourceLineNo">1139</span>            + ") (HBASE-18023)." + " Requested Number of Rows: " + sum + " Client: "<a name="line.1139"></a>
-<span class="sourceLineNo">1140</span>            + RpcServer.getRequestUserName() + "/" + RpcServer.getRemoteAddress()<a name="line.1140"></a>
-<span class="sourceLineNo">1141</span>            + " first region in multi=" + firstRegionName);<a name="line.1141"></a>
-<span class="sourceLineNo">1142</span>      }<a name="line.1142"></a>
-<span class="sourceLineNo">1143</span>    }<a name="line.1143"></a>
-<span class="sourceLineNo">1144</span>  };<a name="line.1144"></a>
-<span class="sourceLineNo">1145</span><a name="line.1145"></a>
-<span class="sourceLineNo">1146</span>  private final LogDelegate ld;<a name="line.1146"></a>
-<span class="sourceLineNo">1147</span><a name="line.1147"></a>
-<span class="sourceLineNo">1148</span>  public RSRpcServices(HRegionServer rs) throws IOException {<a name="line.1148"></a>
-<span class="sourceLineNo">1149</span>    this(rs, DEFAULT_LOG_DELEGATE);<a name="line.1149"></a>
-<span class="sourceLineNo">1150</span>  }<a name="line.1150"></a>
-<span class="sourceLineNo">1151</span><a name="line.1151"></a>
-<span class="sourceLineNo">1152</span>  // Directly invoked only for testing<a name="line.1152"></a>
-<span class="sourceLineNo">1153</span>  RSRpcServices(HRegionServer rs, LogDelegate ld) throws IOException {<a name="line.1153"></a>
-<span class="sourceLineNo">1154</span>    this.ld = ld;<a name="line.1154"></a>
-<span class="sourceLineNo">1155</span>    regionServer = rs;<a name="line.1155"></a>
-<span class="sourceLineNo">1156</span>    rowSizeWarnThreshold = rs.conf.getInt(BATCH_ROWS_THRESHOLD_NAME, BATCH_ROWS_THRESHOLD_DEFAULT);<a name="line.1156"></a>
-<span class="sourceLineNo">1157</span>    RpcSchedulerFactory rpcSchedulerFactory;<a name="line.1157"></a>
-<span class="sourceLineNo">1158</span>    try {<a name="line.1158"></a>
-<span class="sourceLineNo">1159</span>      Class&lt;?&gt; rpcSchedulerFactoryClass = rs.conf.getClass(<a name="line.1159"></a>
-<span class="sourceLineNo">1160</span>          REGION_SERVER_RPC_SCHEDULER_FACTORY_CLASS,<a name="line.1160"></a>
-<span class="sourceLineNo">1161</span>          SimpleRpcSchedulerFactory.class);<a name="line.1161"></a>
-<span class="sourceLineNo">1162</span>      rpcSchedulerFactory = ((RpcSchedulerFactory) rpcSchedulerFactoryClass.newInstance());<a name="line.1162"></a>
-<span class="sourceLineNo">1163</span>    } catch (InstantiationException e) {<a name="line.1163"></a>
-<span class="sourceLineNo">1164</span>      throw new IllegalArgumentException(e);<a name="line.1164"></a>
-<span class="sourceLineNo">1165</span>    } catch (IllegalAccessException e) {<a name="line.1165"></a>
-<span class="sourceLineNo">1166</span>      throw new IllegalArgumentException(e);<a name="line.1166"></a>
-<span class="sourceLineNo">1167</span>    }<a name="line.1167"></a>
-<span class="sourceLineNo">1168</span>    // Server to handle client requests.<a name="line.1168"></a>
-<span class="sourceLineNo">1169</span>    InetSocketAddress initialIsa;<a name="line.1169"></a>
-<span class="sourceLineNo">1170</span>    InetSocketAddress bindAddress;<a name="line.1170"></a>
-<span class="sourceLineNo">1171</span>    if(this instanceof MasterRpcServices) {<a name="line.1171"></a>
-<span class="sourceLineNo">1172</span>      String hostname = getHostname(rs.conf, true);<a name="line.1172"></a>
-<span class="sourceLineNo">1173</span>      int port = rs.conf.getInt(HConstants.MASTER_PORT, HConstants.DEFAULT_MASTER_PORT);<a name="line.1173"></a>
-<span class="sourceLineNo">1174</span>      // Creation of a HSA will force a resolve.<a name="line.1174"></a>
-<span class="sourceLineNo">1175</span>      initialIsa = new InetSocketAddress(hostname, port);<a name="line.1175"></a>
-<span class="sourceLineNo">1176</span>      bindAddress = new InetSocketAddress(rs.conf.get("hbase.master.ipc.address", hostname), port);<a name="line.1176"></a>
-<span class="sourceLineNo">1177</span>    } else {<a name="line.1177"></a>
-<span class="sourceLineNo">1178</span>      String hostname = getHostname(rs.conf, false);<a name="line.1178"></a>
-<span class="sourceLineNo">1179</span>      int port = rs.conf.getInt(HConstants.REGIONSERVER_PORT,<a name="line.1179"></a>
-<span class="sourceLineNo">1180</span>        HConstants.DEFAULT_REGIONSERVER_PORT);<a name="line.1180"></a>
-<span class="sourceLineNo">1181</span>      // Creation of a HSA will force a resolve.<a name="line.1181"></a>
-<span class="sourceLineNo">1182</span>      initialIsa = new InetSocketAddress(hostname, port);<a name="line.1182"></a>
-<span class="sourceLineNo">1183</span>      bindAddress = new InetSocketAddress(<a name="line.1183"></a>
-<span class="sourceLineNo">1184</span>        rs.conf.get("hbase.regionserver.ipc.address", hostname), port);<a name="line.1184"></a>
-<span class="sourceLineNo">1185</span>    }<a name="line.1185"></a>
-<span class="sourceLineNo">1186</span>    if (initialIsa.getAddress() == null) {<a name="line.1186"></a>
-<span class="sourceLineNo">1187</span>      throw new IllegalArgumentException("Failed resolve of " + initialIsa);<a name="line.1187"></a>
-<span class="sourceLineNo">1188</span>    }<a name="line.1188"></a>
-<span class="sourceLineNo">1189</span>    priority = createPriority();<a name="line.1189"></a>
-<span class="sourceLineNo">1190</span>    String name = rs.getProcessName() + "/" + initialIsa.toString();<a name="line.1190"></a>
-<span class="sourceLineNo">1191</span>    // Set how many times to retry talking to another server over Connection.<a name="line.1191"></a>
-<span class="sourceLineNo">1192</span>    ConnectionUtils.setServerSideHConnectionRetriesConfig(rs.conf, name, LOG);<a name="line.1192"></a>
-<span class="sourceLineNo">1193</span>    try {<a name="line.1193"></a>
-<span class="sourceLineNo">1194</span>      rpcServer = RpcServerFactory.createRpcServer(rs, name, getServices(),<a name="line.1194"></a>
-<span class="sourceLineNo">1195</span>          bindAddress, // use final bindAddress for this server.<a name="line.1195"></a>
-<span class="sourceLineNo">1196</span>          rs.conf,<a name="line.1196"></a>
-<span class="sourceLineNo">1197</span>          rpcSchedulerFactory.create(rs.conf, this, rs));<a name="line.1197"></a>
-<span class="sourceLineNo">1198</span>      rpcServer.setRsRpcServices(this);<a name="line.1198"></a>
-<span class="sourceLineNo">1199</span>    } catch (BindException be) {<a name="line.1199"></a>
-<span class="sourceLineNo">1200</span>      String configName = (this instanceof MasterRpcServices) ? HConstants.MASTER_PORT :<a name="line.1200"></a>
-<span class="sourceLineNo">1201</span>          HConstants.REGIONSERVER_PORT;<a name="line.1201"></a>
-<span class="sourceLineNo">1202</span>      throw new IOException(be.getMessage() + ". To switch ports use the '" + configName +<a name="line.1202"></a>
-<span class="sourceLineNo">1203</span>          "' configuration property.", be.getCause() != null ? be.getCause() : be);<a name="line.1203"></a>
-<span class="sourceLineNo">1204</span>    }<a name="line.1204"></a>
-<span class="sourceLineNo">1205</span><a name="line.1205"></a>
-<span class="sourceLineNo">1206</span>    scannerLeaseTimeoutPeriod = rs.conf.getInt(<a name="line.1206"></a>
-<span class="sourceLineNo">1207</span>      HConstants.HBASE_CLIENT_SCANNER_TIMEOUT_PERIOD,<a name="line.1207"></a>
-<span class="sourceLineNo">1208</span>      HConstants.DEFAULT_HBASE_CLIENT_SCANNER_TIMEOUT_PERIOD);<a name="line.1208"></a>
-<span class="sourceLineNo">1209</span>    maxScannerResultSize = rs.conf.getLong(<a name="line.1209"></a>
-<span class="sourceLineNo">1210</span>      HConstants.HBASE_SERVER_SCANNER_MAX_RESULT_SIZE_KEY,<a name="line.1210"></a>
-<span class="sourceLineNo">1211</span>      HConstants.DEFAULT_HBASE_SERVER_SCANNER_MAX_RESULT_SIZE);<a name="line.1211"></a>
-<span class="sourceLineNo">1212</span>    rpcTimeout = rs.conf.getInt(<a name="line.1212"></a>
-<span class="sourceLineNo">1213</span>      HConstants.HBASE_RPC_TIMEOUT_KEY,<a name="line.1213"></a>
-<span class="sourceLineNo">1214</span>      HConstants.DEFAULT_HBASE_RPC_TIMEOUT);<a name="line.1214"></a>
-<span class="sourceLineNo">1215</span>    minimumScanTimeLimitDelta = rs.conf.getLong(<a name="line.1215"></a>
-<span class="sourceLineNo">1216</span>      REGION_SERVER_RPC_MINIMUM_SCAN_TIME_LIMIT_DELTA,<a name="line.1216"></a>
-<span class="sourceLineNo">1217</span>      DEFAULT_REGION_SERVER_RPC_MINIMUM_SCAN_TIME_LIMIT_DELTA);<a name="line.1217"></a>
-<span class="sourceLineNo">1218</span><a name="line.1218"></a>
-<span class="sourceLineNo">1219</span>    InetSocketAddress address = rpcServer.getListenerAddress();<a name="line.1219"></a>
-<span class="sourceLineNo">1220</span>    if (address == null) {<a name="line.1220"></a>
-<span class="sourceLineNo">1221</span>      throw new IOException("Listener channel is closed");<a name="line.1221"></a>
-<span class="sourceLineNo">1222</span>    }<a name="line.1222"></a>
-<span class="sourceLineNo">1223</span>    // Set our address, however we need the final port that was given to rpcServer<a name="line.1223"></a>
-<span class="sourceLineNo">1224</span>    isa = new InetSocketAddress(initialIsa.getHostName(), address.getPort());<a name="line.1224"></a>
-<span class="sourceLineNo">1225</span>    rpcServer.setErrorHandler(this);<a name="line.1225"></a>
-<span class="sourceLineNo">1226</span>    rs.setName(name);<a name="line.1226"></a>
-<span class="sourceLineNo">1227</span><a name="line.1227"></a>
-<span class="sourceLineNo">1228</span>    closedScanners = CacheBuilder.newBuilder()<a name="line.1228"></a>
-<span class="sourceLineNo">1229</span>        .expireAfterAccess(scannerLeaseTimeoutPeriod, TimeUnit.MILLISECONDS).build();<a name="line.1229"></a>
-<span class="sourceLineNo">1230</span>  }<a name="line.1230"></a>
-<span class="sourceLineNo">1231</span><a name="line.1231"></a>
-<span class="sourceLineNo">1232</span>  @Override<a name="line.1232"></a>
-<span class="sourceLineNo">1233</span>  public void onConfigurationChange(Configuration newConf) {<a name="line.1233"></a>
-<span class="sourceLineNo">1234</span>    if (rpcServer instanceof ConfigurationObserver) {<a name="line.1234"></a>
-<span class="sourceLineNo">1235</span>      ((ConfigurationObserver)rpcServer).onConfigurationChange(newConf);<a name="line.1235"></a>
-<span class="sourceLineNo">1236</span>    }<a name="line.1236"></a>
-<span class="sourceLineNo">1237</span>  }<a name="line.1237"></a>
-<span class="sourceLineNo">1238</span><a name="line.1238"></a>
-<span class="sourceLineNo">1239</span>  protected PriorityFunction createPriority() {<a name="line.1239"></a>
-<span class="sourceLineNo">1240</span>    return new AnnotationReadingPriorityFunction(this);<a name="line.1240"></a>
-<span class="sourceLineNo">1241</span>  }<a name="line.1241"></a>
-<span class="sourceLineNo">1242</span><a name="line.1242"></a>
-<span class="sourceLineNo">1243</span>  public static String getHostname(Configuration conf, boolean isMaster)<a name="line.1243"></a>
-<span class="sourceLineNo">1244</span>      throws UnknownHostException {<a name="line.1244"></a>
-<span class="sourceLineNo">1245</span>    String hostname = conf.get(isMaster? HRegionServer.MASTER_HOSTNAME_KEY :<a name="line.1245"></a>
-<span class="sourceLineNo">1246</span>      HRegionServer.RS_HOSTNAME_KEY);<a name="line.1246"></a>
-<span class="sourceLineNo">1247</span>    if (hostname == null || hostname.isEmpty()) {<a name="line.1247"></a>
-<span class="sourceLineNo">1248</span>      String masterOrRS = isMaster ? "master" : "regionserver";<a name="line.1248"></a>
-<span class="sourceLineNo">1249</span>      return Strings.domainNamePointerToHostName(DNS.getDefaultHost(<a name="line.1249"></a>
-<span class="sourceLineNo">1250</span>        conf.get("hbase." + masterOrRS + ".dns.interface", "default"),<a name="line.1250"></a>
-<span class="sourceLineNo">1251</span>        conf.get("hbase." + masterOrRS + ".dns.nameserver", "default")));<a name="line.1251"></a>
-<span class="sourceLineNo">1252</span>    } else {<a name="line.1252"></a>
-<span class="sourceLineNo">1253</span>      LOG.info("hostname is configured to be " + hostname);<a name="line.1253"></a>
-<span class="sourceLineNo">1254</span>      return hostname;<a name="line.1254"></a>
-<span class="sourceLineNo">1255</span>    }<a name="line.1255"></a>
-<span class="sourceLineNo">1256</span>  }<a name="line.1256"></a>
-<span class="sourceLineNo">1257</span><a name="line.1257"></a>
-<span class="sourceLineNo">1258</span>  @VisibleForTesting<a name="line.1258"></a>
-<span class="sourceLineNo">1259</span>  public int getScannersCount() {<a name="line.1259"></a>
-<span class="sourceLineNo">1260</span>    return scanners.size();<a name="line.1260"></a>
-<span class="sourceLineNo">1261</span>  }<a name="line.1261"></a>
-<span class="sourceLineNo">1262</span><a name="line.1262"></a>
-<span class="sourceLineNo">1263</span>  public<a name="line.1263"></a>
-<span class="sourceLineNo">1264</span>  RegionScanner getScanner(long scannerId) {<a name="line.1264"></a>
-<span class="sourceLineNo">1265</span>    String scannerIdString = Long.toString(scannerId);<a name="line.1265"></a>
-<span class="sourceLineNo">1266</span>    RegionScannerHolder scannerHolder = scanners.get(scannerIdString);<a name="line.1266"></a>
-<span class="sourceLineNo">1267</span>    if (scannerHolder != null) {<a name="line.1267"></a>
-<span class="sourceLineNo">1268</span>      return scannerHolder.s;<a name="line.1268"></a>
-<span class="sourceLineNo">1269</span>    }<a name="line.1269"></a>
-<span class="sourceLineNo">1270</span>    return null;<a name="line.1270"></a>
-<span class="sourceLineNo">1271</span>  }<a name="line.1271"></a>
-<span class="sourceLineNo">1272</span><a name="line.1272"></a>
-<span class="sourceLineNo">1273</span>  public String getScanDetailsWithId(long scannerId) {<a name="line.1273"></a>
-<span class="sourceLineNo">1274</span>    RegionScanner scanner = getScanner(scannerId);<a name="line.1274"></a>
-<span class="sourceLineNo">1275</span>    if (scanner == null) {<a name="line.1275"></a>
-<span class="sourceLineNo">1276</span>      return null;<a name="line.1276"></a>
-<span class="sourceLineNo">1277</span>    }<a name="line.1277"></a>
-<span class="sourceLineNo">1278</span>    StringBuilder builder = new StringBuilder();<a name="line.1278"></a>
-<span class="sourceLineNo">1279</span>    builder.append("table: ").append(scanner.getRegionInfo().getTable().getNameAsString());<a name="line.1279"></a>
-<span class="sourceLineNo">1280</span>    builder.append(" region: ").append(scanner.getRegionInfo().getRegionNameAsString());<a name="line.1280"></a>
-<span class="sourceLineNo">1281</span>    return builder.toString();<a name="line.1281"></a>
-<span class="sourceLineNo">1282</span>  }<a name="line.1282"></a>
-<span class="sourceLineNo">1283</span><a name="line.1283"></a>
-<span class="sourceLineNo">1284</span>  /**<a name="line.1284"></a>
-<span class="sourceLineNo">1285</span>   * Get the vtime associated with the scanner.<a name="line.1285"></a>
-<span class="sourceLineNo">1286</span>   * Currently the vtime is the number of "next" calls.<a name="line.1286"></a>
-<span class="sourceLineNo">1287</span>   */<a name="line.1287"></a>
-<span class="sourceLineNo">1288</span>  long getScannerVirtualTime(long scannerId) {<a name="line.1288"></a>
-<span class="sourceLineNo">1289</span>    String scannerIdString = Long.toString(scannerId);<a name="line.1289"></a>
-<span class="sourceLineNo">1290</span>    RegionScannerHolder scannerHolder = scanners.get(scannerIdString);<a name="line.1290"></a>
-<span class="sourceLineNo">1291</span>    if (scannerHolder != null) {<a name="line.1291"></a>
-<span class="sourceLineNo">1292</span>      return scannerHolder.getNextCallSeq();<a name="line.1292"></a>
-<span class="sourceLineNo">1293</span>    }<a name="line.1293"></a>
-<span class="sourceLineNo">1294</span>    return 0L;<a name="line.1294"></a>
-<span class="sourceLineNo">1295</span>  }<a name="line.1295"></a>
-<span class="sourceLineNo">1296</span><a name="line.1296"></a>
-<span class="sourceLineNo">1297</span>  /**<a name="line.1297"></a>
-<span class="sourceLineNo">1298</span>   * Method to account for the size of retained cells and retained data blocks.<a name="line.1298"></a>
-<span class="sourceLineNo">1299</span>   * @return an object that represents the last referenced block from this response.<a name="line.1299"></a>
-<span class="sourceLineNo">1300</span>   */<a name="line.1300"></a>
-<span class="sourceLineNo">1301</span>  Object addSize(RpcCallContext context, Result r, Object lastBlock) {<a name="line.1301"></a>
-<span class="sourceLineNo">1302</span>    if (context != null &amp;&amp; r != null &amp;&amp; !r.isEmpty()) {<a name="line.1302"></a>
-<span class="sourceLineNo">1303</span>      for (Cell c : r.rawCells()) {<a name="line.1303"></a>
-<span class="sourceLineNo">1304</span>        context.incrementResponseCellSize(PrivateCellUtil.estimatedSerializedSizeOf(c));<a name="line.1304"></a>
-<span class="sourceLineNo">1305</span><a name="line.1305"></a>
-<span class="sourceLineNo">1306</span>        // Since byte buffers can point all kinds of crazy places it's harder to keep track<a name="line.1306"></a>
-<span class="sourceLineNo">1307</span>        // of which blocks are kept alive by what byte buffer.<a name="line.1307"></a>
-<span class="sourceLineNo">1308</span>        // So we make a guess.<a name="line.1308"></a>
-<span class="sourceLineNo">1309</span>        if (c instanceof ByteBufferCell) {<a name="line.1309"></a>
-<span class="sourceLineNo">1310</span>          ByteBufferCell bbCell = (ByteBufferCell) c;<a name="line.1310"></a>
-<span class="sourceLineNo">1311</span>          ByteBuffer bb = bbCell.getValueByteBuffer();<a name="line.1311"></a>
-<span class="sourceLineNo">1312</span>          if (bb != lastBlock) {<a name="line.1312"></a>
-<span class="sourceLineNo">1313</span>            context.incrementResponseBlockSize(bb.capacity());<a name="line.1313"></a>
-<span class="sourceLineNo">1314</span>            lastBlock = bb;<a name="line.1314"></a>
-<span class="sourceLineNo">1315</span>          }<a name="line.1315"></a>
-<span class="sourceLineNo">1316</span>        } else {<a name="line.1316"></a>
-<span class="sourceLineNo">1317</span>          // We're using the last block being the same as the current block as<a name="line.1317"></a>
-<span class="sourceLineNo">1318</span>          // a proxy for pointing to a new block. This won't be exact.<a name="line.1318"></a>
-<span class="sourceLineNo">1319</span>          // If there are multiple gets that bounce back and forth<a name="line.1319"></a>
-<span class="sourceLineNo">1320</span>          // Then it's possible that this will over count the size of<a name="line.1320"></a>
-<span class="sourceLineNo">1321</span>          // referenced blocks. However it's better to over count and<a name="line.1321"></a>
-<span class="sourceLineNo">1322</span>          // use two rpcs than to OOME the regionserver.<a name="line.1322"></a>
-<span class="sourceLineNo">1323</span>          byte[] valueArray = c.getValueArray();<a name="line.1323"></a>
-<span class="sourceLineNo">1324</span>          if (valueArray != lastBlock) {<a name="line.1324"></a>
-<span class="sourceLineNo">1325</span>            context.incrementResponseBlockSize(valueArray.length);<a name="line.1325"></a>
-<span class="sourceLineNo">1326</span>            lastBlock = valueArray;<a name="line.1326"></a>
-<span class="sourceLineNo">1327</span>          }<a name="line.1327"></a>
-<span class="sourceLineNo">1328</span>        }<a name="line.1328"></a>
-<span class="sourceLineNo">1329</span><a name="line.1329"></a>
-<span class="sourceLineNo">1330</span>      }<a name="line.1330"></a>
-<span class="sourceLineNo">1331</span>    }<a name="line.1331"></a>
-<span class="sourceLineNo">1332</span>    return lastBlock;<a name="line.1332"></a>
-<span class="sourceLineNo">1333</span>  }<a name="line.1333"></a>
-<span class="sourceLineNo">1334</span><a name="line.1334"></a>
-<span class="sourceLineNo">1335</span>  private RegionScannerHolder addScanner(String scannerName, RegionScanner s, Shipper shipper,<a name="line.1335"></a>
-<span class="sourceLineNo">1336</span>      HRegion r, boolean needCursor) throws LeaseStillHeldException {<a name="line.1336"></a>
-<span class="sourceLineNo">1337</span>    Lease lease = regionServer.leases.createLease(scannerName, this.scannerLeaseTimeoutPeriod,<a name="line.1337"></a>
-<span class="sourceLineNo">1338</span>      new ScannerListener(scannerName));<a name="line.1338"></a>
-<span class="sourceLineNo">1339</span>    RpcCallback shippedCallback = new RegionScannerShippedCallBack(scannerName, shipper, lease);<a name="line.1339"></a>
-<span class="sourceLineNo">1340</span>    RpcCallback closeCallback;<a name="line.1340"></a>
-<span class="sourceLineNo">1341</span>    if (s instanceof RpcCallback) {<a name="line.1341"></a>
-<span class="sourceLineNo">1342</span>      closeCallback = (RpcCallback) s;<a name="line.1342"></a>
-<span class="sourceLineNo">1343</span>    } else {<a name="line.1343"></a>
-<span class="sourceLineNo">1344</span>      closeCallback = new RegionScannerCloseCallBack(s);<a name="line.1344"></a>
-<span class="sourceLineNo">1345</span>    }<a name="line.1345"></a>
-<span class="sourceLineNo">1346</span>    RegionScannerHolder rsh =<a name="line.1346"></a>
-<span class="sourceLineNo">1347</span>        new RegionScannerHolder(scannerName, s, r, closeCallback, shippedCallback, needCursor);<a name="line.1347"></a>
-<span class="sourceLineNo">1348</span>    RegionScannerHolder existing = scanners.putIfAbsent(scannerName, rsh);<a name="line.1348"></a>
-<span class="sourceLineNo">1349</span>    assert existing == null : "scannerId must be unique within regionserver's whole lifecycle! " +<a name="line.1349"></a>
-<span class="sourceLineNo">1350</span>      scannerName;<a name="line.1350"></a>
-<span class="sourceLineNo">1351</span>    return rsh;<a name="line.1351"></a>
-<span class="sourceLineNo">1352</span>  }<a name="line.1352"></a>
-<span class="sourceLineNo">1353</span><a name="line.1353"></a>
-<span class="sourceLineNo">1354</span>  /**<a name="line.1354"></a>
-<span class="sourceLineNo">1355</span>   * Find the HRegion based on a region specifier<a name="line.1355"></a>
-<span class="sourceLineNo">1356</span>   *<a name="line.1356"></a>
-<span class="sourceLineNo">1357</span>   * @param regionSpecifier the region specifier<a name="line.1357"></a>
-<span class="sourceLineNo">1358</span>   * @return the corresponding region<a name="line.1358"></a>
-<span class="sourceLineNo">1359</span>   * @throws IOException if the specifier is not null,<a name="line.1359"></a>
-<span class="sourceLineNo">1360</span>   *    but failed to find the region<a name="line.1360"></a>
-<span class="sourceLineNo">1361</span>   */<a name="line.1361"></a>
-<span class="sourceLineNo">1362</span>  @VisibleForTesting<a name="line.1362"></a>
-<span class="sourceLineNo">1363</span>  public HRegion getRegion(<a name="line.1363"></a>
-<span class="sourceLineNo">1364</span>      final RegionSpecifier regionSpecifier) throws IOException {<a name="line.1364"></a>
-<span class="sourceLineNo">1365</span>    ByteString value = regionSpecifier.getValue();<a name="line.1365"></a>
-<span class="sourceLineNo">1366</span>    RegionSpecifierType type = regionSpecifier.getType();<a name="line.1366"></a>
-<span class="sourceLineNo">1367</span>    switch (type) {<a name="line.1367"></a>
-<span class="sourceLineNo">1368</span>      case REGION_NAME:<a name="line.1368"></a>
-<span class="sourceLineNo">1369</span>        byte[] regionName = value.toByteArray();<a name="line.1369"></a>
-<span class="sourceLineNo">1370</span>        String encodedRegionName = RegionInfo.encodeRegionName(regionName);<a name="line.1370"></a>
-<span class="sourceLineNo">1371</span>        return regionServer.getRegionByEncodedName(regionName, encodedRegionName);<a name="line.1371"></a>
-<span class="sourceLineNo">1372</span>      case ENCODED_REGION_NAME:<a name="line.1372"></a>
-<span class="sourceLineNo">1373</span>        return regionServer.getRegionByEncodedName(value.toStringUtf8());<a name="line.1373"></a>
-<span class="sourceLineNo">1374</span>      default:<a name="line.1374"></a>
-<span class="sourceLineNo">1375</span>        throw new DoNotRetryIOException(<a name="line.1375"></a>
-<span class="sourceLineNo">1376</span>          "Unsupported region specifier type: " + type);<a name="line.1376"></a>
-<span class="sourceLineNo">1377</span>    }<a name="line.1377"></a>
-<span class="sourceLineNo">1378</span>  }<a name="line.1378"></a>
-<span class="sourceLineNo">1379</span><a name="line.1379"></a>
-<span class="sourceLineNo">1380</span>  @VisibleForTesting<a name="line.1380"></a>
-<span class="sourceLineNo">1381</span>  public PriorityFunction getPriority() {<a name="line.1381"></a>
-<span class="sourceLineNo">1382</span>    return priority;<a name="line.1382"></a>
-<span class="sourceLineNo">1383</span>  }<a name="line.1383"></a>
-<span class="sourceLineNo">1384</span><a name="line.1384"></a>
-<span class="sourceLineNo">1385</span>  @VisibleForTesting<a name="line.1385"></a>
-<span class="sourceLineNo">1386</span>  public Configuration getConfiguration() {<a name="line.1386"></a>
-<span class="sourceLineNo">1387</span>    return regionServer.getConfiguration();<a name="line.1387"></a>
-<span class="sourceLineNo">1388</span>  }<a name="line.1388"></a>
-<span class="sourceLineNo">1389</span><a name="line.1389"></a>
-<span class="sourceLineNo">1390</span>  private RegionServerRpcQuotaManager getRpcQuotaManager() {<a name="line.1390"></a>
-<span class="sourceLineNo">1391</span>    return regionServer.getRegionServerRpcQuotaManager();<a name="line.1391"></a>
-<span class="sourceLineNo">1392</span>  }<a name="line.1392"></a>
-<span class="sourceLineNo">1393</span><a name="line.1393"></a>
-<span class="sourceLineNo">1394</span>  private RegionServerSpaceQuotaManager getSpaceQuotaManager() {<a name="line.1394"></a>
-<span class="sourceLineNo">1395</span>    return regionServer.getRegionServerSpaceQuotaManager();<a name="line.1395"></a>
-<span class="sourceLineNo">1396</span>  }<a name="line.1396"></a>
-<span class="sourceLineNo">1397</span><a name="line.1397"></a>
-<span class="sourceLineNo">1398</span>  void start() {<a name="line.1398"></a>
-<span class="sourceLineNo">1399</span>    this.scannerIdGenerator = new ScannerIdGenerator(this.regionServer.serverName);<a name="line.1399"></a>
-<span class="sourceLineNo">1400</span>    rpcServer.start();<a name="line.1400"></a>
-<span class="sourceLineNo">1401</span>  }<a name="line.1401"></a>
-<span class="sourceLineNo">1402</span><a name="line.1402"></a>
-<span class="sourceLineNo">1403</span>  void stop() {<a name="line.1403"></a>
-<span class="sourceLineNo">1404</span>    closeAllScanners();<a name="line.1404"></a>
-<span class="sourceLineNo">1405</span>    rpcServer.stop();<a name="line.1405"></a>
-<span class="sourceLineNo">1406</span>  }<a name="line.1406"></a>
-<span class="sourceLineNo">1407</span><a name="line.1407"></a>
-<span class="sourceLineNo">1408</span>  /**<a name="line.1408"></a>
-<span class="sourceLineNo">1409</span>   * Called to verify that this server is up and running.<a name="line.1409"></a>
-<span class="sourceLineNo">1410</span>   *<a name="line.1410"></a>
-<span class="sourceLineNo">1411</span>   * @throws IOException<a name="line.1411"></a>
-<span class="sourceLineNo">1412</span>   */<a name="line.1412"></a>
-<span class="sourceLineNo">1413</span>  protected void checkOpen() throws IOException {<a name="line.1413"></a>
-<span class="sourceLineNo">1414</span>    if (regionServer.isAborted()) {<a name="line.1414"></a>
-<span class="sourceLineNo">1415</span>      throw new RegionServerAbortedException("Server " + regionServer.serverName + " aborting");<a name="line.1415"></a>
-<span class="sourceLineNo">1416</span>    }<a name="line.1416"></a>
-<span class="sourceLineNo">1417</span>    if (regionServer.isStopped()) {<a name="line.1417"></a>
-<span class="sourceLineNo">1418</span>      throw new RegionServerStoppedException("Server " + regionServer.serverName + " stopping");<a name="line.1418"></a>
-<span class="sourceLineNo">1419</span>    }<a name="line.1419"></a>
-<span class="sourceLineNo">1420</span>    if (!regionServer.fsOk) {<a name="line.1420"></a>
-<span class="sourceLineNo">1421</span>      throw new RegionServerStoppedException("File system not available");<a name="line.1421"></a>
-<span class="sourceLineNo">1422</span>    }<a name="line.1422"></a>
-<span class="sourceLineNo">1423</span>    if (!regionServer.isOnline()) {<a name="line.1423"></a>
-<span class="sourceLineNo">1424</span>      throw new ServerNotRunningYetException("Server " + regionServer.serverName<a name="line.1424"></a>
-<span class="sourceLineNo">1425</span>          + " is not running yet");<a name="line.1425"></a>
-<span class="sourceLineNo">1426</span>    }<a name="line.1426"></a>
-<span class="sourceLineNo">1427</span>  }<a name="line.1427"></a>
-<span class="sourceLineNo">1428</span><a name="line.1428"></a>
-<span class="sourceLineNo">1429</span>  /**<a name="line.1429"></a>
-<span class="sourceLineNo">1430</span>   * By default, put up an Admin and a Client Service.<a name="line.1430"></a>
-<span class="sourceLineNo">1431</span>   * Set booleans &lt;code&gt;hbase.regionserver.admin.executorService&lt;/code&gt; and<a name="line.1431"></a>
-<span class="sourceLineNo">1432</span>   * &lt;code&gt;hbase.regionserver.client.executorService&lt;/code&gt; if you want to enable/disable services.<a name="line.1432"></a>
-<span class="sourceLineNo">1433</span>   * Default is that both are enabled.<a name="line.1433"></a>
-<span class="sourceLineNo">1434</span>   * @return immutable list of blocking services and the security info classes that this server<a name="line.1434"></a>
-<span class="sourceLineNo">1435</span>   * supports<a name="line.1435"></a>
-<span class="sourceLineNo">1436</span>   */<a name="line.1436"></a>
-<span class="sourceLineNo">1437</span>  protected List&lt;BlockingServiceAndInterface&gt; getServices() {<a name="line.1437"></a>
-<span class="sourceLineNo">1438</span>    boolean admin =<a name="line.1438"></a>
-<span class="sourceLineNo">1439</span>      getConfiguration().getBoolean(REGIONSERVER_ADMIN_SERVICE_CONFIG, true);<a name="line.1439"></a>
-<span class="sourceLineNo">1440</span>    boolean client =<a name="line.1440"></a>
-<span class="sourceLineNo">1441</span>      getConfiguration().getBoolean(REGIONSERVER_CLIENT_SERVICE_CONFIG, true);<a name="line.1441"></a>
-<span class="sourceLineNo">1442</span>    List&lt;BlockingServiceAndInterface&gt; bssi = new ArrayList&lt;&gt;();<a name="line.1442"></a>
-<span class="sourceLineNo">1443</span>    if (client) {<a name="line.1443"></a>
-<span class="sourceLineNo">1444</span>      bssi.add(new BlockingServiceAndInterface(<a name="line.1444"></a>
-<span class="sourceLineNo">1445</span>      ClientService.newReflectiveBlockingService(this),<a name="line.1445"></a>
-<span class="sourceLineNo">1446</span>      ClientService.BlockingInterface.class));<a name="line.1446"></a>
-<span class="sourceLineNo">1447</span>    }<a name="line.1447"></a>
-<span class="sourceLineNo">1448</span>    if (admin) {<a name="line.1448"></a>
-<span class="sourceLineNo">1449</span>      bssi.add(new BlockingServiceAndInterface(<a name="line.1449"></a>
-<span class="sourceLineNo">1450</span>      AdminService.newReflectiveBlockingService(this),<a name="line.1450"></a>
-<span class="sourceLineNo">1451</span>      AdminService.BlockingInterface.class));<a name="line.1451"></a>
-<span class="sourceLineNo">1452</span>    }<a name="line.1452"></a>
-<span class="sourceLineNo">1453</span>    return new org.apache.hadoop.hbase.shaded.com.google.common.collect.<a name="line.1453"></a>
-<span class="sourceLineNo">1454</span>        ImmutableList.Builder&lt;BlockingServiceAndInterface&gt;().addAll(bssi).build();<a name="line.1454"></a>
-<span class="sourceLineNo">1455</span>  }<a name="line.1455"></a>
-<span class="sourceLineNo">1456</span><a name="line.1456"></a>
-<span class="sourceLineNo">1457</span>  public InetSocketAddress getSocketAddress() {<a name="line.1457"></a>
-<span class="sourceLineNo">1458</span>    return isa;<a name="line.1458"></a>
-<span class="sourceLineNo">1459</span>  }<a name="line.1459"></a>
-<span class="sourceLineNo">1460</span><a name="line.1460"></a>
-<span class="sourceLineNo">1461</span>  @Override<a name="line.1461"></a>
-<span class="sourceLineNo">1462</span>  public int getPriority(RequestHeader header, Message param, User user) {<a name="line.1462"></a>
-<span class="sourceLineNo">1463</span>    return priority.getPriority(header, param, user);<a name="line.1463"></a>
-<span class="sourceLineNo">1464</span>  }<a name="line.1464"></a>
-<span class="sourceLineNo">1465</span><a name="line.1465"></a>
-<span class="sourceLineNo">1466</span>  @Override<a name="line.1466"></a>
-<span class="sourceLineNo">1467</span>  public long getDeadline(RequestHeader header, Message param) {<a name="line.1467"></a>
-<span class="sourceLineNo">1468</span>    return priority.getDeadline(header, param);<a name="line.1468"></a>
-<span class="sourceLineNo">1469</span>  }<a name="line.1469"></a>
-<span class="sourceLineNo">1470</span><a name="line.1470"></a>
-<span class="sourceLineNo">1471</span>  /*<a name="line.1471"></a>
-<span class="sourceLineNo">1472</span>   * Check if an OOME and, if so, abort immediately to avoid creating more objects.<a name="line.1472"></a>
-<span class="sourceLineNo">1473</span>   *<a name="line.1473"></a>
-<span class="sourceLineNo">1474</span>   * @param e<a name="line.1474"></a>
-<span class="sourceLineNo">1475</span>   *<a name="line.1475"></a>
-<span class="sourceLineNo">1476</span>   * @return True if we OOME'd and are aborting.<a name="line.1476"></a>
-<span class="sourceLineNo">1477</span>   */<a name="line.1477"></a>
-<span class="sourceLineNo">1478</span>  @Override<a name="line.1478"></a>
-<span class="sourceLineNo">1479</span>  public boolean checkOOME(final Throwable e) {<a name="line.1479"></a>
-<span class="sourceLineNo">1480</span>    return exitIfOOME(e);<a name="line.1480"></a>
-<span class="sourceLineNo">1481</span>  }<a name="line.1481"></a>
-<span class="sourceLineNo">1482</span><a name="line.1482"></a>
-<span class="sourceLineNo">1483</span>  public static boolean exitIfOOME(final Throwable e ){<a name="line.1483"></a>
-<span class="sourceLineNo">1484</span>    boolean stop = false;<a name="line.1484"></a>
-<span class="sourceLineNo">1485</span>    try {<a name="line.1485"></a>
-<span class="sourceLineNo">1486</span>      if (e instanceof OutOfMemoryError<a name="line.1486"></a>
-<span class="sourceLineNo">1487</span>          || (e.getCause() != null &amp;&amp; e.getCause() instanceof OutOfMemoryError)<a name="line.1487"></a>
-<span class="sourceLineNo">1488</span>          || (e.getMessage() != null &amp;&amp; e.getMessage().contains(<a name="line.1488"></a>
-<span class="sourceLineNo">1489</span>              "java.lang.OutOfMemoryError"))) {<a name="line.1489"></a>
-<span class="sourceLineNo">1490</span>        stop = true;<a name="line.1490"></a>
-<span class="sourceLineNo">1491</span>        LOG.fatal("Run out of memory; " + RSRpcServices.class.getSimpleName()<a name="line.1491"></a>
-<span class="sourceLineNo">1492</span>          + " will abort itself immediately", e);<a name="line.1492"></a>
-<span class="sourceLineNo">1493</span>      }<a name="line.1493"></a>
-<span class="sourceLineNo">1494</span>    } finally {<a name="line.1494"></a>
-<span class="sourceLineNo">1495</span>      if (stop) {<a name="line.1495"></a>
-<span class="sourceLineNo">1496</span>        Runtime.getRuntime().halt(1);<a name="line.1496"></a>
-<span class="sourceLineNo">1497</span>      }<a name="line.1497"></a>
-<span class="sourceLineNo">1498</span>    }<a name="line.1498"></a>
-<span class="sourceLineNo">1499</span>    return stop;<a name="line.1499"></a>
-<span class="sourceLineNo">1500</span>  }<a name="line.1500"></a>
-<span class="sourceLineNo">1501</span><a name="line.1501"></a>
-<span class="sourceLineNo">1502</span>  /**<a name="line.1502"></a>
-<span class="sourceLineNo">1503</span>   * Close a region on the region server.<a name="line.1503"></a>
-<span class="sourceLineNo">1504</span>   *<a name="line.1504"></a>
-<span class="sourceLineNo">1505</span>   * @param controller the RPC controller<a name="line.1505"></a>
-<span class="sourceLineNo">1506</span>   * @param request the request<a name="line.1506"></a>
-<span class="sourceLineNo">1507</span>   * @throws ServiceException<a name="line.1507"></a>
-<span class="sourceLineNo">1508</span>   */<a name="line.1508"></a>
-<span class="sourceLineNo">1509</span>  @Override<a name="line.1509"></a>
-<span class="sourceLineNo">1510</span>  @QosPriority(priority=HConstants.ADMIN_QOS)<a name="line.1510"></a>
-<span class="sourceLineNo">1511</span>  public CloseRegionResponse closeRegion(final RpcController controller,<a name="line.1511"></a>
-<span class="sourceLineNo">1512</span>      final CloseRegionRequest request) throws ServiceException {<a name="line.1512"></a>
-<span class="sourceLineNo">1513</span>    final ServerName sn = (request.hasDestinationServer() ?<a name="line.1513"></a>
-<span class="sourceLineNo">1514</span>      ProtobufUtil.toServerName(request.getDestinationServer()) : null);<a name="line.1514"></a>
-<span class="sourceLineNo">1515</span><a name="line.1515"></a>
-<span class="sourceLineNo">1516</span>    try {<a name="line.1516"></a>
-<span class="sourceLineNo">1517</span>      checkOpen();<a name="line.1517"></a>
-<span class="sourceLineNo">1518</span>      if (request.hasServerStartCode()) {<a name="line.1518"></a>
-<span class="sourceLineNo">1519</span>        // check that we are the same server that this RPC is intended for.<a name="line.1519"></a>
-<span class="sourceLineNo">1520</span>        long serverStartCode = request.getServerStartCode();<a name="line.1520"></a>
-<span class="sourceLineNo">1521</span>        if (regionServer.serverName.getStartcode() !=  serverStartCode) {<a name="line.1521"></a>
-<span class="sourceLineNo">1522</span>          throw new ServiceException(new DoNotRetryIOException("This RPC was intended for a " +<a name="line.1522"></a>
-<span class="sourceLineNo">1523</span>              "different server with startCode: " + serverStartCode + ", this server is: "<a name="line.1523"></a>
-<span class="sourceLineNo">1524</span>              + regionServer.serverName));<a name="line.1524"></a>
-<span class="sourceLineNo">1525</span>        }<a name="line.1525"></a>
-<span class="sourceLineNo">1526</span>      }<a name="line.1526"></a>
-<span class="sourceLineNo">1527</span>      final String encodedRegionName = ProtobufUtil.getRegionEncodedName(request.getRegion());<a name="line.1527"></a>
-<span class="sourceLineNo">1528</span><a name="line.1528"></a>
-<span class="sourceLineNo">1529</span>      requestCount.increment();<a name="line.1529"></a>
-<span class="sourceLineNo">1530</span>      if (sn == null) {<a name="line.1530"></a>
-<span class="sourceLineNo">1531</span>        LOG.info("Close " + encodedRegionName + " without moving");<a name="line.1531"></a>
-<span class="sourceLineNo">1532</span>      } else {<a name="line.1532"></a>
-<span class="sourceLineNo">1533</span>        LOG.info("Close " + encodedRegionName + ", moving to " + sn);<a name="line.1533"></a>
-<span class="sourceLineNo">1534</span>      }<a name="line.1534"></a>
-<span class="sourceLineNo">1535</span>      boolean closed = regionServer.closeRegion(encodedRegionName, false, sn);<a name="line.1535"></a>
-<span class="sourceLineNo">1536</span>      CloseRegionResponse.Builder builder = CloseRegionResponse.newBuilder().setClosed(closed);<a name="line.1536"></a>
-<span class="sourceLineNo">1537</span>      return builder.build();<a name="line.1537"></a>
-<span class="sourceLineNo">1538</span>    } catch (IOException ie) {<a name="line.1538"></a>
-<span class="sourceLineNo">1539</span>      throw new ServiceException(ie);<a name="line.1539"></a>
-<span class="sourceLineNo">1540</span>    }<a name="line.1540"></a>
-<span class="sourceLineNo">1541</span>  }<a name="line.1541"></a>
-<span class="sourceLineNo">1542</span><a name="line.1542"></a>
-<span class="sourceLineNo">1543</span>  /**<a name="line.1543"></a>
-<span class="sourceLineNo">1544</span>   * Compact a region on the region server.<a name="line.1544"></a>
-<span class="sourceLineNo">1545</span>   *<a name="line.1545"></a>
-<span class="sourceLineNo">1546</span>   * @param controller the RPC controller<a name="line.1546"></a>
-<span class="sourceLineNo">1547</span>   * @param request the request<a name="line.1547"></a>
-<span class="sourceLineNo">1548</span>   * @throws ServiceException<a name="line.1548"></a>
-<span class="sourceLineNo">1549</span>   */<a name="line.1549"></a>
-<span class="sourceLineNo">1550</span>  @Override<a name="line.1550"></a>
-<span class="sourceLineNo">1551</span>  @QosPriority(priority = HConstants.ADMIN_QOS)<a name="line.1551"></a>
-<span class="sourceLineNo">1552</span>  public CompactRegionResponse compactRegion(final RpcController controller,<a name="line.1552"></a>
-<span class="sourceLineNo">1553</span>      final CompactRegionRequest request) throws ServiceException {<a name="line.1553"></a>
-<span class="sourceLineNo">1554</span>    try {<a name="line.1554"></a>
-<span class="sourceLineNo">1555</span>      checkOpen();<a name="line.1555"></a>
-<span class="sourceLineNo">1556</span>      requestCount.increment();<a name="line.1556"></a>
-<span class="sourceLineNo">1557</span>      HRegion region = (HRegion) getRegion(request.getRegion());<a name="line.1557"></a>
-<span class="sourceLineNo">1558</span>      // Quota support is enabled, the requesting user is not system/super user<a name="line.1558"></a>
-<span class="sourceLineNo">1559</span>      // and a quota policy is enforced that disables compactions.<a name="line.1559"></a>
-<span class="sourceLineNo">1560</span>      if (QuotaUtil.isQuotaEnabled(getConfiguration()) &amp;&amp;<a name="line.1560"></a>
-<span class="sourceLineNo">1561</span>          !Superusers.isSuperUser(RpcServer.getRequestUser().orElse(null)) &amp;&amp;<a name="line.1561"></a>
-<span class="sourceLineNo">1562</span>          this.regionServer.getRegionServerSpaceQuotaManager()<a name="line.1562"></a>
-<span class="sourceLineNo">1563</span>              .areCompactionsDisabled(region.getTableDescriptor().getTableName())) {<a name="line.1563"></a>
-<span class="sourceLineNo">1564</span>        throw new DoNotRetryIOException(<a name="line.1564"></a>
-<span class="sourceLineNo">1565</span>            "Compactions on this region are " + "disabled due to a space quota violation.");<a name="line.1565"></a>
-<span class="sourceLineNo">1566</span>      }<a name="line.1566"></a>
-<span class="sourceLineNo">1567</span>      region.startRegionOperation(Operation.COMPACT_REGION);<a name="line.1567"></a>
-<span class="sourceLineNo">1568</span>      LOG.info("Compacting " + region.getRegionInfo().getRegionNameAsString());<a name="line.1568"></a>
-<span class="sourceLineNo">1569</span>      boolean major = request.hasMajor() &amp;&amp; request.getMajor();<a name="line.1569"></a>
-<span class="sourceLineNo">1570</span>      if (request.hasFamily()) {<a name="line.1570"></a>
-<span class="sourceLineNo">1571</span>        byte[] family = request.getFamily().toByteArray();<a name="line.1571"></a>
-<span class="sourceLineNo">1572</span>        String log = "User-triggered " + (major ? "major " : "") + "compaction for region " +<a name="line.1572"></a>
-<span class="sourceLineNo">1573</span>            region.getRegionInfo().getRegionNameAsString() + " and family " +<a name="line.1573"></a>
-<span class="sourceLineNo">1574</span>            Bytes.toString(family);<a name="line.1574"></a>
-<span class="sourceLineNo">1575</span>        LOG.trace(log);<a name="line.1575"></a>
-<span class="sourceLineNo">1576</span>        region.requestCompaction(family, log, Store.PRIORITY_USER, major,<a name="line.1576"></a>
-<span class="sourceLineNo">1577</span>          CompactionLifeCycleTracker.DUMMY);<a name="line.1577"></a>
-<span class="sourceLineNo">1578</span>      } else {<a name="line.1578"></a>
-<span class="sourceLineNo">1579</span>        String log = "User-triggered " + (major ? "major " : "") + "compaction for region " +<a name="line.1579"></a>
-<span class="sourceLineNo">1580</span>            region.getRegionInfo().getRegionNameAsString();<a name="line.1580"></a>
-<span class="sourceLineNo">1581</span>        LOG.trace(log);<a name="line.1581"></a>
-<span class="sourceLineNo">1582</span>        region.requestCompaction(log, Store.PRIORITY_USER, major, CompactionLifeCycleTracker.DUMMY);<a name="line.1582"></a>
-<span class="sourceLineNo">1583</span>      }<a name="line.1583"></a>
-<span class="sourceLineNo">1584</span>      return CompactRegionResponse.newBuilder().build();<a name="line.1584"></a>
-<span class="sourceLineNo">1585</span>    } catch (IOException ie) {<a name="line.1585"></a>
-<span class="sourceLineNo">1586</span>      throw new ServiceException(ie);<a name="line.1586"></a>
-<span class="sourceLineNo">1587</span>    }<a name="line.1587"></a>
-<span class="sourceLineNo">1588</span>  }<a name="line.1588"></a>
-<span class="sourceLineNo">1589</span><a name="line.1589"></a>
-<span class="sourceLineNo">1590</span>  /**<a name="line.1590"></a>
-<span class="sourceLineNo">1591</span>   * Flush a region on the region server.<a name="line.1591"></a>
-<span class="sourceLineNo">1592</span>   *<a name="line.1592"></a>
-<span class="sourceLineNo">1593</span>   * @param controller the RPC controller<a name="line.1593"></a>
-<span class="sourceLineNo">1594</span>   * @param request the request<a name="line.1594"></a>
-<span class="sourceLineNo">1595</span>   * @throws ServiceException<a name="line.1595"></a>
-<span class="sourceLineNo">1596</span>   */<a name="line.1596"></a>
-<span class="sourceLineNo">1597</span>  @Override<a name="line.1597"></a>
-<span class="sourceLineNo">1598</span>  @QosPriority(priority=HConstants.ADMIN_QOS)<a name="line.1598"></a>
-<span class="sourceLineNo">1599</span>  public FlushRegionResponse flushRegion(final RpcController controller,<a name="line.1599"></a>
-<span class="sourceLineNo">1600</span>      final FlushRegionRequest request) throws ServiceException {<a name="line.1600"></a>
-<span class="sourceLineNo">1601</span>    try {<a name="line.1601"></a>
-<span class="sourceLineNo">1602</span>      checkOpen();<a name="line.1602"></a>
-<span class="sourceLineNo">1603</span>      requestCount.increment();<a name="line.1603"></a>
-<span class="sourceLineNo">1604</span>      HRegion region = (HRegion) getRegion(request.getRegion());<a name="line.1604"></a>
-<span class="sourceLineNo">1605</span>      LOG.info("Flushing " + region.getRegionInfo().getRegionNameAsString());<a name="line.1605"></a>
-<span class="sourceLineNo">1606</span>      boolean shouldFlush = true;<a name="line.1606"></a>
-<span class="sourceLineNo">1607</span>      if (request.hasIfOlderThanTs()) {<a name="line.1607"></a>
-<span class="sourceLineNo">1608</span>        shouldFlush = region.getEarliestFlushTimeForAllStores() &lt; request.getIfOlderThanTs();<a name="line.1608"></a>
-<span class="sourceLineNo">1609</span>      }<a name="line.1609"></a>
-<span class="sourceLineNo">1610</span>      FlushRegionResponse.Builder builder = FlushRegionResponse.newBuilder();<a name="line.1610"></a>
-<span class="sourceLineNo">1611</span>      if (shouldFlush) {<a name="line.1611"></a>
-<span class="sourceLineNo">1612</span>        boolean writeFlushWalMarker =  request.hasWriteFlushWalMarker() ?<a name="line.1612"></a>
-<span class="sourceLineNo">1613</span>            request.getWriteFlushWalMarker() : false;<a name="line.1613"></a>
-<span class="sourceLineNo">1614</span>        // Go behind the curtain so we can manage writing of the flush WAL marker<a name="line.1614"></a>
-<span class="sourceLineNo">1615</span>        HRegion.FlushResultImpl flushResult =<a name="line.1615"></a>
-<span class="sourceLineNo">1616</span>            region.flushcache(true, writeFlushWalMarker, FlushLifeCycleTracker.DUMMY);<a name="line.1616"></a>
-<span class="sourceLineNo">1617</span>        boolean compactionNeeded = flushResult.isCompactionNeeded();<a name="line.1617"></a>
-<span class="sourceLineNo">1618</span>        if (compactionNeeded) {<a name="line.1618"></a>
-<span class="sourceLineNo">1619</span>          regionServer.compactSplitThread.requestSystemCompaction(region,<a name="line.1619"></a>
-<span class="sourceLineNo">1620</span>            "Compaction through user triggered flush");<a name="line.1620"></a>
-<span class="sourceLineNo">1621</span>        }<a name="line.1621"></a>
-<span class="sourceLineNo">1622</span>        builder.setFlushed(flushResult.isFlushSucceeded());<a name="line.1622"></a>
-<span class="sourceLineNo">1623</span>        builder.setWroteFlushWalMarker(flushResult.wroteFlushWalMarker);<a name="line.1623"></a>
-<span class="sourceLineNo">1624</span>      }<a name="line.1624"></a>
-<span class="sourceLineNo">1625</span>      builder.setLastFlushTime(region.getEarliestFlushTimeForAllStores());<a name="line.1625"></a>
-<span class="sourceLineNo">1626</span>      return builder.build();<a name="line.1626"></a>
-<span class="sourceLineNo">1627</span>    } catch (DroppedSnapshotException ex) {<a name="line.1627"></a>
-<span class="sourceLineNo">1628</span>      // Cache flush can fail in a few places. If it fails in a critical<a name="line.1628"></a>
-<span class="sourceLineNo">1629</span>      // section, we get a DroppedSnapshotException and a replay of wal<a name="line.1629"></a>
-<span class="sourceLineNo">1630</span>      // is required. Currently the only way to do this is a restart of<a name="line.1630"></a>
-<span class="sourceLineNo">1631</span>      // the server.<a name="line.1631"></a>
-<span class="sourceLineNo">1632</span>      regionServer.abort("Replay of WAL required. Forcing server shutdown", ex);<a name="line.1632"></a>
-<span class="sourceLineNo">1633</span>      throw new ServiceException(ex);<a name="line.1633"></a>
-<span class="sourceLineNo">1634</span>    } catch (IOException ie) {<a name="line.1634"></a>
-<span class="sourceLineNo">1635</span>      throw new ServiceException(ie);<a name="line.1635"></a>
-<span class="sourceLineNo">1636</span>    }<a name="line.1636"></a>
-<span class="sourceLineNo">1637</span>  }<a name="line.1637"></a>
-<span class="sourceLineNo">1638</span><a name="line.1638"></a>
-<span class="sourceLineNo">1639</span>  @Override<a name="line.1639"></a>
-<span class="sourceLineNo">1640</span>  @QosPriority(priority=HConstants.ADMIN_QOS)<a name="line.1640"></a>
-<span class="sourceLineNo">1641</span>  public GetOnlineRegionResponse getOnlineRegion(final RpcController controller,<a name="line.1641"></a>
-<span class="sourceLineNo">1642</span>      final GetOnlineRegionRequest request) throws ServiceException {<a name="line.1642"></a>
-<span class="sourceLineNo">1643</span>    try {<a name="line.1643"></a>
-<span class="sourceLineNo">1644</span>      checkOpen();<a name="line.1644"></a>
-<span class="sourceLineNo">1645</span>      requestCount.increment();<a name="line.1645"></a>
-<span class="sourceLineNo">1646</span>      Map&lt;String, HRegion&gt; onlineRegions = regionServer.onlineRegions;<a name="line.1646"></a>
-<span class="sourceLineNo">1647</span>      List&lt;RegionInfo&gt; list = new ArrayList&lt;&gt;(onlineRegions.size());<a name="line.1647"></a>
-<span class="sourceLineNo">1648</span>      for (HRegion region: onlineRegions.values()) {<a name="line.1648"></a>
-<span class="sourceLineNo">1649</span>        list.add(region.getRegionInfo());<a name="line.1649"></a>
-<span class="sourceLineNo">1650</span>      }<a name="line.1650"></a>
-<span class="sourceLineNo">1651</span>      Collections.sort(list, RegionInfo.COMPARATOR);<a name="line.1651"></a>
-<span class="sourceLineNo">1652</span>      return ResponseConverter.buildGetOnlineRegionResponse(list);<a name="line.1652"></a>
-<span class="sourceLineNo">1653</span>    } catch (IOException ie) {<a name="line.1653"></a>
-<span class="sourceLineNo">1654</span>      throw new ServiceException(ie);<a name="line.1654"></a>
-<span class="sourceLineNo">1655</span>    }<a name="line.1655"></a>
-<span class="sourceLineNo">1656</span>  }<a name="line.1656"></a>
-<span class="sourceLineNo">1657</span><a name="line.1657"></a>
-<span class="sourceLineNo">1658</span>  @Override<a name="line.1658"></a>
-<span class="sourceLineNo">1659</span>  @QosPriority(priority=HConstants.ADMIN_QOS)<a name="line.1659"></a>
-<span class="sourceLineNo">1660</span>  public GetRegionInfoResponse getRegionInfo(final RpcController controller,<a name="line.1660"></a>
-<span class="sourceLineNo">1661</span>      final GetRegionInfoRequest request) throws ServiceException {<a name="line.1661"></a>
-<span class="sourceLineNo">1662</span>    try {<a name="line.1662"></a>
-<span class="sourceLineNo">1663</span>      checkOpen();<a name="line.1663"></a>
-<span class="sourceLineNo">1664</span>      requestCount.increment();<a name="line.1664"></a>
-<span class="sourceLineNo">1665</span>      HRegion region = getRegion(request.getRegion());<a name="line.1665"></a>
-<span class="sourceLineNo">1666</span>      RegionInfo info = region.getRegionInfo();<a name="line.1666"></a>
-<span class="sourceLineNo">1667</span>      byte[] bestSplitRow = null;<a name="line.1667"></a>
-<span class="sourceLineNo">1668</span>      if (request.hasBestSplitRow() &amp;&amp; request.getBestSplitRow()) {<a name="line.1668"></a>
-<span class="sourceLineNo">1669</span>        HRegion r = (HRegion) region;<a name="line.1669"></a>
-<span class="sourceLineNo">1670</span>        region.startRegionOperation(Operation.SPLIT_REGION);<a name="line.1670"></a>
-<span class="sourceLineNo">1671</span>        r.forceSplit(null);<a name="line.1671"></a>
-<span class="sourceLineNo">1672</span>        bestSplitRow = r.checkSplit();<a name="line.1672"></a>
-<span class="sourceLineNo">1673</span>        // when all table data are in memstore, bestSplitRow = null<a name="line.1673"></a>
-<span class="sourceLineNo">1674</span>        // try to flush region first<a name="line.1674"></a>
-<span class="sourceLineNo">1675</span>        if(bestSplitRow == null) {<a name="line.1675"></a>
-<span class="sourceLineNo">1676</span>          r.flush(true);<a name="line.1676"></a>
-<span class="sourceLineNo">1677</span>          bestSplitRow = r.checkSplit();<a name="line.1677"></a>
-<span class="sourceLineNo">1678</span>        }<a name="line.1678"></a>
-<span class="sourceLineNo">1679</span>        r.clearSplit();<a name="line.1679"></a>
-<span class="sourceLineNo">1680</span>      }<a name="line.1680"></a>
-<span class="sourceLineNo">1681</span>      GetRegionInfoResponse.Builder builder = GetRegionInfoResponse.newBuilder();<a name="line.1681"></a>
-<span class="sourceLineNo">1682</span>      builder.setRegionInfo(ProtobufUtil.toRegionInfo(info));<a name="line.1682"></a>
-<span class="sourceLineNo">1683</span>      if (request.hasCompactionState() &amp;&amp; request.getCompactionState()) {<a name="line.1683"></a>
-<span class="sourceLineNo">1684</span>        builder.setCompactionState(ProtobufUtil.createCompactionState(region.getCompactionState()));<a name="line.1684"></a>
-<span class="sourceLineNo">1685</span>      }<a name="line.1685"></a>
-<span class="sourceLineNo">1686</span>      builder.setSplittable(region.isSplittable());<a name="line.1686"></a>
-<span class="sourceLineNo">1687</span>      builder.setMergeable(region.isMergeable());<a name="line.1687"></a>
-<span class="sourceLineNo">1688</span>      builder.setIsRecovering(region.isRecovering());<a name="line.1688"></a>
-<span class="sourceLineNo">1689</span>      if (request.hasBestSplitRow() &amp;&amp; request.getBestSplitRow() &amp;&amp; bestSplitRow != null) {<a name="line.1689"></a>
-<span class="sourceLineNo">1690</span>        builder.setBestSplitRow(UnsafeByteOperations.unsafeWrap(bestSplitRow));<a name="line.1690"></a>
-<span class="sourceLineNo">1691</span>      }<a name="line.1691"></a>
-<span class="sourceLineNo">1692</span>      return builder.build();<a name="line.1692"></a>
-<span class="sourceLineNo">1693</span>    } catch (IOException ie) {<a name="line.1693"></a>
-<span class="sourceLineNo">1694</span>      throw new ServiceException(ie);<a name="line.1694"></a>
-<span class="sourceLineNo">1695</span>    }<a name="line.1695"></a>
-<span class="sourceLineNo">1696</span>  }<a name="line.1696"></a>
-<span class="sourceLineNo">1697</span><a name="line.1697"></a>
-<span class="sourceLineNo">1698</span>  @Override<a name="line.1698"></a>
-<span class="sourceLineNo">1699</span>  @QosPriority(priority=HConstants.ADMIN_QOS)<a name="line.1699"></a>
-<span class="sourceLineNo">1700</span>  public GetRegionLoadResponse getRegionLoad(RpcController controller,<a name="line.1700"></a>
-<span class="sourceLineNo">1701</span>      GetRegionLoadRequest request) throws ServiceException {<a name="line.1701"></a>
-<span class="sourceLineNo">1702</span><a name="line.1702"></a>
-<span class="sourceLineNo">1703</span>    List&lt;HRegion&gt; regions;<a name="line.1703"></a>
-<span class="sourceLineNo">1704</span>    if (request.hasTableName()) {<a name="line.1704"></a>
-<span class="sourceLineNo">1705</span>      TableName tableName = ProtobufUtil.toTableName(request.getTableName());<a name="line.1705"></a>
-<span class="sourceLineNo">1706</span>      regions = regionServer.getRegions(tableName);<a name="line.1706"></a>
-<span class="sourceLineNo">1707</span>    } else {<a name="line.1707"></a>
-<span class="sourceLineNo">1708</span>      regions = regionServer.getRegions();<a name="line.1708"></a>
-<span class="sourceLineNo">1709</span>    }<a name="line.1709"></a>
-<span class="sourceLineNo">1710</span>    List&lt;RegionLoad&gt; rLoads = new ArrayList&lt;&gt;(regions.size());<a name="line.1710"></a>
-<span class="sourceLineNo">1711</span>    RegionLoad.Builder regionLoadBuilder = ClusterStatusProtos.RegionLoad.newBuilder();<a name="line.1711"></a>
-<span class="sourceLineNo">1712</span>    RegionSpecifier.Builder regionSpecifier = RegionSpecifier.newBuilder();<a name="line.1712"></a>
-<span class="sourceLineNo">1713</span><a name="line.1713"></a>
-<span class="sourceLineNo">1714</span>    try {<a name="line.1714"></a>
-<span class="sourceLineNo">1715</span>      for (HRegion region : regions) {<a name="line.1715"></a>
-<span class="sourceLineNo">1716</span>        rLoads.add(regionServer.createRegionLoad(region, regionLoadBuilder, regionSpecifier));<a name="line.1716"></a>
-<span class="sourceLineNo">1717</span>      }<a name="line.1717"></a>
-<span class="sourceLineNo">1718</span>    } catch (IOException e) {<a name="line.1718"></a>
-<span class="sourceLineNo">1719</span>      throw new ServiceException(e);<a name="line.1719"></a>
-<span class="sourceLineNo">1720</span>    }<a name="line.1720"></a>
-<span class="sourceLineNo">1721</span>    GetRegionLoadResponse.Builder builder = GetRegionLoadResponse.newBuilder();<a name="line.1721"></a>
-<span class="sourceLineNo">1722</span>    builder.addAllRegionLoads(rLoads);<a name="line.1722"></a>
-<span class="sourceLineNo">1723</span>    return builder.build();<a name="line.1723"></a>
-<span class="sourceLineNo">1724</span>  }<a name="line.1724"></a>
-<span class="sourceLineNo">1725</span><a name="line.1725"></a>
-<span class="sourceLineNo">1726</span>  @Override<a name="line.1726"></a>
-<span class="sourceLineNo">1727</span>  @QosPriority(priority=HConstants.ADMIN_QOS)<a name="line.1727"></a>
-<span class="sourceLineNo">1728</span>  public ClearCompactionQueuesResponse clearCompactionQueues(RpcController controller,<a name="line.1728"></a>
-<span class="sourceLineNo">1729</span>    ClearCompactionQueuesRequest request) throws ServiceException {<a name="line.1729"></a>
-<span class="sourceLineNo">1730</span>    LOG.debug("Client=" + RpcServer.getRequestUserName() + "/" + RpcServer.getRemoteAddress()<a name="line.1730"></a>
-<span class="sourceLineNo">1731</span>            + " clear compactions queue");<a name="line.1731"></a>
-<span class="sourceLineNo">1732</span>    ClearCompactionQueuesResponse.Builder respBuilder = ClearCompactionQueuesResponse.newBuilder();<a name="line.1732"></a>
-<span class="sourceLineNo">1733</span>    requestCount.increment();<a name="line.1733"></a>
-<span class="sourceLineNo">1734</span>    if (clearCompactionQueues.compareAndSet(false,true)) {<a name="line.1734"></a>
-<span class="sourceLineNo">1735</span>      try {<a name="line.1735"></a>
-<span class="sourceLineNo">1736</span>        checkOpen();<a name="line.1736"></a>
-<span class="sourceLineNo">1737</span>        regionServer.getRegionServerCoprocessorHost().preClearCompactionQueues();<a name="line.1737"></a>
-<span class="sourceLineNo">1738</span>        for (String queueName : request.getQueueNameList()) {<a name="line.1738"></a>
-<span class="sourceLineNo">1739</span>          LOG.debug("clear " + queueName + " compaction queue");<a name="line.1739"></a>
-<span class="sourceLineNo">1740</span>          switch (queueName) {<a name="line.1740"></a>
-<span class="sourceLineNo">1741</span>            case "long":<a name="line.1741"></a>
-<span class="sourceLineNo">1742</span>              regionServer.compactSplitThread.clearLongCompactionsQueue();<a name="line.1742"></a>
-<span class="sourceLineNo">1743</span>              break;<a name="line.1743"></a>
-<span class="sourceLineNo">1744</span>            case "short":<a name="line.1744"></a>
-<span class="sourceLineNo">1745</span>              regionServer.compactSplitThread.clearShortCompactionsQueue();<a name="line.1745"></a>
-<span class="sourceLineNo">1746</span>              break;<a name="line.1746"></a>
-<span class="sourceLineNo">1747</span>            default:<a name="line.1747"></a>
-<span class="sourceLineNo">1748</span>              LOG.warn("Unknown queue name " + queueName);<a name="line.1748"></a>
-<span class="sourceLineNo">1749</span>              throw new IOException("Unknown queue name " + queueName);<a name="line.1749"></a>
-<span class="sourceLineNo">1750</span>          }<a name="line.1750"></a>
-<span class="sourceLineNo">1751</span>        }<a name="line.1751"></a>
-<span class="sourceLineNo">1752</span>        regionServer.getRegionServerCoprocessorHost().postClearCompactionQueues();<a name="line.1752"></a>
-<span class="sourceLineNo">1753</span>      } catch (IOException ie) {<a name="line.1753"></a>
-<span class="sourceLineNo">1754</span>        throw new ServiceException(ie);<a name="line.1754"></a>
-<span class="sourceLineNo">1755</span>      } finally {<a name="line.1755"></a>
-<span class="sourceLineNo">1756</span>        clearCompactionQueues.set(false);<a name="line.1756"></a>
-<span class="sourceLineNo">1757</span>      }<a name="line.1757"></a>
-<span class="sourceLineNo">1758</span>    } else {<a name="line.1758"></a>
-<span class="sourceLineNo">1759</span>      LOG.warn("Clear compactions queue is executing by other admin.");<a name="line.1759"></a>
-<span class="sourceLineNo">1760</span>    }<a name="line.1760"></a>
-<span class="sourceLineNo">1761</span>    return respBuilder.build();<a name="line.1761"></a>
-<span class="sourceLineNo">1762</span>  }<a name="line.1762"></a>
-<span class="sourceLineNo">1763</span><a name="line.1763"></a>
-<span class="sourceLineNo">1764</span>  /**<a name="line.1764"></a>
-<span class="sourceLineNo">1765</span>   * Get some information of the region server.<a name="line.1765"></a>
-<span class="sourceLineNo">1766</span>   *<a name="line.1766"></a>
-<span class="sourceLineNo">1767</span>   * @param controller the RPC controller<a name="line.1767"></a>
-<span class="sourceLineNo">1768</span>   * @param request the request<a name="line.1768"></a>
-<span class="sourceLineNo">1769</span>   * @throws ServiceException<a name="line.1769"></a>
-<span class="sourceLineNo">1770</span>   */<a name="line.1770"></a>
-<span class="sourceLineNo">1771</span>  @Override<a name="line.1771"></a>
-<span class="sourceLineNo">1772</span>  @QosPriority(priority=HConstants.ADMIN_QOS)<a name="line.1772"></a>
-<span class="sourceLineNo">1773</span>  public GetServerInfoResponse getServerInfo(final RpcController controller,<a name="line.1773"></a>
-<span class="sourceLineNo">1774</span>      final GetServerInfoRequest request) throws ServiceException {<a name="line.1774"></a>
-<span class="sourceLineNo">1775</span>    try {<a name="line.1775"></a>
-<span class="sourceLineNo">1776</span>      checkOpen();<a name="line.1776"></a>
-<span class="sourceLineNo">1777</span>    } catch (IOException ie) {<a name="line.1777"></a>
-<span class="sourceLineNo">1778</span>      throw new ServiceException(ie);<a name="line.1778"></a>
-<span class="sourceLineNo">1779</span>    }<a name="line.1779"></a>
-<span class="sourceLineNo">1780</span>    requestCount.increment();<a name="line.1780"></a>
-<span class="sourceLineNo">1781</span>    int infoPort = regionServer.infoServer != null ? regionServer.infoServer.getPort() : -1;<a name="line.1781"></a>
-<span class="sourceLineNo">1782</span>    return ResponseConverter.buildGetServerInfoResponse(regionServer.serverName, infoPort);<a name="line.1782"></a>
-<span class="sourceLineNo">1783</span>  }<a name="line.1783"></a>
-<span class="sourceLineNo">1784</span><a name="line.1784"></a>
-<span class="sourceLineNo">1785</span>  @Override<a name="line.1785"></a>
-<span class="sourceLineNo">1786</span>  @QosPriority(priority=HConstants.ADMIN_QOS)<a name="line.1786"></a>
-<span class="sourceLineNo">1787</span>  public GetStoreFileResponse getStoreFile(final RpcController controller,<a name="line.1787"></a>
-<span class="sourceLineNo">1788</span>      final GetStoreFileRequest request) throws ServiceException {<a name="line.1788"></a>
-<span class="sourceLineNo">1789</span>    try {<a name="line.1789"></a>
-<span class="sourceLineNo">1790</span>      checkOpen();<a name="line.1790"></a>
-<span class="sourceLineNo">1791</span>      HRegion region = getRegion(request.getRegion());<a name="line.1791"></a>
-<span class="sourceLineNo">1792</span>      requestCount.increment();<a name="line.1792"></a>
-<span class="sourceLineNo">1793</span>      Set&lt;byte[]&gt; columnFamilies;<a name="line.1793"></a>
-<span class="sourceLineNo">1794</span>      if (request.getFamilyCount() == 0) {<a name="line.1794"></a>
-<span class="sourceLineNo">1795</span>        columnFamilies = region.getTableDescriptor().getColumnFamilyNames();<a name="line.1795"></a>
-<span class="sourceLineNo">1796</span>      } else {<a name="line.1796"></a>
-<span class="sourceLineNo">1797</span>        columnFamilies = new TreeSet&lt;&gt;(Bytes.BYTES_RAWCOMPARATOR);<a name="line.1797"></a>
-<span class="sourceLineNo">1798</span>        for (ByteString cf: request.getFamilyList()) {<a name="line.1798"></a>
-<span class="sourceLineNo">1799</span>          columnFamilies.add(cf.toByteArray());<a name="line.1799"></a>
-<span class="sourceLineNo">1800</span>        }<a name="line.1800"></a>
-<span class="sourceLineNo">1801</span>      }<a name="line.1801"></a>
-<span class="sourceLineNo">1802</span>      int nCF = columnFamilies.size();<a name="line.1802"></a>
-<span class="sourceLineNo">1803</span>      List&lt;String&gt;  fileList = region.getStoreFileList(<a name="line.1803"></a>
-<span class="sourceLineNo">1804</span>        columnFamilies.toArray(new byte[nCF][]));<a name="line.1804"></a>
-<span class="sourceLineNo">1805</span>      GetStoreFileResponse.Builder builder = GetStoreFileResponse.newBuilder();<a name="line.1805"></a>
-<span class="sourceLineNo">1806</span>      builder.addAllStoreFile(fileList);<a name="line.1806"></a>
-<span class="sourceLineNo">1807</span>      return builder.build();<a name="line.1807"></a>
-<span class="sourceLineNo">1808</span>    } catch (IOException ie) {<a name="line.1808"></a>
-<span class="sourceLineNo">1809</span>      throw new ServiceException(ie);<a name="line.1809"></a>
-<span class="sourceLineNo">1810</span>    }<a name="line.1810"></a>
-<span class="sourceLineNo">1811</span>  }<a name="line.1811"></a>
-<span class="sourceLineNo">1812</span><a name="line.1812"></a>
-<span class="sourceLineNo">1813</span>  /**<a name="line.1813"></a>
-<span class="sourceLineNo">1814</span>   * Open asynchronously a region or a set of regions on the region server.<a name="line.1814"></a>
-<span class="sourceLineNo">1815</span>   *<a name="line.1815"></a>
-<span class="sourceLineNo">1816</span>   * The opening is coordinated by ZooKeeper, and this method requires the znode to be created<a name="line.1816"></a>
-<span class="sourceLineNo">1817</span>   *  before being called. As a consequence, this method should be called only from the master.<a name="line.1817"></a>
-<span class="sourceLineNo">1818</span>   * &lt;p&gt;<a name="line.1818"></a>
-<span class="sourceLineNo">1819</span>   * Different manages states for the region are:<a name="line.1819"></a>
-<span class="sourceLineNo">1820</span>   * &lt;/p&gt;&lt;ul&gt;<a name="line.1820"></a>
-<span class="sourceLineNo">1821</span>   *  &lt;li&gt;region not opened: the region opening will start asynchronously.&lt;/li&gt;<a name="line.1821"></a>
-<span class="sourceLineNo">1822</span>   *  &lt;li&gt;a close is already in progress: this is considered as an error.&lt;/li&gt;<a name="line.1822"></a>
-<span class="sourceLineNo">1823</span>   *  &lt;li&gt;an open is already in progress: this new open request will be ignored. This is important<a name="line.1823"></a>
-<span class="sourceLineNo">1824</span>   *  because the Master can do multiple requests if it crashes.&lt;/li&gt;<a name="line.1824"></a>
-<span class="sourceLineNo">1825</span>   *  &lt;li&gt;the region is already opened:  this new open request will be ignored.&lt;/li&gt;<a name="line.1825"></a>
-<span class="sourceLineNo">1826</span>   *  &lt;/ul&gt;<a name="line.1826"></a>
-<span class="sourceLineNo">1827</span>   * &lt;p&gt;<a name="line.1827"></a>
-<span class="sourceLineNo">1828</span>   * Bulk assign: If there are more than 1 region to open, it will be considered as a bulk assign.<a name="line.1828"></a>
-<span class="sourceLineNo">1829</span>   * For a single region opening, errors are sent through a ServiceException. For bulk assign,<a name="line.1829"></a>
-<span class="sourceLineNo">1830</span>   * errors are put in the response as FAILED_OPENING.<a name="line.1830"></a>
-<span class="sourceLineNo">1831</span>   * &lt;/p&gt;<a name="line.1831"></a>
-<span class="sourceLineNo">1832</span>   * @param controller the RPC controller<a name="line.1832"></a>
-<span class="sourceLineNo">1833</span>   * @param request the request<a name="line.1833"></a>
-<span class="sourceLineNo">1834</span>   * @throws ServiceException<a name="line.1834"></a>
-<span class="sourceLineNo">1835</span>   */<a name="line.1835"></a>
-<span class="sourceLineNo">1836</span>  @Override<a name="line.1836"></a>
-<span class="sourceLineNo">1837</span>  @QosPriority(priority=HConstants.ADMIN_QOS)<a name="line.1837"></a>
-<span class="sourceLineNo">1838</span>  public OpenRegionResponse openRegion(final RpcController controller,<a name="line.1838"></a>
-<span class="sourceLineNo">1839</span>      final OpenRegionRequest request) throws ServiceException {<a name="line.1839"></a>
-<span class="sourceLineNo">1840</span>    requestCount.increment();<a name="line.1840"></a>
-<span class="sourceLineNo">1841</span>    if (request.hasServerStartCode()) {<a name="line.1841"></a>
-<span class="sourceLineNo">1842</span>      // check that we are the same server that this RPC is intended for.<a name="line.1842"></a>
-<span class="sourceLineNo">1843</span>      long serverStartCode = request.getServerStartCode();<a name="line.1843"></a>
-<span class="sourceLineNo">1844</span>      if (regionServer.serverName.getStartcode() !=  serverStartCode) {<a name="line.1844"></a>
-<span class="sourceLineNo">1845</span>        throw new ServiceException(new DoNotRetryIOException("This RPC was intended for a " +<a name="line.1845"></a>
-<span class="sourceLineNo">1846</span>            "different server with startCode: " + serverStartCode + ", this server is: "<a name="line.1846"></a>
-<span class="sourceLineNo">1847</span>            + regionServer.serverName));<a name="line.1847"></a>
-<span class="sourceLineNo">1848</span>      }<a name="line.1848"></a>
-<span class="sourceLineNo">1849</span>    }<a name="line.1849"></a>
-<span class="sourceLineNo">1850</span><a name="line.1850"></a>
-<span class="sourceLineNo">1851</span>    OpenRegionResponse.Builder builder = OpenRegionResponse.newBuilder();<a name="line.1851"></a>
-<span class="sourceLineNo">1852</span>    final int regionCount = request.getOpenInfoCount();<a name="line.1852"></a>
-<span class="sourceLineNo">1853</span>    final Map&lt;TableName, TableDescriptor&gt; htds = new HashMap&lt;&gt;(regionCount);<a name="line.1853"></a>
-<span class="sourceLineNo">1854</span>    final boolean isBulkAssign = regionCount &gt; 1;<a name="line.1854"></a>
-<span class="sourceLineNo">1855</span>    try {<a name="line.1855"></a>
-<span class="sourceLineNo">1856</span>      checkOpen();<a name="line.1856"></a>
-<span class="sourceLineNo">1857</span>    } catch (IOException ie) {<a name="line.1857"></a>
-<span class="sourceLineNo">1858</span>      TableName tableName = null;<a name="line.1858"></a>
-<span class="sourceLineNo">1859</span>      if (regionCount == 1) {<a name="line.1859"></a>
-<span class="sourceLineNo">1860</span>        org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.RegionInfo ri = request.getOpenInfo(0).getRegion();<a name="line.1860"></a>
-<span class="sourceLineNo">1861</span>        if (ri != null) {<a name="line.1861"></a>
-<span class="sourceLineNo">1862</span>          tableName = ProtobufUtil.toTableName(ri.getTableName());<a name="line.1862"></a>
-<span class="sourceLineNo">1863</span>        }<a name="line.1863"></a>
-<span class="sourceLineNo">1864</span>      }<a name="line.1864"></a>
-<span class="sourceLineNo">1865</span>      if (!TableName.META_TABLE_NAME.equals(tableName)) {<a name="line.1865"></a>
-<span class="sourceLineNo">1866</span>        throw new ServiceException(ie);<a name="line.1866"></a>
-<span class="sourceLineNo">1867</span>      }<a name="line.1867"></a>
-<span class="sourceLineNo">1868</span>      // We are assigning meta, wait a little for regionserver to finish initialization.<a name="line.1868"></a>
-<span class="sourceLineNo">1869</span>      int timeout = regionServer.conf.getInt(HConstants.HBASE_RPC_TIMEOUT_KEY,<a name="line.1869"></a>
-<span class="sourceLineNo">1870</span>        HConstants.DEFAULT_HBASE_RPC_TIMEOUT) &gt;&gt; 2; // Quarter of RPC timeout<a name="line.1870"></a>
-<span class="sourceLineNo">1871</span>      long endTime = System.currentTimeMillis() + timeout;<a name="line.1871"></a>
-<span class="sourceLineNo">1872</span>      synchronized (regionServer.online) {<a name="line.1872"></a>
-<span class="sourceLineNo">1873</span>        try {<a name="line.1873"></a>
-<span class="sourceLineNo">1874</span>          while (System.currentTimeMillis() &lt;= endTime<a name="line.1874"></a>
-<span class="sourceLineNo">1875</span>              &amp;&amp; !regionServer.isStopped() &amp;&amp; !regionServer.isOnline()) {<a name="line.1875"></a>
-<span class="sourceLineNo">1876</span>            regionServer.online.wait(regionServer.msgInterval);<a name="line.1876"></a>
-<span class="sourceLineNo">1877</span>          }<a name="line.1877"></a>
-<span class="sourceLineNo">1878</span>          checkOpen();<a name="line.1878"></a>
-<span class="sourceLineNo">1879</span>        } catch (InterruptedException t) {<a name="line.1879"></a>
-<span class="sourceLineNo">1880</span>          Thread.currentThread().interrupt();<a name="line.1880"></a>
-<span class="sourceLineNo">1881</span>          throw new ServiceException(t);<a name="line.1881"></a>
-<span class="sourceLineNo">1882</span>        } catch (IOException e) {<a name="line.1882"></a>
-<span class="sourceLineNo">1883</span>          throw new ServiceException(e);<a name="line.1883"></a>
-<span class="sourceLineNo">1884</span>        }<a name="line.1884"></a>
-<span class="sourceLineNo">1885</span>      }<a name="line.1885"></a>
-<span class="sourceLineNo">1886</span>    }<a name="line.1886"></a>
-<span class="sourceLineNo">1887</span><a name="line.1887"></a>
-<span class="sourceLineNo">1888</span>    long masterSystemTime = request.hasMasterSystemTime() ? request.getMasterSystemTime() : -1;<a name="line.1888"></a>
-<span class="sourceLineNo">1889</span><a name="line.1889"></a>
-<span class="sourceLineNo">1890</span>    for (RegionOpenInfo regionOpenInfo : request.getOpenInfoList()) {<a name="line.1890"></a>
-<span class="sourceLineNo">1891</span>      final RegionInfo region = ProtobufUtil.toRegionInfo(regionOpenInfo.getRegion());<a name="line.1891"></a>
-<span class="sourceLineNo">1892</span>      TableDescriptor htd;<a name="line.1892"></a>
-<span class="sourceLineNo">1893</span>      try {<a name="line.1893"></a>
-<span class="sourceLineNo">1894</span>        String encodedName = region.getEncodedName();<a name="line.1894"></a>
-<span class="sourceLineNo">1895</span>        byte[] encodedNameBytes = region.getEncodedNameAsBytes();<a name="line.1895"></a>
-<span class="sourceLineNo">1896</span>        final HRegion onlineRegion = regionServer.getRegion(encodedName);<a name="line.1896"></a>
-<span class="sourceLineNo">1897</span>        if (onlineRegion != null) {<a name="line.1897"></a>
-<span class="sourceLineNo">1898</span>          // The region is already online. This should not happen any more.<a name="line.1898"></a>
-<span class="sourceLineNo">1899</span>          String error = "Received OPEN for the region:"<a name="line.1899"></a>
-<span class="sourceLineNo">1900</span>            + region.getRegionNameAsString() + ", which is already online";<a name="line.1900"></a>
-<span class="sourceLineNo">1901</span>          LOG.warn(error);<a name="line.1901"></a>
-<span class="sourceLineNo">1902</span>          //regionServer.abort(error);<a name="line.1902"></a>
-<span class="sourceLineNo">1903</span>          //throw new IOException(error);<a name="line.1903"></a>
-<span class="sourceLineNo">1904</span>          builder.addOpeningState(RegionOpeningState.OPENED);<a name="line.1904"></a>
-<span class="sourceLineNo">1905</span>          continue;<a name="line.1905"></a>
-<span class="sourceLineNo">1906</span>        }<a name="line.1906"></a>
-<span class="sourceLineNo">1907</span>        LOG.info("Open " + region.getRegionNameAsString());<a name="line.1907"></a>
-<span class="sourceLineNo">1908</span><a name="line.1908"></a>
-<span class="sourceLineNo">1909</span>        final Boolean previous = regionServer.regionsInTransitionInRS.putIfAbsent(<a name="line.1909"></a>
-<span class="sourceLineNo">1910</span>          encodedNameBytes, Boolean.TRUE);<a name="line.1910"></a>
-<span class="sourceLineNo">1911</span><a name="line.1911"></a>
-<span class="sourceLineNo">1912</span>        if (Boolean.FALSE.equals(previous)) {<a name="line.1912"></a>
-<span class="sourceLineNo">1913</span>          if (regionServer.getRegion(encodedName) != null) {<a name="line.1913"></a>
-<span class="sourceLineNo">1914</span>            // There is a close in progress. This should not happen any more.<a name="line.1914"></a>
-<span class="sourceLineNo">1915</span>            String error = "Received OPEN for the region:"<a name="line.1915"></a>
-<span class="sourceLineNo">1916</span>              + region.getRegionNameAsString() + ", which we are already trying to CLOSE";<a name="line.1916"></a>
-<span class="sourceLineNo">1917</span>            regionServer.abort(error);<a name="line.1917"></a>
-<span class="sourceLineNo">1918</span>            throw new IOException(error);<a name="line.1918"></a>
-<span class="sourceLineNo">1919</span>          }<a name="line.1919"></a>
-<span class="sourceLineNo">1920</span>          regionServer.regionsInTransitionInRS.put(encodedNameBytes, Boolean.TRUE);<a name="line.1920"></a>
-<span class="sourceLineNo">1921</span>        }<a name="line.1921"></a>
-<span class="sourceLineNo">1922</span><a name="line.1922"></a>
-<span class="sourceLineNo">1923</span>        if (Boolean.TRUE.equals(previous)) {<a name="line.1923"></a>
-<span class="sourceLineNo">1924</span>          // An open is in progress. This is supported, but let's log this.<a name="line.1924"></a>
-<span class="sourceLineNo">1925</span>          LOG.info("Receiving OPEN for the region:" +<a name="line.1925"></a>
-<span class="sourceLineNo">1926</span>            region.getRegionNameAsString() + ", which we are already trying to OPEN"<a name="line.1926"></a>
-<span class="sourceLineNo">1927</span>              + " - ignoring this new request for this region.");<a name="line.1927"></a>
-<span class="sourceLineNo">1928</span>        }<a name="line.1928"></a>
-<span class="sourceLineNo">1929</span><a name="line.1929"></a>
-<span class="sourceLineNo">1930</span>        // We are opening this region. If it moves back and forth for whatever reason, we don't<a name="line.1930"></a>
-<span class="sourceLineNo">1931</span>        // want to keep returning the stale moved record while we are opening/if we close again.<a name="line.1931"></a>
-<span class="sourceLineNo">1932</span>        regionServer.removeFromMovedRegions(region.getEncodedName());<a name="line.1932"></a>
-<span class="sourceLineNo">1933</span><a name="line.1933"></a>
-<span class="sourceLineNo">1934</span>        if (previous == null || !previous.booleanValue()) {<a name="line.1934"></a>
-<span class="sourceLineNo">1935</span>          // check if the region to be opened is marked in recovering state in ZK<a name="line.1935"></a>
-<span class="sourceLineNo">1936</span>          if (ZKSplitLog.isRegionMarkedRecoveringInZK(regionServer.getZooKeeper(),<a name="line.1936"></a>
-<span class="sourceLineNo">1937</span>              region.getEncodedName())) {<a name="line.1937"></a>
-<span class="sourceLineNo">1938</span>            // Check if current region open is for distributedLogReplay. This check is to support<a name="line.1938"></a>
-<span class="sourceLineNo">1939</span>            // rolling restart/upgrade where we want to Master/RS see same configuration<a name="line.1939"></a>
-<span class="sourceLineNo">1940</span>            if (!regionOpenInfo.hasOpenForDistributedLogReplay()<a name="line.1940"></a>
-<span class="sourceLineNo">1941</span>                  || regionOpenInfo.getOpenForDistributedLogReplay()) {<a name="line.1941"></a>
-<span class="sourceLineNo">1942</span>              regionServer.recoveringRegions.put(region.getEncodedName(), null);<a name="line.1942"></a>
-<span class="sourceLineNo">1943</span>            } else {<a name="line.1943"></a>
-<span class="sourceLineNo">1944</span>              // Remove stale recovery region from ZK when we open region not for recovering which<a name="line.1944"></a>
-<span class="sourceLineNo">1945</span>              // could happen when turn distributedLogReplay off from on.<a name="line.1945"></a>
-<span class="sourceLineNo">1946</span>              List&lt;String&gt; tmpRegions = new ArrayList&lt;&gt;();<a name="line.1946"></a>
-<span class="sourceLineNo">1947</span>              tmpRegions.add(region.getEncodedName());<a name="line.1947"></a>
-<span class="sourceLineNo">1948</span>              ZKSplitLog.deleteRecoveringRegionZNodes(regionServer.getZooKeeper(),<a name="line.1948"></a>
-<span class="sourceLineNo">1949</span>                tmpRegions);<a name="line.1949"></a>
-<span class="sourceLineNo">1950</span>            }<a name="line.1950"></a>
-<span class="sourceLineNo">1951</span>          }<a name="line.1951"></a>
-<span class="sourceLineNo">1952</span>          htd = htds.get(region.getTable());<a name="line.1952"></a>
-<span class="sourceLineNo">1953</span>          if (htd == null) {<a name="line.1953"></a>
-<span class="sourceLineNo">1954</span>            htd = regionServer.tableDescriptors.get(region.getTable());<a name="line.1954"></a>
-<span class="sourceLineNo">1955</span>            htds.put(region.getTable(), htd);<a name="line.1955"></a>
-<span class="sourceLineNo">1956</span>          }<a name="line.1956"></a>
-<span class="sourceLineNo">1957</span>          if (htd == null) {<a name="line.1957"></a>
-<span class="sourceLineNo">1958</span>            throw new IOException("Missing table descriptor for " + region.getEncodedName());<a name="line.1958"></a>
-<span class="sourceLineNo">1959</span>          }<a name="line.1959"></a>
-<span class="sourceLineNo">1960</span>          // If there is no action in progress, we can submit a specific handler.<a name="line.1960"></a>
-<span class="sourceLineNo">1961</span>          // Need to pass the expected version in the constructor.<a name="line.1961"></a>
-<span class="sourceLineNo">1962</span>          if (regionServer.executorService == null) {<a name="line.1962"></a>
-<span class="sourceLineNo">1963</span>            LOG.info("No executor executorService; skipping open request");<a name="line.1963"></a>
-<span class="sourceLineNo">1964</span>          } else {<a name="line.1964"></a>
-<span class="sourceLineNo">1965</span>            if (region.isMetaRegion()) {<a name="line.1965"></a>
-<span class="sourceLineNo">1966</span>              regionServer.executorService.submit(new OpenMetaHandler(<a name="line.1966"></a>
-<span class="sourceLineNo">1967</span>              regionServer, regionServer, region, htd, masterSystemTime));<a name="line.1967"></a>
-<span class="sourceLineNo">1968</span>            } else {<a name="line.1968"></a>
-<span class="sourceLineNo">1969</span>              if (regionOpenInfo.getFavoredNodesCount() &gt; 0) {<a name="line.1969"></a>
-<span class="sourceLineNo">1970</span>                regionServer.updateRegionFavoredNodesMapping(region.getEncodedName(),<a name="line.1970"></a>
-<span class="sourceLineNo">1971</span>                regionOpenInfo.getFavoredNodesList());<a name="line.1971"></a>
-<span class="sourceLineNo">1972</span>              }<a name="line.1972"></a>
-<span class="sourceLineNo">1973</span>              if (htd.getPriority() &gt;= HConstants.ADMIN_QOS || region.getTable().isSystemTable()) {<a name="line.1973"></a>
-<span class="sourceLineNo">1974</span>                regionServer.executorService.submit(new OpenPriorityRegionHandler(<a name="line.1974"></a>
-<span class="sourceLineNo">1975</span>                regionServer, regionServer, region, htd, masterSystemTime));<a name="line.1975"></a>
-<span class="sourceLineNo">1976</span>              } else {<a name="line.1976"></a>
-<span class="sourceLineNo">1977</span>                regionServer.executorService.submit(new OpenRegionHandler(<a name="line.1977"></a>
-<span class="sourceLineNo">1978</span>                regionServer, regionServer, region, htd, masterSystemTime));<a name="line.1978"></a>
-<span class="sourceLineNo">1979</span>              }<a name="line.1979"></a>
-<span class="sourceLineNo">1980</span>            }<a name="line.1980"></a>
-<span class="sourceLineNo">1981</span>          }<a name="line.1981"></a>
-<span class="sourceLineNo">1982</span>        }<a name="line.1982"></a>
-<span class="sourceLineNo">1983</span><a name="line.1983"></a>
-<span class="sourceLineNo">1984</span>        builder.addOpeningState(RegionOpeningState.OPENED);<a name="line.1984"></a>
-<span class="sourceLineNo">1985</span><a name="line.1985"></a>
-<span class="sourceLineNo">1986</span>      } catch (KeeperException zooKeeperEx) {<a name="line.1986"></a>
-<span class="sourceLineNo">1987</span>        LOG.error("Can't retrieve recovering state from zookeeper", zooKeeperEx);<a name="line.1987"></a>
-<span class="sourceLineNo">1988</span>        throw new ServiceException(zooKeeper

<TRUNCATED>

Mime
View raw message