hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mi...@apache.org
Subject [02/51] [partial] hbase-site git commit: Published site at 18eff3c1c337003b2a419490e621f931d16936fb.
Date Fri, 05 Feb 2016 04:32:12 GMT
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/a8725a46/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/RSRpcServices.RegionScannersCloseCallBack.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/RSRpcServices.RegionScannersCloseCallBack.html b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/RSRpcServices.RegionScannersCloseCallBack.html
index 4434339..0a8fce1 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/RSRpcServices.RegionScannersCloseCallBack.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/RSRpcServices.RegionScannersCloseCallBack.html
@@ -1155,1706 +1155,1717 @@
 <span class="sourceLineNo">1147</span>   */<a name="line.1147"></a>
 <span class="sourceLineNo">1148</span>  Region getRegion(<a name="line.1148"></a>
 <span class="sourceLineNo">1149</span>      final RegionSpecifier regionSpecifier) throws IOException {<a name="line.1149"></a>
-<span class="sourceLineNo">1150</span>    return regionServer.getRegionByEncodedName(regionSpecifier.getValue().toByteArray(),<a name="line.1150"></a>
-<span class="sourceLineNo">1151</span>        ProtobufUtil.getRegionEncodedName(regionSpecifier));<a name="line.1151"></a>
-<span class="sourceLineNo">1152</span>  }<a name="line.1152"></a>
-<span class="sourceLineNo">1153</span><a name="line.1153"></a>
-<span class="sourceLineNo">1154</span>  @VisibleForTesting<a name="line.1154"></a>
-<span class="sourceLineNo">1155</span>  public PriorityFunction getPriority() {<a name="line.1155"></a>
-<span class="sourceLineNo">1156</span>    return priority;<a name="line.1156"></a>
-<span class="sourceLineNo">1157</span>  }<a name="line.1157"></a>
-<span class="sourceLineNo">1158</span><a name="line.1158"></a>
-<span class="sourceLineNo">1159</span>  @VisibleForTesting<a name="line.1159"></a>
-<span class="sourceLineNo">1160</span>  public Configuration getConfiguration() {<a name="line.1160"></a>
-<span class="sourceLineNo">1161</span>    return regionServer.getConfiguration();<a name="line.1161"></a>
-<span class="sourceLineNo">1162</span>  }<a name="line.1162"></a>
-<span class="sourceLineNo">1163</span><a name="line.1163"></a>
-<span class="sourceLineNo">1164</span>  private RegionServerQuotaManager getQuotaManager() {<a name="line.1164"></a>
-<span class="sourceLineNo">1165</span>    return regionServer.getRegionServerQuotaManager();<a name="line.1165"></a>
-<span class="sourceLineNo">1166</span>  }<a name="line.1166"></a>
-<span class="sourceLineNo">1167</span><a name="line.1167"></a>
-<span class="sourceLineNo">1168</span>  void start() {<a name="line.1168"></a>
-<span class="sourceLineNo">1169</span>    rpcServer.start();<a name="line.1169"></a>
-<span class="sourceLineNo">1170</span>  }<a name="line.1170"></a>
-<span class="sourceLineNo">1171</span><a name="line.1171"></a>
-<span class="sourceLineNo">1172</span>  void stop() {<a name="line.1172"></a>
-<span class="sourceLineNo">1173</span>    closeAllScanners();<a name="line.1173"></a>
-<span class="sourceLineNo">1174</span>    rpcServer.stop();<a name="line.1174"></a>
-<span class="sourceLineNo">1175</span>  }<a name="line.1175"></a>
-<span class="sourceLineNo">1176</span><a name="line.1176"></a>
-<span class="sourceLineNo">1177</span>  /**<a name="line.1177"></a>
-<span class="sourceLineNo">1178</span>   * Called to verify that this server is up and running.<a name="line.1178"></a>
-<span class="sourceLineNo">1179</span>   *<a name="line.1179"></a>
-<span class="sourceLineNo">1180</span>   * @throws IOException<a name="line.1180"></a>
-<span class="sourceLineNo">1181</span>   */<a name="line.1181"></a>
-<span class="sourceLineNo">1182</span>  protected void checkOpen() throws IOException {<a name="line.1182"></a>
-<span class="sourceLineNo">1183</span>    if (regionServer.isAborted()) {<a name="line.1183"></a>
-<span class="sourceLineNo">1184</span>      throw new RegionServerAbortedException("Server " + regionServer.serverName + " aborting");<a name="line.1184"></a>
-<span class="sourceLineNo">1185</span>    }<a name="line.1185"></a>
-<span class="sourceLineNo">1186</span>    if (regionServer.isStopped()) {<a name="line.1186"></a>
-<span class="sourceLineNo">1187</span>      throw new RegionServerStoppedException("Server " + regionServer.serverName + " stopping");<a name="line.1187"></a>
-<span class="sourceLineNo">1188</span>    }<a name="line.1188"></a>
-<span class="sourceLineNo">1189</span>    if (!regionServer.fsOk) {<a name="line.1189"></a>
-<span class="sourceLineNo">1190</span>      throw new RegionServerStoppedException("File system not available");<a name="line.1190"></a>
-<span class="sourceLineNo">1191</span>    }<a name="line.1191"></a>
-<span class="sourceLineNo">1192</span>    if (!regionServer.isOnline()) {<a name="line.1192"></a>
-<span class="sourceLineNo">1193</span>      throw new ServerNotRunningYetException("Server is not running yet");<a name="line.1193"></a>
-<span class="sourceLineNo">1194</span>    }<a name="line.1194"></a>
-<span class="sourceLineNo">1195</span>  }<a name="line.1195"></a>
-<span class="sourceLineNo">1196</span><a name="line.1196"></a>
-<span class="sourceLineNo">1197</span>  /**<a name="line.1197"></a>
-<span class="sourceLineNo">1198</span>   * @return list of blocking services and their security info classes that this server supports<a name="line.1198"></a>
-<span class="sourceLineNo">1199</span>   */<a name="line.1199"></a>
-<span class="sourceLineNo">1200</span>  protected List&lt;BlockingServiceAndInterface&gt; getServices() {<a name="line.1200"></a>
-<span class="sourceLineNo">1201</span>    List&lt;BlockingServiceAndInterface&gt; bssi = new ArrayList&lt;BlockingServiceAndInterface&gt;(2);<a name="line.1201"></a>
-<span class="sourceLineNo">1202</span>    bssi.add(new BlockingServiceAndInterface(<a name="line.1202"></a>
-<span class="sourceLineNo">1203</span>      ClientService.newReflectiveBlockingService(this),<a name="line.1203"></a>
-<span class="sourceLineNo">1204</span>      ClientService.BlockingInterface.class));<a name="line.1204"></a>
-<span class="sourceLineNo">1205</span>    bssi.add(new BlockingServiceAndInterface(<a name="line.1205"></a>
-<span class="sourceLineNo">1206</span>      AdminService.newReflectiveBlockingService(this),<a name="line.1206"></a>
-<span class="sourceLineNo">1207</span>      AdminService.BlockingInterface.class));<a name="line.1207"></a>
-<span class="sourceLineNo">1208</span>    return bssi;<a name="line.1208"></a>
-<span class="sourceLineNo">1209</span>  }<a name="line.1209"></a>
-<span class="sourceLineNo">1210</span><a name="line.1210"></a>
-<span class="sourceLineNo">1211</span>  public InetSocketAddress getSocketAddress() {<a name="line.1211"></a>
-<span class="sourceLineNo">1212</span>    return isa;<a name="line.1212"></a>
-<span class="sourceLineNo">1213</span>  }<a name="line.1213"></a>
-<span class="sourceLineNo">1214</span><a name="line.1214"></a>
-<span class="sourceLineNo">1215</span>  @Override<a name="line.1215"></a>
-<span class="sourceLineNo">1216</span>  public int getPriority(RequestHeader header, Message param, User user) {<a name="line.1216"></a>
-<span class="sourceLineNo">1217</span>    return priority.getPriority(header, param, user);<a name="line.1217"></a>
-<span class="sourceLineNo">1218</span>  }<a name="line.1218"></a>
-<span class="sourceLineNo">1219</span><a name="line.1219"></a>
-<span class="sourceLineNo">1220</span>  @Override<a name="line.1220"></a>
-<span class="sourceLineNo">1221</span>  public long getDeadline(RequestHeader header, Message param) {<a name="line.1221"></a>
-<span class="sourceLineNo">1222</span>    return priority.getDeadline(header, param);<a name="line.1222"></a>
-<span class="sourceLineNo">1223</span>  }<a name="line.1223"></a>
-<span class="sourceLineNo">1224</span><a name="line.1224"></a>
-<span class="sourceLineNo">1225</span>  /*<a name="line.1225"></a>
-<span class="sourceLineNo">1226</span>   * Check if an OOME and, if so, abort immediately to avoid creating more objects.<a name="line.1226"></a>
-<span class="sourceLineNo">1227</span>   *<a name="line.1227"></a>
-<span class="sourceLineNo">1228</span>   * @param e<a name="line.1228"></a>
-<span class="sourceLineNo">1229</span>   *<a name="line.1229"></a>
-<span class="sourceLineNo">1230</span>   * @return True if we OOME'd and are aborting.<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 boolean checkOOME(final Throwable e) {<a name="line.1233"></a>
-<span class="sourceLineNo">1234</span>    boolean stop = false;<a name="line.1234"></a>
-<span class="sourceLineNo">1235</span>    try {<a name="line.1235"></a>
-<span class="sourceLineNo">1236</span>      if (e instanceof OutOfMemoryError<a name="line.1236"></a>
-<span class="sourceLineNo">1237</span>          || (e.getCause() != null &amp;&amp; e.getCause() instanceof OutOfMemoryError)<a name="line.1237"></a>
-<span class="sourceLineNo">1238</span>          || (e.getMessage() != null &amp;&amp; e.getMessage().contains(<a name="line.1238"></a>
-<span class="sourceLineNo">1239</span>              "java.lang.OutOfMemoryError"))) {<a name="line.1239"></a>
-<span class="sourceLineNo">1240</span>        stop = true;<a name="line.1240"></a>
-<span class="sourceLineNo">1241</span>        LOG.fatal("Run out of memory; " + getClass().getSimpleName()<a name="line.1241"></a>
-<span class="sourceLineNo">1242</span>          + " will abort itself immediately", e);<a name="line.1242"></a>
-<span class="sourceLineNo">1243</span>      }<a name="line.1243"></a>
-<span class="sourceLineNo">1244</span>    } finally {<a name="line.1244"></a>
-<span class="sourceLineNo">1245</span>      if (stop) {<a name="line.1245"></a>
-<span class="sourceLineNo">1246</span>        Runtime.getRuntime().halt(1);<a name="line.1246"></a>
-<span class="sourceLineNo">1247</span>      }<a name="line.1247"></a>
-<span class="sourceLineNo">1248</span>    }<a name="line.1248"></a>
-<span class="sourceLineNo">1249</span>    return stop;<a name="line.1249"></a>
-<span class="sourceLineNo">1250</span>  }<a name="line.1250"></a>
-<span class="sourceLineNo">1251</span><a name="line.1251"></a>
-<span class="sourceLineNo">1252</span>  /**<a name="line.1252"></a>
-<span class="sourceLineNo">1253</span>   * Close a region on the region server.<a name="line.1253"></a>
-<span class="sourceLineNo">1254</span>   *<a name="line.1254"></a>
-<span class="sourceLineNo">1255</span>   * @param controller the RPC controller<a name="line.1255"></a>
-<span class="sourceLineNo">1256</span>   * @param request the request<a name="line.1256"></a>
-<span class="sourceLineNo">1257</span>   * @throws ServiceException<a name="line.1257"></a>
-<span class="sourceLineNo">1258</span>   */<a name="line.1258"></a>
-<span class="sourceLineNo">1259</span>  @Override<a name="line.1259"></a>
-<span class="sourceLineNo">1260</span>  @QosPriority(priority=HConstants.ADMIN_QOS)<a name="line.1260"></a>
-<span class="sourceLineNo">1261</span>  public CloseRegionResponse closeRegion(final RpcController controller,<a name="line.1261"></a>
-<span class="sourceLineNo">1262</span>      final CloseRegionRequest request) throws ServiceException {<a name="line.1262"></a>
-<span class="sourceLineNo">1263</span>    final ServerName sn = (request.hasDestinationServer() ?<a name="line.1263"></a>
-<span class="sourceLineNo">1264</span>      ProtobufUtil.toServerName(request.getDestinationServer()) : null);<a name="line.1264"></a>
-<span class="sourceLineNo">1265</span><a name="line.1265"></a>
-<span class="sourceLineNo">1266</span>    try {<a name="line.1266"></a>
-<span class="sourceLineNo">1267</span>      checkOpen();<a name="line.1267"></a>
-<span class="sourceLineNo">1268</span>      if (request.hasServerStartCode()) {<a name="line.1268"></a>
-<span class="sourceLineNo">1269</span>        // check that we are the same server that this RPC is intended for.<a name="line.1269"></a>
-<span class="sourceLineNo">1270</span>        long serverStartCode = request.getServerStartCode();<a name="line.1270"></a>
-<span class="sourceLineNo">1271</span>        if (regionServer.serverName.getStartcode() !=  serverStartCode) {<a name="line.1271"></a>
-<span class="sourceLineNo">1272</span>          throw new ServiceException(new DoNotRetryIOException("This RPC was intended for a " +<a name="line.1272"></a>
-<span class="sourceLineNo">1273</span>              "different server with startCode: " + serverStartCode + ", this server is: "<a name="line.1273"></a>
-<span class="sourceLineNo">1274</span>              + regionServer.serverName));<a name="line.1274"></a>
-<span class="sourceLineNo">1275</span>        }<a name="line.1275"></a>
-<span class="sourceLineNo">1276</span>      }<a name="line.1276"></a>
-<span class="sourceLineNo">1277</span>      final String encodedRegionName = ProtobufUtil.getRegionEncodedName(request.getRegion());<a name="line.1277"></a>
-<span class="sourceLineNo">1278</span><a name="line.1278"></a>
-<span class="sourceLineNo">1279</span>      // Can be null if we're calling close on a region that's not online<a name="line.1279"></a>
-<span class="sourceLineNo">1280</span>      final Region region = regionServer.getFromOnlineRegions(encodedRegionName);<a name="line.1280"></a>
-<span class="sourceLineNo">1281</span>      if ((region  != null) &amp;&amp; (region .getCoprocessorHost() != null)) {<a name="line.1281"></a>
-<span class="sourceLineNo">1282</span>        region.getCoprocessorHost().preClose(false);<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>      requestCount.increment();<a name="line.1285"></a>
-<span class="sourceLineNo">1286</span>      LOG.info("Close " + encodedRegionName + ", moving to " + sn);<a name="line.1286"></a>
-<span class="sourceLineNo">1287</span>      boolean closed = regionServer.closeRegion(encodedRegionName, false, sn);<a name="line.1287"></a>
-<span class="sourceLineNo">1288</span>      CloseRegionResponse.Builder builder = CloseRegionResponse.newBuilder().setClosed(closed);<a name="line.1288"></a>
-<span class="sourceLineNo">1289</span>      return builder.build();<a name="line.1289"></a>
-<span class="sourceLineNo">1290</span>    } catch (IOException ie) {<a name="line.1290"></a>
-<span class="sourceLineNo">1291</span>      throw new ServiceException(ie);<a name="line.1291"></a>
-<span class="sourceLineNo">1292</span>    }<a name="line.1292"></a>
-<span class="sourceLineNo">1293</span>  }<a name="line.1293"></a>
-<span class="sourceLineNo">1294</span><a name="line.1294"></a>
-<span class="sourceLineNo">1295</span>  /**<a name="line.1295"></a>
-<span class="sourceLineNo">1296</span>   * Compact a region on the region server.<a name="line.1296"></a>
-<span class="sourceLineNo">1297</span>   *<a name="line.1297"></a>
-<span class="sourceLineNo">1298</span>   * @param controller the RPC controller<a name="line.1298"></a>
-<span class="sourceLineNo">1299</span>   * @param request the request<a name="line.1299"></a>
-<span class="sourceLineNo">1300</span>   * @throws ServiceException<a name="line.1300"></a>
-<span class="sourceLineNo">1301</span>   */<a name="line.1301"></a>
-<span class="sourceLineNo">1302</span>  @Override<a name="line.1302"></a>
-<span class="sourceLineNo">1303</span>  @QosPriority(priority=HConstants.ADMIN_QOS)<a name="line.1303"></a>
-<span class="sourceLineNo">1304</span>  public CompactRegionResponse compactRegion(final RpcController controller,<a name="line.1304"></a>
-<span class="sourceLineNo">1305</span>      final CompactRegionRequest request) throws ServiceException {<a name="line.1305"></a>
-<span class="sourceLineNo">1306</span>    try {<a name="line.1306"></a>
-<span class="sourceLineNo">1307</span>      checkOpen();<a name="line.1307"></a>
-<span class="sourceLineNo">1308</span>      requestCount.increment();<a name="line.1308"></a>
-<span class="sourceLineNo">1309</span>      Region region = getRegion(request.getRegion());<a name="line.1309"></a>
-<span class="sourceLineNo">1310</span>      region.startRegionOperation(Operation.COMPACT_REGION);<a name="line.1310"></a>
-<span class="sourceLineNo">1311</span>      LOG.info("Compacting " + region.getRegionInfo().getRegionNameAsString());<a name="line.1311"></a>
-<span class="sourceLineNo">1312</span>      boolean major = false;<a name="line.1312"></a>
-<span class="sourceLineNo">1313</span>      byte [] family = null;<a name="line.1313"></a>
-<span class="sourceLineNo">1314</span>      Store store = null;<a name="line.1314"></a>
-<span class="sourceLineNo">1315</span>      if (request.hasFamily()) {<a name="line.1315"></a>
-<span class="sourceLineNo">1316</span>        family = request.getFamily().toByteArray();<a name="line.1316"></a>
-<span class="sourceLineNo">1317</span>        store = region.getStore(family);<a name="line.1317"></a>
-<span class="sourceLineNo">1318</span>        if (store == null) {<a name="line.1318"></a>
-<span class="sourceLineNo">1319</span>          throw new ServiceException(new IOException("column family " + Bytes.toString(family)<a name="line.1319"></a>
-<span class="sourceLineNo">1320</span>            + " does not exist in region " + region.getRegionInfo().getRegionNameAsString()));<a name="line.1320"></a>
-<span class="sourceLineNo">1321</span>        }<a name="line.1321"></a>
-<span class="sourceLineNo">1322</span>      }<a name="line.1322"></a>
-<span class="sourceLineNo">1323</span>      if (request.hasMajor()) {<a name="line.1323"></a>
-<span class="sourceLineNo">1324</span>        major = request.getMajor();<a name="line.1324"></a>
-<span class="sourceLineNo">1325</span>      }<a name="line.1325"></a>
-<span class="sourceLineNo">1326</span>      if (major) {<a name="line.1326"></a>
-<span class="sourceLineNo">1327</span>        if (family != null) {<a name="line.1327"></a>
-<span class="sourceLineNo">1328</span>          store.triggerMajorCompaction();<a name="line.1328"></a>
-<span class="sourceLineNo">1329</span>        } else {<a name="line.1329"></a>
-<span class="sourceLineNo">1330</span>          region.triggerMajorCompaction();<a name="line.1330"></a>
-<span class="sourceLineNo">1331</span>        }<a name="line.1331"></a>
-<span class="sourceLineNo">1332</span>      }<a name="line.1332"></a>
-<span class="sourceLineNo">1333</span><a name="line.1333"></a>
-<span class="sourceLineNo">1334</span>      String familyLogMsg = (family != null)?" for column family: " + Bytes.toString(family):"";<a name="line.1334"></a>
-<span class="sourceLineNo">1335</span>      if (LOG.isTraceEnabled()) {<a name="line.1335"></a>
-<span class="sourceLineNo">1336</span>        LOG.trace("User-triggered compaction requested for region "<a name="line.1336"></a>
-<span class="sourceLineNo">1337</span>          + region.getRegionInfo().getRegionNameAsString() + familyLogMsg);<a name="line.1337"></a>
-<span class="sourceLineNo">1338</span>      }<a name="line.1338"></a>
-<span class="sourceLineNo">1339</span>      String log = "User-triggered " + (major ? "major " : "") + "compaction" + familyLogMsg;<a name="line.1339"></a>
-<span class="sourceLineNo">1340</span>      if(family != null) {<a name="line.1340"></a>
-<span class="sourceLineNo">1341</span>        regionServer.compactSplitThread.requestCompaction(region, store, log,<a name="line.1341"></a>
-<span class="sourceLineNo">1342</span>          Store.PRIORITY_USER, null, RpcServer.getRequestUser());<a name="line.1342"></a>
-<span class="sourceLineNo">1343</span>      } else {<a name="line.1343"></a>
-<span class="sourceLineNo">1344</span>        regionServer.compactSplitThread.requestCompaction(region, log,<a name="line.1344"></a>
-<span class="sourceLineNo">1345</span>          Store.PRIORITY_USER, null, RpcServer.getRequestUser());<a name="line.1345"></a>
-<span class="sourceLineNo">1346</span>      }<a name="line.1346"></a>
-<span class="sourceLineNo">1347</span>      return CompactRegionResponse.newBuilder().build();<a name="line.1347"></a>
-<span class="sourceLineNo">1348</span>    } catch (IOException ie) {<a name="line.1348"></a>
-<span class="sourceLineNo">1349</span>      throw new ServiceException(ie);<a name="line.1349"></a>
-<span class="sourceLineNo">1350</span>    }<a name="line.1350"></a>
-<span class="sourceLineNo">1351</span>  }<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>   * Flush a region on the region server.<a name="line.1354"></a>
-<span class="sourceLineNo">1355</span>   *<a name="line.1355"></a>
-<span class="sourceLineNo">1356</span>   * @param controller the RPC controller<a name="line.1356"></a>
-<span class="sourceLineNo">1357</span>   * @param request the request<a name="line.1357"></a>
-<span class="sourceLineNo">1358</span>   * @throws ServiceException<a name="line.1358"></a>
-<span class="sourceLineNo">1359</span>   */<a name="line.1359"></a>
-<span class="sourceLineNo">1360</span>  @Override<a name="line.1360"></a>
-<span class="sourceLineNo">1361</span>  @QosPriority(priority=HConstants.ADMIN_QOS)<a name="line.1361"></a>
-<span class="sourceLineNo">1362</span>  public FlushRegionResponse flushRegion(final RpcController controller,<a name="line.1362"></a>
-<span class="sourceLineNo">1363</span>      final FlushRegionRequest request) throws ServiceException {<a name="line.1363"></a>
-<span class="sourceLineNo">1364</span>    try {<a name="line.1364"></a>
-<span class="sourceLineNo">1365</span>      checkOpen();<a name="line.1365"></a>
-<span class="sourceLineNo">1366</span>      requestCount.increment();<a name="line.1366"></a>
-<span class="sourceLineNo">1367</span>      Region region = getRegion(request.getRegion());<a name="line.1367"></a>
-<span class="sourceLineNo">1368</span>      LOG.info("Flushing " + region.getRegionInfo().getRegionNameAsString());<a name="line.1368"></a>
-<span class="sourceLineNo">1369</span>      boolean shouldFlush = true;<a name="line.1369"></a>
-<span class="sourceLineNo">1370</span>      if (request.hasIfOlderThanTs()) {<a name="line.1370"></a>
-<span class="sourceLineNo">1371</span>        shouldFlush = region.getEarliestFlushTimeForAllStores() &lt; request.getIfOlderThanTs();<a name="line.1371"></a>
-<span class="sourceLineNo">1372</span>      }<a name="line.1372"></a>
-<span class="sourceLineNo">1373</span>      FlushRegionResponse.Builder builder = FlushRegionResponse.newBuilder();<a name="line.1373"></a>
-<span class="sourceLineNo">1374</span>      if (shouldFlush) {<a name="line.1374"></a>
-<span class="sourceLineNo">1375</span>        boolean writeFlushWalMarker =  request.hasWriteFlushWalMarker() ?<a name="line.1375"></a>
-<span class="sourceLineNo">1376</span>            request.getWriteFlushWalMarker() : false;<a name="line.1376"></a>
-<span class="sourceLineNo">1377</span>        long startTime = EnvironmentEdgeManager.currentTime();<a name="line.1377"></a>
-<span class="sourceLineNo">1378</span>        // Go behind the curtain so we can manage writing of the flush WAL marker<a name="line.1378"></a>
-<span class="sourceLineNo">1379</span>        HRegion.FlushResultImpl flushResult = (HRegion.FlushResultImpl)<a name="line.1379"></a>
-<span class="sourceLineNo">1380</span>            ((HRegion)region).flushcache(true, writeFlushWalMarker);<a name="line.1380"></a>
-<span class="sourceLineNo">1381</span>        if (flushResult.isFlushSucceeded()) {<a name="line.1381"></a>
-<span class="sourceLineNo">1382</span>          long endTime = EnvironmentEdgeManager.currentTime();<a name="line.1382"></a>
-<span class="sourceLineNo">1383</span>          regionServer.metricsRegionServer.updateFlushTime(endTime - startTime);<a name="line.1383"></a>
-<span class="sourceLineNo">1384</span>        }<a name="line.1384"></a>
-<span class="sourceLineNo">1385</span>        boolean compactionNeeded = flushResult.isCompactionNeeded();<a name="line.1385"></a>
-<span class="sourceLineNo">1386</span>        if (compactionNeeded) {<a name="line.1386"></a>
-<span class="sourceLineNo">1387</span>          regionServer.compactSplitThread.requestSystemCompaction(region,<a name="line.1387"></a>
-<span class="sourceLineNo">1388</span>            "Compaction through user triggered flush");<a name="line.1388"></a>
-<span class="sourceLineNo">1389</span>        }<a name="line.1389"></a>
-<span class="sourceLineNo">1390</span>        builder.setFlushed(flushResult.isFlushSucceeded());<a name="line.1390"></a>
-<span class="sourceLineNo">1391</span>        builder.setWroteFlushWalMarker(flushResult.wroteFlushWalMarker);<a name="line.1391"></a>
-<span class="sourceLineNo">1392</span>      }<a name="line.1392"></a>
-<span class="sourceLineNo">1393</span>      builder.setLastFlushTime(region.getEarliestFlushTimeForAllStores());<a name="line.1393"></a>
-<span class="sourceLineNo">1394</span>      return builder.build();<a name="line.1394"></a>
-<span class="sourceLineNo">1395</span>    } catch (DroppedSnapshotException ex) {<a name="line.1395"></a>
-<span class="sourceLineNo">1396</span>      // Cache flush can fail in a few places. If it fails in a critical<a name="line.1396"></a>
-<span class="sourceLineNo">1397</span>      // section, we get a DroppedSnapshotException and a replay of wal<a name="line.1397"></a>
-<span class="sourceLineNo">1398</span>      // is required. Currently the only way to do this is a restart of<a name="line.1398"></a>
-<span class="sourceLineNo">1399</span>      // the server.<a name="line.1399"></a>
-<span class="sourceLineNo">1400</span>      regionServer.abort("Replay of WAL required. Forcing server shutdown", ex);<a name="line.1400"></a>
-<span class="sourceLineNo">1401</span>      throw new ServiceException(ex);<a name="line.1401"></a>
-<span class="sourceLineNo">1402</span>    } catch (IOException ie) {<a name="line.1402"></a>
-<span class="sourceLineNo">1403</span>      throw new ServiceException(ie);<a name="line.1403"></a>
-<span class="sourceLineNo">1404</span>    }<a name="line.1404"></a>
-<span class="sourceLineNo">1405</span>  }<a name="line.1405"></a>
-<span class="sourceLineNo">1406</span><a name="line.1406"></a>
-<span class="sourceLineNo">1407</span>  @Override<a name="line.1407"></a>
-<span class="sourceLineNo">1408</span>  @QosPriority(priority=HConstants.ADMIN_QOS)<a name="line.1408"></a>
-<span class="sourceLineNo">1409</span>  public GetOnlineRegionResponse getOnlineRegion(final RpcController controller,<a name="line.1409"></a>
-<span class="sourceLineNo">1410</span>      final GetOnlineRegionRequest request) throws ServiceException {<a name="line.1410"></a>
-<span class="sourceLineNo">1411</span>    try {<a name="line.1411"></a>
-<span class="sourceLineNo">1412</span>      checkOpen();<a name="line.1412"></a>
-<span class="sourceLineNo">1413</span>      requestCount.increment();<a name="line.1413"></a>
-<span class="sourceLineNo">1414</span>      Map&lt;String, Region&gt; onlineRegions = regionServer.onlineRegions;<a name="line.1414"></a>
-<span class="sourceLineNo">1415</span>      List&lt;HRegionInfo&gt; list = new ArrayList&lt;HRegionInfo&gt;(onlineRegions.size());<a name="line.1415"></a>
-<span class="sourceLineNo">1416</span>      for (Region region: onlineRegions.values()) {<a name="line.1416"></a>
-<span class="sourceLineNo">1417</span>        list.add(region.getRegionInfo());<a name="line.1417"></a>
-<span class="sourceLineNo">1418</span>      }<a name="line.1418"></a>
-<span class="sourceLineNo">1419</span>      Collections.sort(list);<a name="line.1419"></a>
-<span class="sourceLineNo">1420</span>      return ResponseConverter.buildGetOnlineRegionResponse(list);<a name="line.1420"></a>
-<span class="sourceLineNo">1421</span>    } catch (IOException ie) {<a name="line.1421"></a>
-<span class="sourceLineNo">1422</span>      throw new ServiceException(ie);<a name="line.1422"></a>
-<span class="sourceLineNo">1423</span>    }<a name="line.1423"></a>
-<span class="sourceLineNo">1424</span>  }<a name="line.1424"></a>
-<span class="sourceLineNo">1425</span><a name="line.1425"></a>
-<span class="sourceLineNo">1426</span>  @Override<a name="line.1426"></a>
-<span class="sourceLineNo">1427</span>  @QosPriority(priority=HConstants.ADMIN_QOS)<a name="line.1427"></a>
-<span class="sourceLineNo">1428</span>  public GetRegionInfoResponse getRegionInfo(final RpcController controller,<a name="line.1428"></a>
-<span class="sourceLineNo">1429</span>      final GetRegionInfoRequest request) throws ServiceException {<a name="line.1429"></a>
-<span class="sourceLineNo">1430</span>    try {<a name="line.1430"></a>
-<span class="sourceLineNo">1431</span>      checkOpen();<a name="line.1431"></a>
-<span class="sourceLineNo">1432</span>      requestCount.increment();<a name="line.1432"></a>
-<span class="sourceLineNo">1433</span>      Region region = getRegion(request.getRegion());<a name="line.1433"></a>
-<span class="sourceLineNo">1434</span>      HRegionInfo info = region.getRegionInfo();<a name="line.1434"></a>
-<span class="sourceLineNo">1435</span>      GetRegionInfoResponse.Builder builder = GetRegionInfoResponse.newBuilder();<a name="line.1435"></a>
-<span class="sourceLineNo">1436</span>      builder.setRegionInfo(HRegionInfo.convert(info));<a name="line.1436"></a>
-<span class="sourceLineNo">1437</span>      if (request.hasCompactionState() &amp;&amp; request.getCompactionState()) {<a name="line.1437"></a>
-<span class="sourceLineNo">1438</span>        builder.setCompactionState(region.getCompactionState());<a name="line.1438"></a>
-<span class="sourceLineNo">1439</span>      }<a name="line.1439"></a>
-<span class="sourceLineNo">1440</span>      builder.setIsRecovering(region.isRecovering());<a name="line.1440"></a>
-<span class="sourceLineNo">1441</span>      return builder.build();<a name="line.1441"></a>
-<span class="sourceLineNo">1442</span>    } catch (IOException ie) {<a name="line.1442"></a>
-<span class="sourceLineNo">1443</span>      throw new ServiceException(ie);<a name="line.1443"></a>
-<span class="sourceLineNo">1444</span>    }<a name="line.1444"></a>
-<span class="sourceLineNo">1445</span>  }<a name="line.1445"></a>
-<span class="sourceLineNo">1446</span><a name="line.1446"></a>
-<span class="sourceLineNo">1447</span>  /**<a name="line.1447"></a>
-<span class="sourceLineNo">1448</span>   * Get some information of the region server.<a name="line.1448"></a>
-<span class="sourceLineNo">1449</span>   *<a name="line.1449"></a>
-<span class="sourceLineNo">1450</span>   * @param controller the RPC controller<a name="line.1450"></a>
-<span class="sourceLineNo">1451</span>   * @param request the request<a name="line.1451"></a>
-<span class="sourceLineNo">1452</span>   * @throws ServiceException<a name="line.1452"></a>
-<span class="sourceLineNo">1453</span>   */<a name="line.1453"></a>
-<span class="sourceLineNo">1454</span>  @Override<a name="line.1454"></a>
-<span class="sourceLineNo">1455</span>  @QosPriority(priority=HConstants.ADMIN_QOS)<a name="line.1455"></a>
-<span class="sourceLineNo">1456</span>  public GetServerInfoResponse getServerInfo(final RpcController controller,<a name="line.1456"></a>
-<span class="sourceLineNo">1457</span>      final GetServerInfoRequest request) throws ServiceException {<a name="line.1457"></a>
-<span class="sourceLineNo">1458</span>    try {<a name="line.1458"></a>
-<span class="sourceLineNo">1459</span>      checkOpen();<a name="line.1459"></a>
-<span class="sourceLineNo">1460</span>    } catch (IOException ie) {<a name="line.1460"></a>
-<span class="sourceLineNo">1461</span>      throw new ServiceException(ie);<a name="line.1461"></a>
-<span class="sourceLineNo">1462</span>    }<a name="line.1462"></a>
-<span class="sourceLineNo">1463</span>    requestCount.increment();<a name="line.1463"></a>
-<span class="sourceLineNo">1464</span>    int infoPort = regionServer.infoServer != null ? regionServer.infoServer.getPort() : -1;<a name="line.1464"></a>
-<span class="sourceLineNo">1465</span>    return ResponseConverter.buildGetServerInfoResponse(regionServer.serverName, infoPort);<a name="line.1465"></a>
-<span class="sourceLineNo">1466</span>  }<a name="line.1466"></a>
-<span class="sourceLineNo">1467</span><a name="line.1467"></a>
-<span class="sourceLineNo">1468</span>  @Override<a name="line.1468"></a>
-<span class="sourceLineNo">1469</span>  @QosPriority(priority=HConstants.ADMIN_QOS)<a name="line.1469"></a>
-<span class="sourceLineNo">1470</span>  public GetStoreFileResponse getStoreFile(final RpcController controller,<a name="line.1470"></a>
-<span class="sourceLineNo">1471</span>      final GetStoreFileRequest request) throws ServiceException {<a name="line.1471"></a>
-<span class="sourceLineNo">1472</span>    try {<a name="line.1472"></a>
-<span class="sourceLineNo">1473</span>      checkOpen();<a name="line.1473"></a>
-<span class="sourceLineNo">1474</span>      Region region = getRegion(request.getRegion());<a name="line.1474"></a>
-<span class="sourceLineNo">1475</span>      requestCount.increment();<a name="line.1475"></a>
-<span class="sourceLineNo">1476</span>      Set&lt;byte[]&gt; columnFamilies;<a name="line.1476"></a>
-<span class="sourceLineNo">1477</span>      if (request.getFamilyCount() == 0) {<a name="line.1477"></a>
-<span class="sourceLineNo">1478</span>        columnFamilies = region.getTableDesc().getFamiliesKeys();<a name="line.1478"></a>
-<span class="sourceLineNo">1479</span>      } else {<a name="line.1479"></a>
-<span class="sourceLineNo">1480</span>        columnFamilies = new TreeSet&lt;byte[]&gt;(Bytes.BYTES_RAWCOMPARATOR);<a name="line.1480"></a>
-<span class="sourceLineNo">1481</span>        for (ByteString cf: request.getFamilyList()) {<a name="line.1481"></a>
-<span class="sourceLineNo">1482</span>          columnFamilies.add(cf.toByteArray());<a name="line.1482"></a>
-<span class="sourceLineNo">1483</span>        }<a name="line.1483"></a>
-<span class="sourceLineNo">1484</span>      }<a name="line.1484"></a>
-<span class="sourceLineNo">1485</span>      int nCF = columnFamilies.size();<a name="line.1485"></a>
-<span class="sourceLineNo">1486</span>      List&lt;String&gt;  fileList = region.getStoreFileList(<a name="line.1486"></a>
-<span class="sourceLineNo">1487</span>        columnFamilies.toArray(new byte[nCF][]));<a name="line.1487"></a>
-<span class="sourceLineNo">1488</span>      GetStoreFileResponse.Builder builder = GetStoreFileResponse.newBuilder();<a name="line.1488"></a>
-<span class="sourceLineNo">1489</span>      builder.addAllStoreFile(fileList);<a name="line.1489"></a>
-<span class="sourceLineNo">1490</span>      return builder.build();<a name="line.1490"></a>
-<span class="sourceLineNo">1491</span>    } catch (IOException ie) {<a name="line.1491"></a>
-<span class="sourceLineNo">1492</span>      throw new ServiceException(ie);<a name="line.1492"></a>
-<span class="sourceLineNo">1493</span>    }<a name="line.1493"></a>
-<span class="sourceLineNo">1494</span>  }<a name="line.1494"></a>
-<span class="sourceLineNo">1495</span><a name="line.1495"></a>
-<span class="sourceLineNo">1496</span>  /**<a name="line.1496"></a>
-<span class="sourceLineNo">1497</span>   * Merge regions on the region server.<a name="line.1497"></a>
-<span class="sourceLineNo">1498</span>   *<a name="line.1498"></a>
-<span class="sourceLineNo">1499</span>   * @param controller the RPC controller<a name="line.1499"></a>
-<span class="sourceLineNo">1500</span>   * @param request the request<a name="line.1500"></a>
-<span class="sourceLineNo">1501</span>   * @return merge regions response<a name="line.1501"></a>
-<span class="sourceLineNo">1502</span>   * @throws ServiceException<a name="line.1502"></a>
-<span class="sourceLineNo">1503</span>   */<a name="line.1503"></a>
-<span class="sourceLineNo">1504</span>  @Override<a name="line.1504"></a>
-<span class="sourceLineNo">1505</span>  @QosPriority(priority = HConstants.ADMIN_QOS)<a name="line.1505"></a>
-<span class="sourceLineNo">1506</span>  public MergeRegionsResponse mergeRegions(final RpcController controller,<a name="line.1506"></a>
-<span class="sourceLineNo">1507</span>      final MergeRegionsRequest request) throws ServiceException {<a name="line.1507"></a>
-<span class="sourceLineNo">1508</span>    try {<a name="line.1508"></a>
-<span class="sourceLineNo">1509</span>      checkOpen();<a name="line.1509"></a>
-<span class="sourceLineNo">1510</span>      requestCount.increment();<a name="line.1510"></a>
-<span class="sourceLineNo">1511</span>      Region regionA = getRegion(request.getRegionA());<a name="line.1511"></a>
-<span class="sourceLineNo">1512</span>      Region regionB = getRegion(request.getRegionB());<a name="line.1512"></a>
-<span class="sourceLineNo">1513</span>      boolean forcible = request.getForcible();<a name="line.1513"></a>
-<span class="sourceLineNo">1514</span>      long masterSystemTime = request.hasMasterSystemTime() ? request.getMasterSystemTime() : -1;<a name="line.1514"></a>
-<span class="sourceLineNo">1515</span>      regionA.startRegionOperation(Operation.MERGE_REGION);<a name="line.1515"></a>
-<span class="sourceLineNo">1516</span>      regionB.startRegionOperation(Operation.MERGE_REGION);<a name="line.1516"></a>
-<span class="sourceLineNo">1517</span>      if (regionA.getRegionInfo().getReplicaId() != HRegionInfo.DEFAULT_REPLICA_ID ||<a name="line.1517"></a>
-<span class="sourceLineNo">1518</span>          regionB.getRegionInfo().getReplicaId() != HRegionInfo.DEFAULT_REPLICA_ID) {<a name="line.1518"></a>
-<span class="sourceLineNo">1519</span>        throw new ServiceException(new MergeRegionException("Can't merge non-default replicas"));<a name="line.1519"></a>
-<span class="sourceLineNo">1520</span>      }<a name="line.1520"></a>
-<span class="sourceLineNo">1521</span>      LOG.info("Receiving merging request for  " + regionA + ", " + regionB<a name="line.1521"></a>
-<span class="sourceLineNo">1522</span>          + ",forcible=" + forcible);<a name="line.1522"></a>
-<span class="sourceLineNo">1523</span>      long startTime = EnvironmentEdgeManager.currentTime();<a name="line.1523"></a>
-<span class="sourceLineNo">1524</span>      FlushResult flushResult = regionA.flush(true);<a name="line.1524"></a>
-<span class="sourceLineNo">1525</span>      if (flushResult.isFlushSucceeded()) {<a name="line.1525"></a>
-<span class="sourceLineNo">1526</span>        long endTime = EnvironmentEdgeManager.currentTime();<a name="line.1526"></a>
-<span class="sourceLineNo">1527</span>        regionServer.metricsRegionServer.updateFlushTime(endTime - startTime);<a name="line.1527"></a>
-<span class="sourceLineNo">1528</span>      }<a name="line.1528"></a>
-<span class="sourceLineNo">1529</span>      startTime = EnvironmentEdgeManager.currentTime();<a name="line.1529"></a>
-<span class="sourceLineNo">1530</span>      flushResult = regionB.flush(true);<a name="line.1530"></a>
-<span class="sourceLineNo">1531</span>      if (flushResult.isFlushSucceeded()) {<a name="line.1531"></a>
-<span class="sourceLineNo">1532</span>        long endTime = EnvironmentEdgeManager.currentTime();<a name="line.1532"></a>
-<span class="sourceLineNo">1533</span>        regionServer.metricsRegionServer.updateFlushTime(endTime - startTime);<a name="line.1533"></a>
-<span class="sourceLineNo">1534</span>      }<a name="line.1534"></a>
-<span class="sourceLineNo">1535</span>      regionServer.compactSplitThread.requestRegionsMerge(regionA, regionB, forcible,<a name="line.1535"></a>
-<span class="sourceLineNo">1536</span>          masterSystemTime, RpcServer.getRequestUser());<a name="line.1536"></a>
-<span class="sourceLineNo">1537</span>      return MergeRegionsResponse.newBuilder().build();<a name="line.1537"></a>
-<span class="sourceLineNo">1538</span>    } catch (DroppedSnapshotException ex) {<a name="line.1538"></a>
-<span class="sourceLineNo">1539</span>      regionServer.abort("Replay of WAL required. Forcing server shutdown", ex);<a name="line.1539"></a>
-<span class="sourceLineNo">1540</span>      throw new ServiceException(ex);<a name="line.1540"></a>
-<span class="sourceLineNo">1541</span>    } catch (IOException ie) {<a name="line.1541"></a>
-<span class="sourceLineNo">1542</span>      throw new ServiceException(ie);<a name="line.1542"></a>
-<span class="sourceLineNo">1543</span>    }<a name="line.1543"></a>
-<span class="sourceLineNo">1544</span>  }<a name="line.1544"></a>
-<span class="sourceLineNo">1545</span><a name="line.1545"></a>
-<span class="sourceLineNo">1546</span>  /**<a name="line.1546"></a>
-<span class="sourceLineNo">1547</span>   * Open asynchronously a region or a set of regions on the region server.<a name="line.1547"></a>
-<span class="sourceLineNo">1548</span>   *<a name="line.1548"></a>
-<span class="sourceLineNo">1549</span>   * The opening is coordinated by ZooKeeper, and this method requires the znode to be created<a name="line.1549"></a>
-<span class="sourceLineNo">1550</span>   *  before being called. As a consequence, this method should be called only from the master.<a name="line.1550"></a>
-<span class="sourceLineNo">1551</span>   * &lt;p&gt;<a name="line.1551"></a>
-<span class="sourceLineNo">1552</span>   * Different manages states for the region are:<a name="line.1552"></a>
-<span class="sourceLineNo">1553</span>   * &lt;/p&gt;&lt;ul&gt;<a name="line.1553"></a>
-<span class="sourceLineNo">1554</span>   *  &lt;li&gt;region not opened: the region opening will start asynchronously.&lt;/li&gt;<a name="line.1554"></a>
-<span class="sourceLineNo">1555</span>   *  &lt;li&gt;a close is already in progress: this is considered as an error.&lt;/li&gt;<a name="line.1555"></a>
-<span class="sourceLineNo">1556</span>   *  &lt;li&gt;an open is already in progress: this new open request will be ignored. This is important<a name="line.1556"></a>
-<span class="sourceLineNo">1557</span>   *  because the Master can do multiple requests if it crashes.&lt;/li&gt;<a name="line.1557"></a>
-<span class="sourceLineNo">1558</span>   *  &lt;li&gt;the region is already opened:  this new open request will be ignored.&lt;/li&gt;<a name="line.1558"></a>
-<span class="sourceLineNo">1559</span>   *  &lt;/ul&gt;<a name="line.1559"></a>
-<span class="sourceLineNo">1560</span>   * &lt;p&gt;<a name="line.1560"></a>
-<span class="sourceLineNo">1561</span>   * Bulk assign: If there are more than 1 region to open, it will be considered as a bulk assign.<a name="line.1561"></a>
-<span class="sourceLineNo">1562</span>   * For a single region opening, errors are sent through a ServiceException. For bulk assign,<a name="line.1562"></a>
-<span class="sourceLineNo">1563</span>   * errors are put in the response as FAILED_OPENING.<a name="line.1563"></a>
-<span class="sourceLineNo">1564</span>   * &lt;/p&gt;<a name="line.1564"></a>
-<span class="sourceLineNo">1565</span>   * @param controller the RPC controller<a name="line.1565"></a>
-<span class="sourceLineNo">1566</span>   * @param request the request<a name="line.1566"></a>
-<span class="sourceLineNo">1567</span>   * @throws ServiceException<a name="line.1567"></a>
-<span class="sourceLineNo">1568</span>   */<a name="line.1568"></a>
-<span class="sourceLineNo">1569</span>  @Override<a name="line.1569"></a>
-<span class="sourceLineNo">1570</span>  @QosPriority(priority=HConstants.ADMIN_QOS)<a name="line.1570"></a>
-<span class="sourceLineNo">1571</span>  public OpenRegionResponse openRegion(final RpcController controller,<a name="line.1571"></a>
-<span class="sourceLineNo">1572</span>      final OpenRegionRequest request) throws ServiceException {<a name="line.1572"></a>
-<span class="sourceLineNo">1573</span>    requestCount.increment();<a name="line.1573"></a>
-<span class="sourceLineNo">1574</span>    if (request.hasServerStartCode()) {<a name="line.1574"></a>
-<span class="sourceLineNo">1575</span>      // check that we are the same server that this RPC is intended for.<a name="line.1575"></a>
-<span class="sourceLineNo">1576</span>      long serverStartCode = request.getServerStartCode();<a name="line.1576"></a>
-<span class="sourceLineNo">1577</span>      if (regionServer.serverName.getStartcode() !=  serverStartCode) {<a name="line.1577"></a>
-<span class="sourceLineNo">1578</span>        throw new ServiceException(new DoNotRetryIOException("This RPC was intended for a " +<a name="line.1578"></a>
-<span class="sourceLineNo">1579</span>            "different server with startCode: " + serverStartCode + ", this server is: "<a name="line.1579"></a>
-<span class="sourceLineNo">1580</span>            + regionServer.serverName));<a name="line.1580"></a>
-<span class="sourceLineNo">1581</span>      }<a name="line.1581"></a>
-<span class="sourceLineNo">1582</span>    }<a name="line.1582"></a>
-<span class="sourceLineNo">1583</span><a name="line.1583"></a>
-<span class="sourceLineNo">1584</span>    OpenRegionResponse.Builder builder = OpenRegionResponse.newBuilder();<a name="line.1584"></a>
-<span class="sourceLineNo">1585</span>    final int regionCount = request.getOpenInfoCount();<a name="line.1585"></a>
-<span class="sourceLineNo">1586</span>    final Map&lt;TableName, HTableDescriptor&gt; htds =<a name="line.1586"></a>
-<span class="sourceLineNo">1587</span>        new HashMap&lt;TableName, HTableDescriptor&gt;(regionCount);<a name="line.1587"></a>
-<span class="sourceLineNo">1588</span>    final boolean isBulkAssign = regionCount &gt; 1;<a name="line.1588"></a>
-<span class="sourceLineNo">1589</span>    try {<a name="line.1589"></a>
-<span class="sourceLineNo">1590</span>      checkOpen();<a name="line.1590"></a>
-<span class="sourceLineNo">1591</span>    } catch (IOException ie) {<a name="line.1591"></a>
-<span class="sourceLineNo">1592</span>      TableName tableName = null;<a name="line.1592"></a>
-<span class="sourceLineNo">1593</span>      if (regionCount == 1) {<a name="line.1593"></a>
-<span class="sourceLineNo">1594</span>        RegionInfo ri = request.getOpenInfo(0).getRegion();<a name="line.1594"></a>
-<span class="sourceLineNo">1595</span>        if (ri != null) {<a name="line.1595"></a>
-<span class="sourceLineNo">1596</span>          tableName = ProtobufUtil.toTableName(ri.getTableName());<a name="line.1596"></a>
-<span class="sourceLineNo">1597</span>        }<a name="line.1597"></a>
-<span class="sourceLineNo">1598</span>      }<a name="line.1598"></a>
-<span class="sourceLineNo">1599</span>      if (!TableName.META_TABLE_NAME.equals(tableName)) {<a name="line.1599"></a>
-<span class="sourceLineNo">1600</span>        throw new ServiceException(ie);<a name="line.1600"></a>
-<span class="sourceLineNo">1601</span>      }<a name="line.1601"></a>
-<span class="sourceLineNo">1602</span>      // We are assigning meta, wait a little for regionserver to finish initialization.<a name="line.1602"></a>
-<span class="sourceLineNo">1603</span>      int timeout = regionServer.conf.getInt(HConstants.HBASE_RPC_TIMEOUT_KEY,<a name="line.1603"></a>
-<span class="sourceLineNo">1604</span>        HConstants.DEFAULT_HBASE_RPC_TIMEOUT) &gt;&gt; 2; // Quarter of RPC timeout<a name="line.1604"></a>
-<span class="sourceLineNo">1605</span>      long endTime = System.currentTimeMillis() + timeout;<a name="line.1605"></a>
-<span class="sourceLineNo">1606</span>      synchronized (regionServer.online) {<a name="line.1606"></a>
-<span class="sourceLineNo">1607</span>        try {<a name="line.1607"></a>
-<span class="sourceLineNo">1608</span>          while (System.currentTimeMillis() &lt;= endTime<a name="line.1608"></a>
-<span class="sourceLineNo">1609</span>              &amp;&amp; !regionServer.isStopped() &amp;&amp; !regionServer.isOnline()) {<a name="line.1609"></a>
-<span class="sourceLineNo">1610</span>            regionServer.online.wait(regionServer.msgInterval);<a name="line.1610"></a>
-<span class="sourceLineNo">1611</span>          }<a name="line.1611"></a>
-<span class="sourceLineNo">1612</span>          checkOpen();<a name="line.1612"></a>
-<span class="sourceLineNo">1613</span>        } catch (InterruptedException t) {<a name="line.1613"></a>
-<span class="sourceLineNo">1614</span>          Thread.currentThread().interrupt();<a name="line.1614"></a>
-<span class="sourceLineNo">1615</span>          throw new ServiceException(t);<a name="line.1615"></a>
-<span class="sourceLineNo">1616</span>        } catch (IOException e) {<a name="line.1616"></a>
-<span class="sourceLineNo">1617</span>          throw new ServiceException(e);<a name="line.1617"></a>
-<span class="sourceLineNo">1618</span>        }<a name="line.1618"></a>
-<span class="sourceLineNo">1619</span>      }<a name="line.1619"></a>
-<span class="sourceLineNo">1620</span>    }<a name="line.1620"></a>
-<span class="sourceLineNo">1621</span><a name="line.1621"></a>
-<span class="sourceLineNo">1622</span>    long masterSystemTime = request.hasMasterSystemTime() ? request.getMasterSystemTime() : -1;<a name="line.1622"></a>
-<span class="sourceLineNo">1623</span><a name="line.1623"></a>
-<span class="sourceLineNo">1624</span>    for (RegionOpenInfo regionOpenInfo : request.getOpenInfoList()) {<a name="line.1624"></a>
-<span class="sourceLineNo">1625</span>      final HRegionInfo region = HRegionInfo.convert(regionOpenInfo.getRegion());<a name="line.1625"></a>
-<span class="sourceLineNo">1626</span>      HTableDescriptor htd;<a name="line.1626"></a>
-<span class="sourceLineNo">1627</span>      try {<a name="line.1627"></a>
-<span class="sourceLineNo">1628</span>        String encodedName = region.getEncodedName();<a name="line.1628"></a>
-<span class="sourceLineNo">1629</span>        byte[] encodedNameBytes = region.getEncodedNameAsBytes();<a name="line.1629"></a>
-<span class="sourceLineNo">1630</span>        final Region onlineRegion = regionServer.getFromOnlineRegions(encodedName);<a name="line.1630"></a>
-<span class="sourceLineNo">1631</span>        if (onlineRegion != null) {<a name="line.1631"></a>
-<span class="sourceLineNo">1632</span>          // The region is already online. This should not happen any more.<a name="line.1632"></a>
-<span class="sourceLineNo">1633</span>          String error = "Received OPEN for the region:"<a name="line.1633"></a>
-<span class="sourceLineNo">1634</span>            + region.getRegionNameAsString() + ", which is already online";<a name="line.1634"></a>
-<span class="sourceLineNo">1635</span>          regionServer.abort(error);<a name="line.1635"></a>
-<span class="sourceLineNo">1636</span>          throw new IOException(error);<a name="line.1636"></a>
-<span class="sourceLineNo">1637</span>        }<a name="line.1637"></a>
-<span class="sourceLineNo">1638</span>        LOG.info("Open " + region.getRegionNameAsString());<a name="line.1638"></a>
-<span class="sourceLineNo">1639</span>        htd = htds.get(region.getTable());<a name="line.1639"></a>
-<span class="sourceLineNo">1640</span>        if (htd == null) {<a name="line.1640"></a>
-<span class="sourceLineNo">1641</span>          htd = regionServer.tableDescriptors.get(region.getTable());<a name="line.1641"></a>
-<span class="sourceLineNo">1642</span>          htds.put(region.getTable(), htd);<a name="line.1642"></a>
-<span class="sourceLineNo">1643</span>        }<a name="line.1643"></a>
-<span class="sourceLineNo">1644</span><a name="line.1644"></a>
-<span class="sourceLineNo">1645</span>        final Boolean previous = regionServer.regionsInTransitionInRS.putIfAbsent(<a name="line.1645"></a>
-<span class="sourceLineNo">1646</span>          encodedNameBytes, Boolean.TRUE);<a name="line.1646"></a>
-<span class="sourceLineNo">1647</span><a name="line.1647"></a>
-<span class="sourceLineNo">1648</span>        if (Boolean.FALSE.equals(previous)) {<a name="line.1648"></a>
-<span class="sourceLineNo">1649</span>          if (regionServer.getFromOnlineRegions(encodedName) != null) {<a name="line.1649"></a>
-<span class="sourceLineNo">1650</span>            // There is a close in progress. This should not happen any more.<a name="line.1650"></a>
-<span class="sourceLineNo">1651</span>            String error = "Received OPEN for the region:"<a name="line.1651"></a>
-<span class="sourceLineNo">1652</span>              + region.getRegionNameAsString() + ", which we are already trying to CLOSE";<a name="line.1652"></a>
-<span class="sourceLineNo">1653</span>            regionServer.abort(error);<a name="line.1653"></a>
-<span class="sourceLineNo">1654</span>            throw new IOException(error);<a name="line.1654"></a>
-<span class="sourceLineNo">1655</span>          }<a name="line.1655"></a>
-<span class="sourceLineNo">1656</span>          regionServer.regionsInTransitionInRS.put(encodedNameBytes, Boolean.TRUE);<a name="line.1656"></a>
-<span class="sourceLineNo">1657</span>        }<a name="line.1657"></a>
+<span class="sourceLineNo">1150</span>    ByteString value = regionSpecifier.getValue();<a name="line.1150"></a>
+<span class="sourceLineNo">1151</span>    RegionSpecifierType type = regionSpecifier.getType();<a name="line.1151"></a>
+<span class="sourceLineNo">1152</span>    switch (type) {<a name="line.1152"></a>
+<span class="sourceLineNo">1153</span>      case REGION_NAME:<a name="line.1153"></a>
+<span class="sourceLineNo">1154</span>        byte[] regionName = value.toByteArray();<a name="line.1154"></a>
+<span class="sourceLineNo">1155</span>        String encodedRegionName = HRegionInfo.encodeRegionName(regionName);<a name="line.1155"></a>
+<span class="sourceLineNo">1156</span>        return regionServer.getRegionByEncodedName(regionName, encodedRegionName);<a name="line.1156"></a>
+<span class="sourceLineNo">1157</span>      case ENCODED_REGION_NAME:<a name="line.1157"></a>
+<span class="sourceLineNo">1158</span>        return regionServer.getRegionByEncodedName(value.toStringUtf8());<a name="line.1158"></a>
+<span class="sourceLineNo">1159</span>      default:<a name="line.1159"></a>
+<span class="sourceLineNo">1160</span>        throw new DoNotRetryIOException(<a name="line.1160"></a>
+<span class="sourceLineNo">1161</span>          "Unsupported region specifier type: " + type);<a name="line.1161"></a>
+<span class="sourceLineNo">1162</span>    }<a name="line.1162"></a>
+<span class="sourceLineNo">1163</span>  }<a name="line.1163"></a>
+<span class="sourceLineNo">1164</span><a name="line.1164"></a>
+<span class="sourceLineNo">1165</span>  @VisibleForTesting<a name="line.1165"></a>
+<span class="sourceLineNo">1166</span>  public PriorityFunction getPriority() {<a name="line.1166"></a>
+<span class="sourceLineNo">1167</span>    return priority;<a name="line.1167"></a>
+<span class="sourceLineNo">1168</span>  }<a name="line.1168"></a>
+<span class="sourceLineNo">1169</span><a name="line.1169"></a>
+<span class="sourceLineNo">1170</span>  @VisibleForTesting<a name="line.1170"></a>
+<span class="sourceLineNo">1171</span>  public Configuration getConfiguration() {<a name="line.1171"></a>
+<span class="sourceLineNo">1172</span>    return regionServer.getConfiguration();<a name="line.1172"></a>
+<span class="sourceLineNo">1173</span>  }<a name="line.1173"></a>
+<span class="sourceLineNo">1174</span><a name="line.1174"></a>
+<span class="sourceLineNo">1175</span>  private RegionServerQuotaManager getQuotaManager() {<a name="line.1175"></a>
+<span class="sourceLineNo">1176</span>    return regionServer.getRegionServerQuotaManager();<a name="line.1176"></a>
+<span class="sourceLineNo">1177</span>  }<a name="line.1177"></a>
+<span class="sourceLineNo">1178</span><a name="line.1178"></a>
+<span class="sourceLineNo">1179</span>  void start() {<a name="line.1179"></a>
+<span class="sourceLineNo">1180</span>    rpcServer.start();<a name="line.1180"></a>
+<span class="sourceLineNo">1181</span>  }<a name="line.1181"></a>
+<span class="sourceLineNo">1182</span><a name="line.1182"></a>
+<span class="sourceLineNo">1183</span>  void stop() {<a name="line.1183"></a>
+<span class="sourceLineNo">1184</span>    closeAllScanners();<a name="line.1184"></a>
+<span class="sourceLineNo">1185</span>    rpcServer.stop();<a name="line.1185"></a>
+<span class="sourceLineNo">1186</span>  }<a name="line.1186"></a>
+<span class="sourceLineNo">1187</span><a name="line.1187"></a>
+<span class="sourceLineNo">1188</span>  /**<a name="line.1188"></a>
+<span class="sourceLineNo">1189</span>   * Called to verify that this server is up and running.<a name="line.1189"></a>
+<span class="sourceLineNo">1190</span>   *<a name="line.1190"></a>
+<span class="sourceLineNo">1191</span>   * @throws IOException<a name="line.1191"></a>
+<span class="sourceLineNo">1192</span>   */<a name="line.1192"></a>
+<span class="sourceLineNo">1193</span>  protected void checkOpen() throws IOException {<a name="line.1193"></a>
+<span class="sourceLineNo">1194</span>    if (regionServer.isAborted()) {<a name="line.1194"></a>
+<span class="sourceLineNo">1195</span>      throw new RegionServerAbortedException("Server " + regionServer.serverName + " aborting");<a name="line.1195"></a>
+<span class="sourceLineNo">1196</span>    }<a name="line.1196"></a>
+<span class="sourceLineNo">1197</span>    if (regionServer.isStopped()) {<a name="line.1197"></a>
+<span class="sourceLineNo">1198</span>      throw new RegionServerStoppedException("Server " + regionServer.serverName + " stopping");<a name="line.1198"></a>
+<span class="sourceLineNo">1199</span>    }<a name="line.1199"></a>
+<span class="sourceLineNo">1200</span>    if (!regionServer.fsOk) {<a name="line.1200"></a>
+<span class="sourceLineNo">1201</span>      throw new RegionServerStoppedException("File system not available");<a name="line.1201"></a>
+<span class="sourceLineNo">1202</span>    }<a name="line.1202"></a>
+<span class="sourceLineNo">1203</span>    if (!regionServer.isOnline()) {<a name="line.1203"></a>
+<span class="sourceLineNo">1204</span>      throw new ServerNotRunningYetException("Server is not running yet");<a name="line.1204"></a>
+<span class="sourceLineNo">1205</span>    }<a name="line.1205"></a>
+<span class="sourceLineNo">1206</span>  }<a name="line.1206"></a>
+<span class="sourceLineNo">1207</span><a name="line.1207"></a>
+<span class="sourceLineNo">1208</span>  /**<a name="line.1208"></a>
+<span class="sourceLineNo">1209</span>   * @return list of blocking services and their security info classes that this server supports<a name="line.1209"></a>
+<span class="sourceLineNo">1210</span>   */<a name="line.1210"></a>
+<span class="sourceLineNo">1211</span>  protected List&lt;BlockingServiceAndInterface&gt; getServices() {<a name="line.1211"></a>
+<span class="sourceLineNo">1212</span>    List&lt;BlockingServiceAndInterface&gt; bssi = new ArrayList&lt;BlockingServiceAndInterface&gt;(2);<a name="line.1212"></a>
+<span class="sourceLineNo">1213</span>    bssi.add(new BlockingServiceAndInterface(<a name="line.1213"></a>
+<span class="sourceLineNo">1214</span>      ClientService.newReflectiveBlockingService(this),<a name="line.1214"></a>
+<span class="sourceLineNo">1215</span>      ClientService.BlockingInterface.class));<a name="line.1215"></a>
+<span class="sourceLineNo">1216</span>    bssi.add(new BlockingServiceAndInterface(<a name="line.1216"></a>
+<span class="sourceLineNo">1217</span>      AdminService.newReflectiveBlockingService(this),<a name="line.1217"></a>
+<span class="sourceLineNo">1218</span>      AdminService.BlockingInterface.class));<a name="line.1218"></a>
+<span class="sourceLineNo">1219</span>    return bssi;<a name="line.1219"></a>
+<span class="sourceLineNo">1220</span>  }<a name="line.1220"></a>
+<span class="sourceLineNo">1221</span><a name="line.1221"></a>
+<span class="sourceLineNo">1222</span>  public InetSocketAddress getSocketAddress() {<a name="line.1222"></a>
+<span class="sourceLineNo">1223</span>    return isa;<a name="line.1223"></a>
+<span class="sourceLineNo">1224</span>  }<a name="line.1224"></a>
+<span class="sourceLineNo">1225</span><a name="line.1225"></a>
+<span class="sourceLineNo">1226</span>  @Override<a name="line.1226"></a>
+<span class="sourceLineNo">1227</span>  public int getPriority(RequestHeader header, Message param, User user) {<a name="line.1227"></a>
+<span class="sourceLineNo">1228</span>    return priority.getPriority(header, param, user);<a name="line.1228"></a>
+<span class="sourceLineNo">1229</span>  }<a name="line.1229"></a>
+<span class="sourceLineNo">1230</span><a name="line.1230"></a>
+<span class="sourceLineNo">1231</span>  @Override<a name="line.1231"></a>
+<span class="sourceLineNo">1232</span>  public long getDeadline(RequestHeader header, Message param) {<a name="line.1232"></a>
+<span class="sourceLineNo">1233</span>    return priority.getDeadline(header, param);<a name="line.1233"></a>
+<span class="sourceLineNo">1234</span>  }<a name="line.1234"></a>
+<span class="sourceLineNo">1235</span><a name="line.1235"></a>
+<span class="sourceLineNo">1236</span>  /*<a name="line.1236"></a>
+<span class="sourceLineNo">1237</span>   * Check if an OOME and, if so, abort immediately to avoid creating more objects.<a name="line.1237"></a>
+<span class="sourceLineNo">1238</span>   *<a name="line.1238"></a>
+<span class="sourceLineNo">1239</span>   * @param e<a name="line.1239"></a>
+<span class="sourceLineNo">1240</span>   *<a name="line.1240"></a>
+<span class="sourceLineNo">1241</span>   * @return True if we OOME'd and are aborting.<a name="line.1241"></a>
+<span class="sourceLineNo">1242</span>   */<a name="line.1242"></a>
+<span class="sourceLineNo">1243</span>  @Override<a name="line.1243"></a>
+<span class="sourceLineNo">1244</span>  public boolean checkOOME(final Throwable e) {<a name="line.1244"></a>
+<span class="sourceLineNo">1245</span>    boolean stop = false;<a name="line.1245"></a>
+<span class="sourceLineNo">1246</span>    try {<a name="line.1246"></a>
+<span class="sourceLineNo">1247</span>      if (e instanceof OutOfMemoryError<a name="line.1247"></a>
+<span class="sourceLineNo">1248</span>          || (e.getCause() != null &amp;&amp; e.getCause() instanceof OutOfMemoryError)<a name="line.1248"></a>
+<span class="sourceLineNo">1249</span>          || (e.getMessage() != null &amp;&amp; e.getMessage().contains(<a name="line.1249"></a>
+<span class="sourceLineNo">1250</span>              "java.lang.OutOfMemoryError"))) {<a name="line.1250"></a>
+<span class="sourceLineNo">1251</span>        stop = true;<a name="line.1251"></a>
+<span class="sourceLineNo">1252</span>        LOG.fatal("Run out of memory; " + getClass().getSimpleName()<a name="line.1252"></a>
+<span class="sourceLineNo">1253</span>          + " will abort itself immediately", e);<a name="line.1253"></a>
+<span class="sourceLineNo">1254</span>      }<a name="line.1254"></a>
+<span class="sourceLineNo">1255</span>    } finally {<a name="line.1255"></a>
+<span class="sourceLineNo">1256</span>      if (stop) {<a name="line.1256"></a>
+<span class="sourceLineNo">1257</span>        Runtime.getRuntime().halt(1);<a name="line.1257"></a>
+<span class="sourceLineNo">1258</span>      }<a name="line.1258"></a>
+<span class="sourceLineNo">1259</span>    }<a name="line.1259"></a>
+<span class="sourceLineNo">1260</span>    return stop;<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>  /**<a name="line.1263"></a>
+<span class="sourceLineNo">1264</span>   * Close a region on the region server.<a name="line.1264"></a>
+<span class="sourceLineNo">1265</span>   *<a name="line.1265"></a>
+<span class="sourceLineNo">1266</span>   * @param controller the RPC controller<a name="line.1266"></a>
+<span class="sourceLineNo">1267</span>   * @param request the request<a name="line.1267"></a>
+<span class="sourceLineNo">1268</span>   * @throws ServiceException<a name="line.1268"></a>
+<span class="sourceLineNo">1269</span>   */<a name="line.1269"></a>
+<span class="sourceLineNo">1270</span>  @Override<a name="line.1270"></a>
+<span class="sourceLineNo">1271</span>  @QosPriority(priority=HConstants.ADMIN_QOS)<a name="line.1271"></a>
+<span class="sourceLineNo">1272</span>  public CloseRegionResponse closeRegion(final RpcController controller,<a name="line.1272"></a>
+<span class="sourceLineNo">1273</span>      final CloseRegionRequest request) throws ServiceException {<a name="line.1273"></a>
+<span class="sourceLineNo">1274</span>    final ServerName sn = (request.hasDestinationServer() ?<a name="line.1274"></a>
+<span class="sourceLineNo">1275</span>      ProtobufUtil.toServerName(request.getDestinationServer()) : null);<a name="line.1275"></a>
+<span class="sourceLineNo">1276</span><a name="line.1276"></a>
+<span class="sourceLineNo">1277</span>    try {<a name="line.1277"></a>
+<span class="sourceLineNo">1278</span>      checkOpen();<a name="line.1278"></a>
+<span class="sourceLineNo">1279</span>      if (request.hasServerStartCode()) {<a name="line.1279"></a>
+<span class="sourceLineNo">1280</span>        // check that we are the same server that this RPC is intended for.<a name="line.1280"></a>
+<span class="sourceLineNo">1281</span>        long serverStartCode = request.getServerStartCode();<a name="line.1281"></a>
+<span class="sourceLineNo">1282</span>        if (regionServer.serverName.getStartcode() !=  serverStartCode) {<a name="line.1282"></a>
+<span class="sourceLineNo">1283</span>          throw new ServiceException(new DoNotRetryIOException("This RPC was intended for a " +<a name="line.1283"></a>
+<span class="sourceLineNo">1284</span>              "different server with startCode: " + serverStartCode + ", this server is: "<a name="line.1284"></a>
+<span class="sourceLineNo">1285</span>              + regionServer.serverName));<a name="line.1285"></a>
+<span class="sourceLineNo">1286</span>        }<a name="line.1286"></a>
+<span class="sourceLineNo">1287</span>      }<a name="line.1287"></a>
+<span class="sourceLineNo">1288</span>      final String encodedRegionName = ProtobufUtil.getRegionEncodedName(request.getRegion());<a name="line.1288"></a>
+<span class="sourceLineNo">1289</span><a name="line.1289"></a>
+<span class="sourceLineNo">1290</span>      // Can be null if we're calling close on a region that's not online<a name="line.1290"></a>
+<span class="sourceLineNo">1291</span>      final Region region = regionServer.getFromOnlineRegions(encodedRegionName);<a name="line.1291"></a>
+<span class="sourceLineNo">1292</span>      if ((region  != null) &amp;&amp; (region .getCoprocessorHost() != null)) {<a name="line.1292"></a>
+<span class="sourceLineNo">1293</span>        region.getCoprocessorHost().preClose(false);<a name="line.1293"></a>
+<span class="sourceLineNo">1294</span>      }<a name="line.1294"></a>
+<span class="sourceLineNo">1295</span><a name="line.1295"></a>
+<span class="sourceLineNo">1296</span>      requestCount.increment();<a name="line.1296"></a>
+<span class="sourceLineNo">1297</span>      LOG.info("Close " + encodedRegionName + ", moving to " + sn);<a name="line.1297"></a>
+<span class="sourceLineNo">1298</span>      boolean closed = regionServer.closeRegion(encodedRegionName, false, sn);<a name="line.1298"></a>
+<span class="sourceLineNo">1299</span>      CloseRegionResponse.Builder builder = CloseRegionResponse.newBuilder().setClosed(closed);<a name="line.1299"></a>
+<span class="sourceLineNo">1300</span>      return builder.build();<a name="line.1300"></a>
+<span class="sourceLineNo">1301</span>    } catch (IOException ie) {<a name="line.1301"></a>
+<span class="sourceLineNo">1302</span>      throw new ServiceException(ie);<a name="line.1302"></a>
+<span class="sourceLineNo">1303</span>    }<a name="line.1303"></a>
+<span class="sourceLineNo">1304</span>  }<a name="line.1304"></a>
+<span class="sourceLineNo">1305</span><a name="line.1305"></a>
+<span class="sourceLineNo">1306</span>  /**<a name="line.1306"></a>
+<span class="sourceLineNo">1307</span>   * Compact a region on the region server.<a name="line.1307"></a>
+<span class="sourceLineNo">1308</span>   *<a name="line.1308"></a>
+<span class="sourceLineNo">1309</span>   * @param controller the RPC controller<a name="line.1309"></a>
+<span class="sourceLineNo">1310</span>   * @param request the request<a name="line.1310"></a>
+<span class="sourceLineNo">1311</span>   * @throws ServiceException<a name="line.1311"></a>
+<span class="sourceLineNo">1312</span>   */<a name="line.1312"></a>
+<span class="sourceLineNo">1313</span>  @Override<a name="line.1313"></a>
+<span class="sourceLineNo">1314</span>  @QosPriority(priority=HConstants.ADMIN_QOS)<a name="line.1314"></a>
+<span class="sourceLineNo">1315</span>  public CompactRegionResponse compactRegion(final RpcController controller,<a name="line.1315"></a>
+<span class="sourceLineNo">1316</span>      final CompactRegionRequest request) throws ServiceException {<a name="line.1316"></a>
+<span class="sourceLineNo">1317</span>    try {<a name="line.1317"></a>
+<span class="sourceLineNo">1318</span>      checkOpen();<a name="line.1318"></a>
+<span class="sourceLineNo">1319</span>      requestCount.increment();<a name="line.1319"></a>
+<span class="sourceLineNo">1320</span>      Region region = getRegion(request.getRegion());<a name="line.1320"></a>
+<span class="sourceLineNo">1321</span>      region.startRegionOperation(Operation.COMPACT_REGION);<a name="line.1321"></a>
+<span class="sourceLineNo">1322</span>      LOG.info("Compacting " + region.getRegionInfo().getRegionNameAsString());<a name="line.1322"></a>
+<span class="sourceLineNo">1323</span>      boolean major = false;<a name="line.1323"></a>
+<span class="sourceLineNo">1324</span>      byte [] family = null;<a name="line.1324"></a>
+<span class="sourceLineNo">1325</span>      Store store = null;<a name="line.1325"></a>
+<span class="sourceLineNo">1326</span>      if (request.hasFamily()) {<a name="line.1326"></a>
+<span class="sourceLineNo">1327</span>        family = request.getFamily().toByteArray();<a name="line.1327"></a>
+<span class="sourceLineNo">1328</span>        store = region.getStore(family);<a name="line.1328"></a>
+<span class="sourceLineNo">1329</span>        if (store == null) {<a name="line.1329"></a>
+<span class="sourceLineNo">1330</span>          throw new ServiceException(new IOException("column family " + Bytes.toString(family)<a name="line.1330"></a>
+<span class="sourceLineNo">1331</span>            + " does not exist in region " + region.getRegionInfo().getRegionNameAsString()));<a name="line.1331"></a>
+<span class="sourceLineNo">1332</span>        }<a name="line.1332"></a>
+<span class="sourceLineNo">1333</span>      }<a name="line.1333"></a>
+<span class="sourceLineNo">1334</span>      if (request.hasMajor()) {<a name="line.1334"></a>
+<span class="sourceLineNo">1335</span>        major = request.getMajor();<a name="line.1335"></a>
+<span class="sourceLineNo">1336</span>      }<a name="line.1336"></a>
+<span class="sourceLineNo">1337</span>      if (major) {<a name="line.1337"></a>
+<span class="sourceLineNo">1338</span>        if (family != null) {<a name="line.1338"></a>
+<span class="sourceLineNo">1339</span>          store.triggerMajorCompaction();<a name="line.1339"></a>
+<span class="sourceLineNo">1340</span>        } else {<a name="line.1340"></a>
+<span class="sourceLineNo">1341</span>          region.triggerMajorCompaction();<a name="line.1341"></a>
+<span class="sourceLineNo">1342</span>        }<a name="line.1342"></a>
+<span class="sourceLineNo">1343</span>      }<a name="line.1343"></a>
+<span class="sourceLineNo">1344</span><a name="line.1344"></a>
+<span class="sourceLineNo">1345</span>      String familyLogMsg = (family != null)?" for column family: " + Bytes.toString(family):"";<a name="line.1345"></a>
+<span class="sourceLineNo">1346</span>      if (LOG.isTraceEnabled()) {<a name="line.1346"></a>
+<span class="sourceLineNo">1347</span>        LOG.trace("User-triggered compaction requested for region "<a name="line.1347"></a>
+<span class="sourceLineNo">1348</span>          + region.getRegionInfo().getRegionNameAsString() + familyLogMsg);<a name="line.1348"></a>
+<span class="sourceLineNo">1349</span>      }<a name="line.1349"></a>
+<span class="sourceLineNo">1350</span>      String log = "User-triggered " + (major ? "major " : "") + "compaction" + familyLogMsg;<a name="line.1350"></a>
+<span class="sourceLineNo">1351</span>      if(family != null) {<a name="line.1351"></a>
+<span class="sourceLineNo">1352</span>        regionServer.compactSplitThread.requestCompaction(region, store, log,<a name="line.1352"></a>
+<span class="sourceLineNo">1353</span>          Store.PRIORITY_USER, null, RpcServer.getRequestUser());<a name="line.1353"></a>
+<span class="sourceLineNo">1354</span>      } else {<a name="line.1354"></a>
+<span class="sourceLineNo">1355</span>        regionServer.compactSplitThread.requestCompaction(region, log,<a name="line.1355"></a>
+<span class="sourceLineNo">1356</span>          Store.PRIORITY_USER, null, RpcServer.getRequestUser());<a name="line.1356"></a>
+<span class="sourceLineNo">1357</span>      }<a name="line.1357"></a>
+<span class="sourceLineNo">1358</span>      return CompactRegionResponse.newBuilder().build();<a name="line.1358"></a>
+<span class="sourceLineNo">1359</span>    } catch (IOException ie) {<a name="line.1359"></a>
+<span class="sourceLineNo">1360</span>      throw new ServiceException(ie);<a name="line.1360"></a>
+<span class="sourceLineNo">1361</span>    }<a name="line.1361"></a>
+<span class="sourceLineNo">1362</span>  }<a name="line.1362"></a>
+<span class="sourceLineNo">1363</span><a name="line.1363"></a>
+<span class="sourceLineNo">1364</span>  /**<a name="line.1364"></a>
+<span class="sourceLineNo">1365</span>   * Flush a region on the region server.<a name="line.1365"></a>
+<span class="sourceLineNo">1366</span>   *<a name="line.1366"></a>
+<span class="sourceLineNo">1367</span>   * @param controller the RPC controller<a name="line.1367"></a>
+<span class="sourceLineNo">1368</span>   * @param request the request<a name="line.1368"></a>
+<span class="sourceLineNo">1369</span>   * @throws ServiceException<a name="line.1369"></a>
+<span class="sourceLineNo">1370</span>   */<a name="line.1370"></a>
+<span class="sourceLineNo">1371</span>  @Override<a name="line.1371"></a>
+<span class="sourceLineNo">1372</span>  @QosPriority(priority=HConstants.ADMIN_QOS)<a name="line.1372"></a>
+<span class="sourceLineNo">1373</span>  public FlushRegionResponse flushRegion(final RpcController controller,<a name="line.1373"></a>
+<span class="sourceLineNo">1374</span>      final FlushRegionRequest request) throws ServiceException {<a name="line.1374"></a>
+<span class="sourceLineNo">1375</span>    try {<a name="line.1375"></a>
+<span class="sourceLineNo">1376</span>      checkOpen();<a name="line.1376"></a>
+<span class="sourceLineNo">1377</span>      requestCount.increment();<a name="line.1377"></a>
+<span class="sourceLineNo">1378</span>      Region region = getRegion(request.getRegion());<a name="line.1378"></a>
+<span class="sourceLineNo">1379</span>      LOG.info("Flushing " + region.getRegionInfo().getRegionNameAsString());<a name="line.1379"></a>
+<span class="sourceLineNo">1380</span>      boolean shouldFlush = true;<a name="line.1380"></a>
+<span class="sourceLineNo">1381</span>      if (request.hasIfOlderThanTs()) {<a name="line.1381"></a>
+<span class="sourceLineNo">1382</span>        shouldFlush = region.getEarliestFlushTimeForAllStores() &lt; request.getIfOlderThanTs();<a name="line.1382"></a>
+<span class="sourceLineNo">1383</span>      }<a name="line.1383"></a>
+<span class="sourceLineNo">1384</span>      FlushRegionResponse.Builder builder = FlushRegionResponse.newBuilder();<a name="line.1384"></a>
+<span class="sourceLineNo">1385</span>      if (shouldFlush) {<a name="line.1385"></a>
+<span class="sourceLineNo">1386</span>        boolean writeFlushWalMarker =  request.hasWriteFlushWalMarker() ?<a name="line.1386"></a>
+<span class="sourceLineNo">1387</span>            request.getWriteFlushWalMarker() : false;<a name="line.1387"></a>
+<span class="sourceLineNo">1388</span>        long startTime = EnvironmentEdgeManager.currentTime();<a name="line.1388"></a>
+<span class="sourceLineNo">1389</span>        // Go behind the curtain so we can manage writing of the flush WAL marker<a name="line.1389"></a>
+<span class="sourceLineNo">1390</span>        HRegion.FlushResultImpl flushResult = (HRegion.FlushResultImpl)<a name="line.1390"></a>
+<span class="sourceLineNo">1391</span>            ((HRegion)region).flushcache(true, writeFlushWalMarker);<a name="line.1391"></a>
+<span class="sourceLineNo">1392</span>        if (flushResult.isFlushSucceeded()) {<a name="line.1392"></a>
+<span class="sourceLineNo">1393</span>          long endTime = EnvironmentEdgeManager.currentTime();<a name="line.1393"></a>
+<span class="sourceLineNo">1394</span>          regionServer.metricsRegionServer.updateFlushTime(endTime - startTime);<a name="line.1394"></a>
+<span class="sourceLineNo">1395</span>        }<a name="line.1395"></a>
+<span class="sourceLineNo">1396</span>        boolean compactionNeeded = flushResult.isCompactionNeeded();<a name="line.1396"></a>
+<span class="sourceLineNo">1397</span>        if (compactionNeeded) {<a name="line.1397"></a>
+<span class="sourceLineNo">1398</span>          regionServer.compactSplitThread.requestSystemCompaction(region,<a name="line.1398"></a>
+<span class="sourceLineNo">1399</span>            "Compaction through user triggered flush");<a name="line.1399"></a>
+<span class="sourceLineNo">1400</span>        }<a name="line.1400"></a>
+<span class="sourceLineNo">1401</span>        builder.setFlushed(flushResult.isFlushSucceeded());<a name="line.1401"></a>
+<span class="sourceLineNo">1402</span>        builder.setWroteFlushWalMarker(flushResult.wroteFlushWalMarker);<a name="line.1402"></a>
+<span class="sourceLineNo">1403</span>      }<a name="line.1403"></a>
+<span class="sourceLineNo">1404</span>      builder.setLastFlushTime(region.getEarliestFlushTimeForAllStores());<a name="line.1404"></a>
+<span class="sourceLineNo">1405</span>      return builder.build();<a name="line.1405"></a>
+<span class="sourceLineNo">1406</span>    } catch (DroppedSnapshotException ex) {<a name="line.1406"></a>
+<span class="sourceLineNo">1407</span>      // Cache flush can fail in a few places. If it fails in a critical<a name="line.1407"></a>
+<span class="sourceLineNo">1408</span>      // section, we get a DroppedSnapshotException and a replay of wal<a name="line.1408"></a>
+<span class="sourceLineNo">1409</span>      // is required. Currently the only way to do this is a restart of<a name="line.1409"></a>
+<span class="sourceLineNo">1410</span>      // the server.<a name="line.1410"></a>
+<span class="sourceLineNo">1411</span>      regionServer.abort("Replay of WAL required. Forcing server shutdown", ex);<a name="line.1411"></a>
+<span class="sourceLineNo">1412</span>      throw new ServiceException(ex);<a name="line.1412"></a>
+<span class="sourceLineNo">1413</span>    } catch (IOException ie) {<a name="line.1413"></a>
+<span class="sourceLineNo">1414</span>      throw new ServiceException(ie);<a name="line.1414"></a>
+<span class="sourceLineNo">1415</span>    }<a name="line.1415"></a>
+<span class="sourceLineNo">1416</span>  }<a name="line.1416"></a>
+<span class="sourceLineNo">1417</span><a name="line.1417"></a>
+<span class="sourceLineNo">1418</span>  @Override<a name="line.1418"></a>
+<span class="sourceLineNo">1419</span>  @QosPriority(priority=HConstants.ADMIN_QOS)<a name="line.1419"></a>
+<span class="sourceLineNo">1420</span>  public GetOnlineRegionResponse getOnlineRegion(final RpcController controller,<a name="line.1420"></a>
+<span class="sourceLineNo">1421</span>      final GetOnlineRegionRequest request) throws ServiceException {<a name="line.1421"></a>
+<span class="sourceLineNo">1422</span>    try {<a name="line.1422"></a>
+<span class="sourceLineNo">1423</span>      checkOpen();<a name="line.1423"></a>
+<span class="sourceLineNo">1424</span>      requestCount.increment();<a name="line.1424"></a>
+<span class="sourceLineNo">1425</span>      Map&lt;String, Region&gt; onlineRegions = regionServer.onlineRegions;<a name="line.1425"></a>
+<span class="sourceLineNo">1426</span>      List&lt;HRegionInfo&gt; list = new ArrayList&lt;HRegionInfo&gt;(onlineRegions.size());<a name="line.1426"></a>
+<span class="sourceLineNo">1427</span>      for (Region region: onlineRegions.values()) {<a name="line.1427"></a>
+<span class="sourceLineNo">1428</span>        list.add(region.getRegionInfo());<a name="line.1428"></a>
+<span class="sourceLineNo">1429</span>      }<a name="line.1429"></a>
+<span class="sourceLineNo">1430</span>      Collections.sort(list);<a name="line.1430"></a>
+<span class="sourceLineNo">1431</span>      return ResponseConverter.buildGetOnlineRegionResponse(list);<a name="line.1431"></a>
+<span class="sourceLineNo">1432</span>    } catch (IOException ie) {<a name="line.1432"></a>
+<span class="sourceLineNo">1433</span>      throw new ServiceException(ie);<a name="line.1433"></a>
+<span class="sourceLineNo">1434</span>    }<a name="line.1434"></a>
+<span class="sourceLineNo">1435</span>  }<a name="line.1435"></a>
+<span class="sourceLineNo">1436</span><a name="line.1436"></a>
+<span class="sourceLineNo">1437</span>  @Override<a name="line.1437"></a>
+<span class="sourceLineNo">1438</span>  @QosPriority(priority=HConstants.ADMIN_QOS)<a name="line.1438"></a>
+<span class="sourceLineNo">1439</span>  public GetRegionInfoResponse getRegionInfo(final RpcController controller,<a name="line.1439"></a>
+<span class="sourceLineNo">1440</span>      final GetRegionInfoRequest request) throws ServiceException {<a name="line.1440"></a>
+<span class="sourceLineNo">1441</span>    try {<a name="line.1441"></a>
+<span class="sourceLineNo">1442</span>      checkOpen();<a name="line.1442"></a>
+<span class="sourceLineNo">1443</span>      requestCount.increment();<a name="line.1443"></a>
+<span class="sourceLineNo">1444</span>      Region region = getRegion(request.getRegion());<a name="line.1444"></a>
+<span class="sourceLineNo">1445</span>      HRegionInfo info = region.getRegionInfo();<a name="line.1445"></a>
+<span class="sourceLineNo">1446</span>      GetRegionInfoResponse.Builder builder = GetRegionInfoResponse.newBuilder();<a name="line.1446"></a>
+<span class="sourceLineNo">1447</span>      builder.setRegionInfo(HRegionInfo.convert(info));<a name="line.1447"></a>
+<span class="sourceLineNo">1448</span>      if (request.hasCompactionState() &amp;&amp; request.getCompactionState()) {<a name="line.1448"></a>
+<span class="sourceLineNo">1449</span>        builder.setCompactionState(region.getCompactionState());<a name="line.1449"></a>
+<span class="sourceLineNo">1450</span>      }<a name="line.1450"></a>
+<span class="sourceLineNo">1451</span>      builder.setIsRecovering(region.isRecovering());<a name="line.1451"></a>
+<span class="sourceLineNo">1452</span>      return builder.build();<a name="line.1452"></a>
+<span class="sourceLineNo">1453</span>    } catch (IOException ie) {<a name="line.1453"></a>
+<span class="sourceLineNo">1454</span>      throw new ServiceException(ie);<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><a name="line.1457"></a>
+<span class="sourceLineNo">1458</span>  /**<a name="line.1458"></a>
+<span class="sourceLineNo">1459</span>   * Get some information of the region server.<a name="line.1459"></a>
+<span class="sourceLineNo">1460</span>   *<a name="line.1460"></a>
+<span class="sourceLineNo">1461</span>   * @param controller the RPC controller<a name="line.1461"></a>
+<span class="sourceLineNo">1462</span>   * @param request the request<a name="line.1462"></a>
+<span class="sourceLineNo">1463</span>   * @throws ServiceException<a name="line.1463"></a>
+<span class="sourceLineNo">1464</span>   */<a name="line.1464"></a>
+<span class="sourceLineNo">1465</span>  @Override<a name="line.1465"></a>
+<span class="sourceLineNo">1466</span>  @QosPriority(priority=HConstants.ADMIN_QOS)<a name="line.1466"></a>
+<span class="sourceLineNo">1467</span>  public GetServerInfoResponse getServerInfo(final RpcController controller,<a name="line.1467"></a>
+<span class="sourceLineNo">1468</span>      final GetServerInfoRequest request) throws ServiceException {<a name="line.1468"></a>
+<span class="sourceLineNo">1469</span>    try {<a name="line.1469"></a>
+<span class="sourceLineNo">1470</span>      checkOpen();<a name="line.1470"></a>
+<span class="sourceLineNo">1471</span>    } catch (IOException ie) {<a name="line.1471"></a>
+<span class="sourceLineNo">1472</span>      throw new ServiceException(ie);<a name="line.1472"></a>
+<span class="sourceLineNo">1473</span>    }<a name="line.1473"></a>
+<span class="sourceLineNo">1474</span>    requestCount.increment();<a name="line.1474"></a>
+<span class="sourceLineNo">1475</span>    int infoPort = regionServer.infoServer != null ? regionServer.infoServer.getPort() : -1;<a name="line.1475"></a>
+<span class="sourceLineNo">1476</span>    return ResponseConverter.buildGetServerInfoResponse(regionServer.serverName, infoPort);<a name="line.1476"></a>
+<span class="sourceLineNo">1477</span>  }<a name="line.1477"></a>
+<span class="sourceLineNo">1478</span><a name="line.1478"></a>
+<span class="sourceLineNo">1479</span>  @Override<a name="line.1479"></a>
+<span class="sourceLineNo">1480</span>  @QosPriority(priority=HConstants.ADMIN_QOS)<a name="line.1480"></a>
+<span class="sourceLineNo">1481</span>  public GetStoreFileResponse getStoreFile(final RpcController controller,<a name="line.1481"></a>
+<span class="sourceLineNo">1482</span>      final GetStoreFileRequest request) throws ServiceException {<a name="line.1482"></a>
+<span class="sourceLineNo">1483</span>    try {<a name="line.1483"></a>
+<span class="sourceLineNo">1484</span>      checkOpen();<a name="line.1484"></a>
+<span class="sourceLineNo">1485</span>      Region region = getRegion(request.getRegion());<a name="line.1485"></a>
+<span class="sourceLineNo">1486</span>      requestCount.increment();<a name="line.1486"></a>
+<span class="sourceLineNo">1487</span>      Set&lt;byte[]&gt; columnFamilies;<a name="line.1487"></a>
+<span class="sourceLineNo">1488</span>      if (request.getFamilyCount() == 0) {<a name="line.1488"></a>
+<span class="sourceLineNo">1489</span>        columnFamilies = region.getTableDesc().getFamiliesKeys();<a name="line.1489"></a>
+<span class="sourceLineNo">1490</span>      } else {<a name="line.1490"></a>
+<span class="sourceLineNo">1491</span>        columnFamilies = new TreeSet&lt;byte[]&gt;(Bytes.BYTES_RAWCOMPARATOR);<a name="line.1491"></a>
+<span class="sourceLineNo">1492</span>        for (ByteString cf: request.getFamilyList()) {<a name="line.1492"></a>
+<span class="sourceLineNo">1493</span>          columnFamilies.add(cf.toByteArray());<a name="line.1493"></a>
+<span class="sourceLineNo">1494</span>        }<a name="line.1494"></a>
+<span class="sourceLineNo">1495</span>      }<a name="line.1495"></a>
+<span class="sourceLineNo">1496</span>      int nCF = columnFamilies.size();<a name="line.1496"></a>
+<span class="sourceLineNo">1497</span>      List&lt;String&gt;  fileList = region.getStoreFileList(<a name="line.1497"></a>
+<span class="sourceLineNo">1498</span>        columnFamilies.toArray(new byte[nCF][]));<a name="line.1498"></a>
+<span class="sourceLineNo">1499</span>      GetStoreFileResponse.Builder builder = GetStoreFileResponse.newBuilder();<a name="line.1499"></a>
+<span class="sourceLineNo">1500</span>      builder.addAllStoreFile(fileList);<a name="line.1500"></a>
+<span class="sourceLineNo">1501</span>      return builder.build();<a name="line.1501"></a>
+<span class="sourceLineNo">1502</span>    } catch (IOException ie) {<a name="line.1502"></a>
+<span class="sourceLineNo">1503</span>      throw new ServiceException(ie);<a name="line.1503"></a>
+<span class="sourceLineNo">1504</span>    }<a name="line.1504"></a>
+<span class="sourceLineNo">1505</span>  }<a name="line.1505"></a>
+<span class="sourceLineNo">1506</span><a name="line.1506"></a>
+<span class="sourceLineNo">1507</span>  /**<a name="line.1507"></a>
+<span class="sourceLineNo">1508</span>   * Merge regions on the region server.<a name="line.1508"></a>
+<span class="sourceLineNo">1509</span>   *<a name="line.1509"></a>
+<span class="sourceLineNo">1510</span>   * @param controller the RPC controller<a name="line.1510"></a>
+<span class="sourceLineNo">1511</span>   * @param request the request<a name="line.1511"></a>
+<span class="sourceLineNo">1512</span>   * @return merge regions response<a name="line.1512"></a>
+<span class="sourceLineNo">1513</span>   * @throws ServiceException<a name="line.1513"></a>
+<span class="sourceLineNo">1514</span>   */<a name="line.1514"></a>
+<span class="sourceLineNo">1515</span>  @O

<TRUNCATED>

Mime
View raw message