hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From git-site-r...@apache.org
Subject [13/32] hbase-site git commit: Published site at 82d554e3783372cc6b05489452c815b57c06f6cd.
Date Fri, 02 Jun 2017 15:00:14 GMT
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/7e7efd3e/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/HRegionServer.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/HRegionServer.html b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/HRegionServer.html
index 8e8e860..e4a10f2 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/HRegionServer.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/HRegionServer.html
@@ -2208,1514 +2208,1513 @@
 <span class="sourceLineNo">2200</span>        ReportRegionStateTransitionResponse response =<a name="line.2200"></a>
 <span class="sourceLineNo">2201</span>          rss.reportRegionStateTransition(null, request);<a name="line.2201"></a>
 <span class="sourceLineNo">2202</span>        if (response.hasErrorMessage()) {<a name="line.2202"></a>
-<span class="sourceLineNo">2203</span>          LOG.info("Failed transition " + hris[0]<a name="line.2203"></a>
-<span class="sourceLineNo">2204</span>            + " to " + code + ": " + response.getErrorMessage());<a name="line.2204"></a>
+<span class="sourceLineNo">2203</span>          LOG.info("TRANSITION FAILED " + request + ": " + response.getErrorMessage());<a name="line.2203"></a>
+<span class="sourceLineNo">2204</span>          // NOTE: Return mid-method!!!<a name="line.2204"></a>
 <span class="sourceLineNo">2205</span>          return false;<a name="line.2205"></a>
 <span class="sourceLineNo">2206</span>        }<a name="line.2206"></a>
 <span class="sourceLineNo">2207</span>        // Log if we had to retry else don't log unless TRACE. We want to<a name="line.2207"></a>
 <span class="sourceLineNo">2208</span>        // know if were successful after an attempt showed in logs as failed.<a name="line.2208"></a>
 <span class="sourceLineNo">2209</span>        if (tries &gt; 0 || LOG.isTraceEnabled()) {<a name="line.2209"></a>
-<span class="sourceLineNo">2210</span>          LOG.trace("TRANSITION REPORTED " + request);<a name="line.2210"></a>
+<span class="sourceLineNo">2210</span>          LOG.info("TRANSITION REPORTED " + request);<a name="line.2210"></a>
 <span class="sourceLineNo">2211</span>        }<a name="line.2211"></a>
-<span class="sourceLineNo">2212</span>        return true;<a name="line.2212"></a>
-<span class="sourceLineNo">2213</span>      } catch (ServiceException se) {<a name="line.2213"></a>
-<span class="sourceLineNo">2214</span>        IOException ioe = ProtobufUtil.getRemoteException(se);<a name="line.2214"></a>
-<span class="sourceLineNo">2215</span>        boolean pause = ioe instanceof ServerNotRunningYetException ||<a name="line.2215"></a>
-<span class="sourceLineNo">2216</span>            ioe instanceof PleaseHoldException;<a name="line.2216"></a>
-<span class="sourceLineNo">2217</span>        if (pause) {<a name="line.2217"></a>
-<span class="sourceLineNo">2218</span>          // Do backoff else we flood the Master with requests.<a name="line.2218"></a>
-<span class="sourceLineNo">2219</span>          pauseTime = ConnectionUtils.getPauseTime(pauseTime, tries);<a name="line.2219"></a>
-<span class="sourceLineNo">2220</span>        } else {<a name="line.2220"></a>
-<span class="sourceLineNo">2221</span>          pauseTime = INIT_PAUSE_TIME_MS; // Reset.<a name="line.2221"></a>
-<span class="sourceLineNo">2222</span>        }<a name="line.2222"></a>
-<span class="sourceLineNo">2223</span>        LOG.info("Failed report of region transition " +<a name="line.2223"></a>
-<span class="sourceLineNo">2224</span>          TextFormat.shortDebugString(request) + "; retry (#" + tries + ")" +<a name="line.2224"></a>
-<span class="sourceLineNo">2225</span>            (pause?<a name="line.2225"></a>
-<span class="sourceLineNo">2226</span>                " after " + pauseTime + "ms delay (Master is coming online...).":<a name="line.2226"></a>
-<span class="sourceLineNo">2227</span>                " immediately."),<a name="line.2227"></a>
-<span class="sourceLineNo">2228</span>            ioe);<a name="line.2228"></a>
-<span class="sourceLineNo">2229</span>        if (pause) Threads.sleep(pauseTime);<a name="line.2229"></a>
-<span class="sourceLineNo">2230</span>        tries++;<a name="line.2230"></a>
-<span class="sourceLineNo">2231</span>        if (rssStub == rss) {<a name="line.2231"></a>
-<span class="sourceLineNo">2232</span>          rssStub = null;<a name="line.2232"></a>
-<span class="sourceLineNo">2233</span>        }<a name="line.2233"></a>
-<span class="sourceLineNo">2234</span>      }<a name="line.2234"></a>
-<span class="sourceLineNo">2235</span>    }<a name="line.2235"></a>
-<span class="sourceLineNo">2236</span>    if (LOG.isTraceEnabled()) {<a name="line.2236"></a>
-<span class="sourceLineNo">2237</span>      LOG.trace("TRANSITION NOT REPORTED " + request);<a name="line.2237"></a>
-<span class="sourceLineNo">2238</span>    }<a name="line.2238"></a>
-<span class="sourceLineNo">2239</span>    return false;<a name="line.2239"></a>
-<span class="sourceLineNo">2240</span>  }<a name="line.2240"></a>
-<span class="sourceLineNo">2241</span><a name="line.2241"></a>
-<span class="sourceLineNo">2242</span>  /**<a name="line.2242"></a>
-<span class="sourceLineNo">2243</span>   * Trigger a flush in the primary region replica if this region is a secondary replica. Does not<a name="line.2243"></a>
-<span class="sourceLineNo">2244</span>   * block this thread. See RegionReplicaFlushHandler for details.<a name="line.2244"></a>
-<span class="sourceLineNo">2245</span>   */<a name="line.2245"></a>
-<span class="sourceLineNo">2246</span>  void triggerFlushInPrimaryRegion(final HRegion region) {<a name="line.2246"></a>
-<span class="sourceLineNo">2247</span>    if (ServerRegionReplicaUtil.isDefaultReplica(region.getRegionInfo())) {<a name="line.2247"></a>
-<span class="sourceLineNo">2248</span>      return;<a name="line.2248"></a>
-<span class="sourceLineNo">2249</span>    }<a name="line.2249"></a>
-<span class="sourceLineNo">2250</span>    if (!ServerRegionReplicaUtil.isRegionReplicaReplicationEnabled(region.conf) ||<a name="line.2250"></a>
-<span class="sourceLineNo">2251</span>        !ServerRegionReplicaUtil.isRegionReplicaWaitForPrimaryFlushEnabled(<a name="line.2251"></a>
-<span class="sourceLineNo">2252</span>          region.conf)) {<a name="line.2252"></a>
-<span class="sourceLineNo">2253</span>      region.setReadsEnabled(true);<a name="line.2253"></a>
-<span class="sourceLineNo">2254</span>      return;<a name="line.2254"></a>
-<span class="sourceLineNo">2255</span>    }<a name="line.2255"></a>
-<span class="sourceLineNo">2256</span><a name="line.2256"></a>
-<span class="sourceLineNo">2257</span>    region.setReadsEnabled(false); // disable reads before marking the region as opened.<a name="line.2257"></a>
-<span class="sourceLineNo">2258</span>    // RegionReplicaFlushHandler might reset this.<a name="line.2258"></a>
-<span class="sourceLineNo">2259</span><a name="line.2259"></a>
-<span class="sourceLineNo">2260</span>    // submit it to be handled by one of the handlers so that we do not block OpenRegionHandler<a name="line.2260"></a>
-<span class="sourceLineNo">2261</span>    this.service.submit(<a name="line.2261"></a>
-<span class="sourceLineNo">2262</span>      new RegionReplicaFlushHandler(this, clusterConnection,<a name="line.2262"></a>
-<span class="sourceLineNo">2263</span>        rpcRetryingCallerFactory, rpcControllerFactory, operationTimeout, region));<a name="line.2263"></a>
-<span class="sourceLineNo">2264</span>  }<a name="line.2264"></a>
-<span class="sourceLineNo">2265</span><a name="line.2265"></a>
-<span class="sourceLineNo">2266</span>  @Override<a name="line.2266"></a>
-<span class="sourceLineNo">2267</span>  public RpcServerInterface getRpcServer() {<a name="line.2267"></a>
-<span class="sourceLineNo">2268</span>    return rpcServices.rpcServer;<a name="line.2268"></a>
-<span class="sourceLineNo">2269</span>  }<a name="line.2269"></a>
-<span class="sourceLineNo">2270</span><a name="line.2270"></a>
-<span class="sourceLineNo">2271</span>  @VisibleForTesting<a name="line.2271"></a>
-<span class="sourceLineNo">2272</span>  public RSRpcServices getRSRpcServices() {<a name="line.2272"></a>
-<span class="sourceLineNo">2273</span>    return rpcServices;<a name="line.2273"></a>
-<span class="sourceLineNo">2274</span>  }<a name="line.2274"></a>
-<span class="sourceLineNo">2275</span><a name="line.2275"></a>
-<span class="sourceLineNo">2276</span>  /**<a name="line.2276"></a>
-<span class="sourceLineNo">2277</span>   * Cause the server to exit without closing the regions it is serving, the log<a name="line.2277"></a>
-<span class="sourceLineNo">2278</span>   * it is using and without notifying the master. Used unit testing and on<a name="line.2278"></a>
-<span class="sourceLineNo">2279</span>   * catastrophic events such as HDFS is yanked out from under hbase or we OOME.<a name="line.2279"></a>
-<span class="sourceLineNo">2280</span>   *<a name="line.2280"></a>
-<span class="sourceLineNo">2281</span>   * @param reason<a name="line.2281"></a>
-<span class="sourceLineNo">2282</span>   *          the reason we are aborting<a name="line.2282"></a>
-<span class="sourceLineNo">2283</span>   * @param cause<a name="line.2283"></a>
-<span class="sourceLineNo">2284</span>   *          the exception that caused the abort, or null<a name="line.2284"></a>
-<span class="sourceLineNo">2285</span>   */<a name="line.2285"></a>
-<span class="sourceLineNo">2286</span>  @Override<a name="line.2286"></a>
-<span class="sourceLineNo">2287</span>  public void abort(String reason, Throwable cause) {<a name="line.2287"></a>
-<span class="sourceLineNo">2288</span>    String msg = "***** ABORTING region server " + this + ": " + reason + " *****";<a name="line.2288"></a>
-<span class="sourceLineNo">2289</span>    if (cause != null) {<a name="line.2289"></a>
-<span class="sourceLineNo">2290</span>      LOG.fatal(msg, cause);<a name="line.2290"></a>
-<span class="sourceLineNo">2291</span>    } else {<a name="line.2291"></a>
-<span class="sourceLineNo">2292</span>      LOG.fatal(msg);<a name="line.2292"></a>
-<span class="sourceLineNo">2293</span>    }<a name="line.2293"></a>
-<span class="sourceLineNo">2294</span>    this.abortRequested = true;<a name="line.2294"></a>
-<span class="sourceLineNo">2295</span>    // HBASE-4014: show list of coprocessors that were loaded to help debug<a name="line.2295"></a>
-<span class="sourceLineNo">2296</span>    // regionserver crashes.Note that we're implicitly using<a name="line.2296"></a>
-<span class="sourceLineNo">2297</span>    // java.util.HashSet's toString() method to print the coprocessor names.<a name="line.2297"></a>
-<span class="sourceLineNo">2298</span>    LOG.fatal("RegionServer abort: loaded coprocessors are: " +<a name="line.2298"></a>
-<span class="sourceLineNo">2299</span>        CoprocessorHost.getLoadedCoprocessors());<a name="line.2299"></a>
-<span class="sourceLineNo">2300</span>    // Try and dump metrics if abort -- might give clue as to how fatal came about....<a name="line.2300"></a>
-<span class="sourceLineNo">2301</span>    try {<a name="line.2301"></a>
-<span class="sourceLineNo">2302</span>      LOG.info("Dump of metrics as JSON on abort: " + JSONBean.dumpRegionServerMetrics());<a name="line.2302"></a>
-<span class="sourceLineNo">2303</span>    } catch (MalformedObjectNameException | IOException e) {<a name="line.2303"></a>
-<span class="sourceLineNo">2304</span>      LOG.warn("Failed dumping metrics", e);<a name="line.2304"></a>
-<span class="sourceLineNo">2305</span>    }<a name="line.2305"></a>
-<span class="sourceLineNo">2306</span><a name="line.2306"></a>
-<span class="sourceLineNo">2307</span>    // Do our best to report our abort to the master, but this may not work<a name="line.2307"></a>
-<span class="sourceLineNo">2308</span>    try {<a name="line.2308"></a>
-<span class="sourceLineNo">2309</span>      if (cause != null) {<a name="line.2309"></a>
-<span class="sourceLineNo">2310</span>        msg += "\nCause:\n" + StringUtils.stringifyException(cause);<a name="line.2310"></a>
-<span class="sourceLineNo">2311</span>      }<a name="line.2311"></a>
-<span class="sourceLineNo">2312</span>      // Report to the master but only if we have already registered with the master.<a name="line.2312"></a>
-<span class="sourceLineNo">2313</span>      if (rssStub != null &amp;&amp; this.serverName != null) {<a name="line.2313"></a>
-<span class="sourceLineNo">2314</span>        ReportRSFatalErrorRequest.Builder builder =<a name="line.2314"></a>
-<span class="sourceLineNo">2315</span>          ReportRSFatalErrorRequest.newBuilder();<a name="line.2315"></a>
-<span class="sourceLineNo">2316</span>        ServerName sn =<a name="line.2316"></a>
-<span class="sourceLineNo">2317</span>          ServerName.parseVersionedServerName(this.serverName.getVersionedBytes());<a name="line.2317"></a>
-<span class="sourceLineNo">2318</span>        builder.setServer(ProtobufUtil.toServerName(sn));<a name="line.2318"></a>
-<span class="sourceLineNo">2319</span>        builder.setErrorMessage(msg);<a name="line.2319"></a>
-<span class="sourceLineNo">2320</span>        rssStub.reportRSFatalError(null, builder.build());<a name="line.2320"></a>
-<span class="sourceLineNo">2321</span>      }<a name="line.2321"></a>
-<span class="sourceLineNo">2322</span>    } catch (Throwable t) {<a name="line.2322"></a>
-<span class="sourceLineNo">2323</span>      LOG.warn("Unable to report fatal error to master", t);<a name="line.2323"></a>
-<span class="sourceLineNo">2324</span>    }<a name="line.2324"></a>
-<span class="sourceLineNo">2325</span>    stop(reason);<a name="line.2325"></a>
-<span class="sourceLineNo">2326</span>  }<a name="line.2326"></a>
-<span class="sourceLineNo">2327</span><a name="line.2327"></a>
-<span class="sourceLineNo">2328</span>  /**<a name="line.2328"></a>
-<span class="sourceLineNo">2329</span>   * @see HRegionServer#abort(String, Throwable)<a name="line.2329"></a>
-<span class="sourceLineNo">2330</span>   */<a name="line.2330"></a>
-<span class="sourceLineNo">2331</span>  public void abort(String reason) {<a name="line.2331"></a>
-<span class="sourceLineNo">2332</span>    abort(reason, null);<a name="line.2332"></a>
-<span class="sourceLineNo">2333</span>  }<a name="line.2333"></a>
-<span class="sourceLineNo">2334</span><a name="line.2334"></a>
-<span class="sourceLineNo">2335</span>  @Override<a name="line.2335"></a>
-<span class="sourceLineNo">2336</span>  public boolean isAborted() {<a name="line.2336"></a>
-<span class="sourceLineNo">2337</span>    return this.abortRequested;<a name="line.2337"></a>
-<span class="sourceLineNo">2338</span>  }<a name="line.2338"></a>
-<span class="sourceLineNo">2339</span><a name="line.2339"></a>
-<span class="sourceLineNo">2340</span>  /*<a name="line.2340"></a>
-<span class="sourceLineNo">2341</span>   * Simulate a kill -9 of this server. Exits w/o closing regions or cleaninup<a name="line.2341"></a>
-<span class="sourceLineNo">2342</span>   * logs but it does close socket in case want to bring up server on old<a name="line.2342"></a>
-<span class="sourceLineNo">2343</span>   * hostname+port immediately.<a name="line.2343"></a>
-<span class="sourceLineNo">2344</span>   */<a name="line.2344"></a>
-<span class="sourceLineNo">2345</span>  @VisibleForTesting<a name="line.2345"></a>
-<span class="sourceLineNo">2346</span>  protected void kill() {<a name="line.2346"></a>
-<span class="sourceLineNo">2347</span>    this.killed = true;<a name="line.2347"></a>
-<span class="sourceLineNo">2348</span>    abort("Simulated kill");<a name="line.2348"></a>
-<span class="sourceLineNo">2349</span>  }<a name="line.2349"></a>
-<span class="sourceLineNo">2350</span><a name="line.2350"></a>
-<span class="sourceLineNo">2351</span>  /**<a name="line.2351"></a>
-<span class="sourceLineNo">2352</span>   * Called on stop/abort before closing the cluster connection and meta locator.<a name="line.2352"></a>
-<span class="sourceLineNo">2353</span>   */<a name="line.2353"></a>
-<span class="sourceLineNo">2354</span>  protected void sendShutdownInterrupt() {<a name="line.2354"></a>
-<span class="sourceLineNo">2355</span>  }<a name="line.2355"></a>
-<span class="sourceLineNo">2356</span><a name="line.2356"></a>
-<span class="sourceLineNo">2357</span>  /**<a name="line.2357"></a>
-<span class="sourceLineNo">2358</span>   * Wait on all threads to finish. Presumption is that all closes and stops<a name="line.2358"></a>
-<span class="sourceLineNo">2359</span>   * have already been called.<a name="line.2359"></a>
-<span class="sourceLineNo">2360</span>   */<a name="line.2360"></a>
-<span class="sourceLineNo">2361</span>  protected void stopServiceThreads() {<a name="line.2361"></a>
-<span class="sourceLineNo">2362</span>    // clean up the scheduled chores<a name="line.2362"></a>
-<span class="sourceLineNo">2363</span>    if (this.choreService != null) choreService.shutdown();<a name="line.2363"></a>
-<span class="sourceLineNo">2364</span>    if (this.nonceManagerChore != null) nonceManagerChore.cancel(true);<a name="line.2364"></a>
-<span class="sourceLineNo">2365</span>    if (this.compactionChecker != null) compactionChecker.cancel(true);<a name="line.2365"></a>
-<span class="sourceLineNo">2366</span>    if (this.periodicFlusher != null) periodicFlusher.cancel(true);<a name="line.2366"></a>
-<span class="sourceLineNo">2367</span>    if (this.healthCheckChore != null) healthCheckChore.cancel(true);<a name="line.2367"></a>
-<span class="sourceLineNo">2368</span>    if (this.storefileRefresher != null) storefileRefresher.cancel(true);<a name="line.2368"></a>
-<span class="sourceLineNo">2369</span>    if (this.movedRegionsCleaner != null) movedRegionsCleaner.cancel(true);<a name="line.2369"></a>
-<span class="sourceLineNo">2370</span>    if (this.fsUtilizationChore != null) fsUtilizationChore.cancel(true);<a name="line.2370"></a>
-<span class="sourceLineNo">2371</span><a name="line.2371"></a>
-<span class="sourceLineNo">2372</span>    if (this.cacheFlusher != null) {<a name="line.2372"></a>
-<span class="sourceLineNo">2373</span>      this.cacheFlusher.join();<a name="line.2373"></a>
-<span class="sourceLineNo">2374</span>    }<a name="line.2374"></a>
-<span class="sourceLineNo">2375</span><a name="line.2375"></a>
-<span class="sourceLineNo">2376</span>    if (this.spanReceiverHost != null) {<a name="line.2376"></a>
-<span class="sourceLineNo">2377</span>      this.spanReceiverHost.closeReceivers();<a name="line.2377"></a>
-<span class="sourceLineNo">2378</span>    }<a name="line.2378"></a>
-<span class="sourceLineNo">2379</span>    if (this.walRoller != null) {<a name="line.2379"></a>
-<span class="sourceLineNo">2380</span>      this.walRoller.close();<a name="line.2380"></a>
-<span class="sourceLineNo">2381</span>    }<a name="line.2381"></a>
-<span class="sourceLineNo">2382</span>    if (this.compactSplitThread != null) {<a name="line.2382"></a>
-<span class="sourceLineNo">2383</span>      this.compactSplitThread.join();<a name="line.2383"></a>
-<span class="sourceLineNo">2384</span>    }<a name="line.2384"></a>
-<span class="sourceLineNo">2385</span>    if (this.service != null) this.service.shutdown();<a name="line.2385"></a>
-<span class="sourceLineNo">2386</span>    if (this.replicationSourceHandler != null &amp;&amp;<a name="line.2386"></a>
-<span class="sourceLineNo">2387</span>        this.replicationSourceHandler == this.replicationSinkHandler) {<a name="line.2387"></a>
-<span class="sourceLineNo">2388</span>      this.replicationSourceHandler.stopReplicationService();<a name="line.2388"></a>
-<span class="sourceLineNo">2389</span>    } else {<a name="line.2389"></a>
-<span class="sourceLineNo">2390</span>      if (this.replicationSourceHandler != null) {<a name="line.2390"></a>
-<span class="sourceLineNo">2391</span>        this.replicationSourceHandler.stopReplicationService();<a name="line.2391"></a>
-<span class="sourceLineNo">2392</span>      }<a name="line.2392"></a>
-<span class="sourceLineNo">2393</span>      if (this.replicationSinkHandler != null) {<a name="line.2393"></a>
-<span class="sourceLineNo">2394</span>        this.replicationSinkHandler.stopReplicationService();<a name="line.2394"></a>
-<span class="sourceLineNo">2395</span>      }<a name="line.2395"></a>
-<span class="sourceLineNo">2396</span>    }<a name="line.2396"></a>
-<span class="sourceLineNo">2397</span>  }<a name="line.2397"></a>
-<span class="sourceLineNo">2398</span><a name="line.2398"></a>
-<span class="sourceLineNo">2399</span>  /**<a name="line.2399"></a>
-<span class="sourceLineNo">2400</span>   * @return Return the object that implements the replication<a name="line.2400"></a>
-<span class="sourceLineNo">2401</span>   * source service.<a name="line.2401"></a>
-<span class="sourceLineNo">2402</span>   */<a name="line.2402"></a>
-<span class="sourceLineNo">2403</span>  @VisibleForTesting<a name="line.2403"></a>
-<span class="sourceLineNo">2404</span>  public ReplicationSourceService getReplicationSourceService() {<a name="line.2404"></a>
-<span class="sourceLineNo">2405</span>    return replicationSourceHandler;<a name="line.2405"></a>
-<span class="sourceLineNo">2406</span>  }<a name="line.2406"></a>
-<span class="sourceLineNo">2407</span><a name="line.2407"></a>
-<span class="sourceLineNo">2408</span>  /**<a name="line.2408"></a>
-<span class="sourceLineNo">2409</span>   * @return Return the object that implements the replication<a name="line.2409"></a>
-<span class="sourceLineNo">2410</span>   * sink service.<a name="line.2410"></a>
-<span class="sourceLineNo">2411</span>   */<a name="line.2411"></a>
-<span class="sourceLineNo">2412</span>  ReplicationSinkService getReplicationSinkService() {<a name="line.2412"></a>
-<span class="sourceLineNo">2413</span>    return replicationSinkHandler;<a name="line.2413"></a>
-<span class="sourceLineNo">2414</span>  }<a name="line.2414"></a>
-<span class="sourceLineNo">2415</span><a name="line.2415"></a>
-<span class="sourceLineNo">2416</span>  /**<a name="line.2416"></a>
-<span class="sourceLineNo">2417</span>   * Get the current master from ZooKeeper and open the RPC connection to it.<a name="line.2417"></a>
-<span class="sourceLineNo">2418</span>   * To get a fresh connection, the current rssStub must be null.<a name="line.2418"></a>
-<span class="sourceLineNo">2419</span>   * Method will block until a master is available. You can break from this<a name="line.2419"></a>
-<span class="sourceLineNo">2420</span>   * block by requesting the server stop.<a name="line.2420"></a>
-<span class="sourceLineNo">2421</span>   *<a name="line.2421"></a>
-<span class="sourceLineNo">2422</span>   * @return master + port, or null if server has been stopped<a name="line.2422"></a>
-<span class="sourceLineNo">2423</span>   */<a name="line.2423"></a>
-<span class="sourceLineNo">2424</span>  @VisibleForTesting<a name="line.2424"></a>
-<span class="sourceLineNo">2425</span>  protected synchronized ServerName createRegionServerStatusStub() {<a name="line.2425"></a>
-<span class="sourceLineNo">2426</span>    // Create RS stub without refreshing the master node from ZK, use cached data<a name="line.2426"></a>
-<span class="sourceLineNo">2427</span>    return createRegionServerStatusStub(false);<a name="line.2427"></a>
-<span class="sourceLineNo">2428</span>  }<a name="line.2428"></a>
-<span class="sourceLineNo">2429</span><a name="line.2429"></a>
-<span class="sourceLineNo">2430</span>  /**<a name="line.2430"></a>
-<span class="sourceLineNo">2431</span>   * Get the current master from ZooKeeper and open the RPC connection to it. To get a fresh<a name="line.2431"></a>
-<span class="sourceLineNo">2432</span>   * connection, the current rssStub must be null. Method will block until a master is available.<a name="line.2432"></a>
-<span class="sourceLineNo">2433</span>   * You can break from this block by requesting the server stop.<a name="line.2433"></a>
-<span class="sourceLineNo">2434</span>   * @param refresh If true then master address will be read from ZK, otherwise use cached data<a name="line.2434"></a>
-<span class="sourceLineNo">2435</span>   * @return master + port, or null if server has been stopped<a name="line.2435"></a>
-<span class="sourceLineNo">2436</span>   */<a name="line.2436"></a>
-<span class="sourceLineNo">2437</span>  @VisibleForTesting<a name="line.2437"></a>
-<span class="sourceLineNo">2438</span>  protected synchronized ServerName createRegionServerStatusStub(boolean refresh) {<a name="line.2438"></a>
-<span class="sourceLineNo">2439</span>    if (rssStub != null) {<a name="line.2439"></a>
-<span class="sourceLineNo">2440</span>      return masterAddressTracker.getMasterAddress();<a name="line.2440"></a>
-<span class="sourceLineNo">2441</span>    }<a name="line.2441"></a>
-<span class="sourceLineNo">2442</span>    ServerName sn = null;<a name="line.2442"></a>
-<span class="sourceLineNo">2443</span>    long previousLogTime = 0;<a name="line.2443"></a>
-<span class="sourceLineNo">2444</span>    RegionServerStatusService.BlockingInterface intRssStub = null;<a name="line.2444"></a>
-<span class="sourceLineNo">2445</span>    LockService.BlockingInterface intLockStub = null;<a name="line.2445"></a>
-<span class="sourceLineNo">2446</span>    boolean interrupted = false;<a name="line.2446"></a>
-<span class="sourceLineNo">2447</span>    try {<a name="line.2447"></a>
-<span class="sourceLineNo">2448</span>      while (keepLooping()) {<a name="line.2448"></a>
-<span class="sourceLineNo">2449</span>        sn = this.masterAddressTracker.getMasterAddress(refresh);<a name="line.2449"></a>
-<span class="sourceLineNo">2450</span>        if (sn == null) {<a name="line.2450"></a>
-<span class="sourceLineNo">2451</span>          if (!keepLooping()) {<a name="line.2451"></a>
-<span class="sourceLineNo">2452</span>            // give up with no connection.<a name="line.2452"></a>
-<span class="sourceLineNo">2453</span>            LOG.debug("No master found and cluster is stopped; bailing out");<a name="line.2453"></a>
-<span class="sourceLineNo">2454</span>            return null;<a name="line.2454"></a>
-<span class="sourceLineNo">2455</span>          }<a name="line.2455"></a>
-<span class="sourceLineNo">2456</span>          if (System.currentTimeMillis() &gt; (previousLogTime + 1000)) {<a name="line.2456"></a>
-<span class="sourceLineNo">2457</span>            LOG.debug("No master found; retry");<a name="line.2457"></a>
-<span class="sourceLineNo">2458</span>            previousLogTime = System.currentTimeMillis();<a name="line.2458"></a>
-<span class="sourceLineNo">2459</span>          }<a name="line.2459"></a>
-<span class="sourceLineNo">2460</span>          refresh = true; // let's try pull it from ZK directly<a name="line.2460"></a>
-<span class="sourceLineNo">2461</span>          if (sleep(200)) {<a name="line.2461"></a>
-<span class="sourceLineNo">2462</span>            interrupted = true;<a name="line.2462"></a>
-<span class="sourceLineNo">2463</span>          }<a name="line.2463"></a>
-<span class="sourceLineNo">2464</span>          continue;<a name="line.2464"></a>
-<span class="sourceLineNo">2465</span>        }<a name="line.2465"></a>
-<span class="sourceLineNo">2466</span><a name="line.2466"></a>
-<span class="sourceLineNo">2467</span>        // If we are on the active master, use the shortcut<a name="line.2467"></a>
-<span class="sourceLineNo">2468</span>        if (this instanceof HMaster &amp;&amp; sn.equals(getServerName())) {<a name="line.2468"></a>
-<span class="sourceLineNo">2469</span>          intRssStub = ((HMaster)this).getMasterRpcServices();<a name="line.2469"></a>
-<span class="sourceLineNo">2470</span>          intLockStub = ((HMaster)this).getMasterRpcServices();<a name="line.2470"></a>
-<span class="sourceLineNo">2471</span>          break;<a name="line.2471"></a>
-<span class="sourceLineNo">2472</span>        }<a name="line.2472"></a>
-<span class="sourceLineNo">2473</span>        try {<a name="line.2473"></a>
-<span class="sourceLineNo">2474</span>          BlockingRpcChannel channel =<a name="line.2474"></a>
-<span class="sourceLineNo">2475</span>            this.rpcClient.createBlockingRpcChannel(sn, userProvider.getCurrent(),<a name="line.2475"></a>
-<span class="sourceLineNo">2476</span>              shortOperationTimeout);<a name="line.2476"></a>
-<span class="sourceLineNo">2477</span>          intRssStub = RegionServerStatusService.newBlockingStub(channel);<a name="line.2477"></a>
-<span class="sourceLineNo">2478</span>          intLockStub = LockService.newBlockingStub(channel);<a name="line.2478"></a>
-<span class="sourceLineNo">2479</span>          break;<a name="line.2479"></a>
-<span class="sourceLineNo">2480</span>        } catch (IOException e) {<a name="line.2480"></a>
-<span class="sourceLineNo">2481</span>          if (System.currentTimeMillis() &gt; (previousLogTime + 1000)) {<a name="line.2481"></a>
-<span class="sourceLineNo">2482</span>            e = e instanceof RemoteException ?<a name="line.2482"></a>
-<span class="sourceLineNo">2483</span>              ((RemoteException)e).unwrapRemoteException() : e;<a name="line.2483"></a>
-<span class="sourceLineNo">2484</span>            if (e instanceof ServerNotRunningYetException) {<a name="line.2484"></a>
-<span class="sourceLineNo">2485</span>              LOG.info("Master isn't available yet, retrying");<a name="line.2485"></a>
-<span class="sourceLineNo">2486</span>            } else {<a name="line.2486"></a>
-<span class="sourceLineNo">2487</span>              LOG.warn("Unable to connect to master. Retrying. Error was:", e);<a name="line.2487"></a>
-<span class="sourceLineNo">2488</span>            }<a name="line.2488"></a>
-<span class="sourceLineNo">2489</span>            previousLogTime = System.currentTimeMillis();<a name="line.2489"></a>
-<span class="sourceLineNo">2490</span>          }<a name="line.2490"></a>
-<span class="sourceLineNo">2491</span>          if (sleep(200)) {<a name="line.2491"></a>
-<span class="sourceLineNo">2492</span>            interrupted = true;<a name="line.2492"></a>
-<span class="sourceLineNo">2493</span>          }<a name="line.2493"></a>
-<span class="sourceLineNo">2494</span>        }<a name="line.2494"></a>
-<span class="sourceLineNo">2495</span>      }<a name="line.2495"></a>
-<span class="sourceLineNo">2496</span>    } finally {<a name="line.2496"></a>
-<span class="sourceLineNo">2497</span>      if (interrupted) {<a name="line.2497"></a>
-<span class="sourceLineNo">2498</span>        Thread.currentThread().interrupt();<a name="line.2498"></a>
-<span class="sourceLineNo">2499</span>      }<a name="line.2499"></a>
-<span class="sourceLineNo">2500</span>    }<a name="line.2500"></a>
-<span class="sourceLineNo">2501</span>    this.rssStub = intRssStub;<a name="line.2501"></a>
-<span class="sourceLineNo">2502</span>    this.lockStub = intLockStub;<a name="line.2502"></a>
-<span class="sourceLineNo">2503</span>    return sn;<a name="line.2503"></a>
-<span class="sourceLineNo">2504</span>  }<a name="line.2504"></a>
-<span class="sourceLineNo">2505</span><a name="line.2505"></a>
-<span class="sourceLineNo">2506</span>  /**<a name="line.2506"></a>
-<span class="sourceLineNo">2507</span>   * @return True if we should break loop because cluster is going down or<a name="line.2507"></a>
-<span class="sourceLineNo">2508</span>   * this server has been stopped or hdfs has gone bad.<a name="line.2508"></a>
-<span class="sourceLineNo">2509</span>   */<a name="line.2509"></a>
-<span class="sourceLineNo">2510</span>  private boolean keepLooping() {<a name="line.2510"></a>
-<span class="sourceLineNo">2511</span>    return !this.stopped &amp;&amp; isClusterUp();<a name="line.2511"></a>
-<span class="sourceLineNo">2512</span>  }<a name="line.2512"></a>
-<span class="sourceLineNo">2513</span><a name="line.2513"></a>
-<span class="sourceLineNo">2514</span>  /*<a name="line.2514"></a>
-<span class="sourceLineNo">2515</span>   * Let the master know we're here Run initialization using parameters passed<a name="line.2515"></a>
-<span class="sourceLineNo">2516</span>   * us by the master.<a name="line.2516"></a>
-<span class="sourceLineNo">2517</span>   * @return A Map of key/value configurations we got from the Master else<a name="line.2517"></a>
-<span class="sourceLineNo">2518</span>   * null if we failed to register.<a name="line.2518"></a>
-<span class="sourceLineNo">2519</span>   * @throws IOException<a name="line.2519"></a>
-<span class="sourceLineNo">2520</span>   */<a name="line.2520"></a>
-<span class="sourceLineNo">2521</span>  private RegionServerStartupResponse reportForDuty() throws IOException {<a name="line.2521"></a>
-<span class="sourceLineNo">2522</span>    ServerName masterServerName = createRegionServerStatusStub(true);<a name="line.2522"></a>
-<span class="sourceLineNo">2523</span>    if (masterServerName == null) return null;<a name="line.2523"></a>
-<span class="sourceLineNo">2524</span>    RegionServerStartupResponse result = null;<a name="line.2524"></a>
-<span class="sourceLineNo">2525</span>    try {<a name="line.2525"></a>
-<span class="sourceLineNo">2526</span>      rpcServices.requestCount.reset();<a name="line.2526"></a>
-<span class="sourceLineNo">2527</span>      rpcServices.rpcGetRequestCount.reset();<a name="line.2527"></a>
-<span class="sourceLineNo">2528</span>      rpcServices.rpcScanRequestCount.reset();<a name="line.2528"></a>
-<span class="sourceLineNo">2529</span>      rpcServices.rpcMultiRequestCount.reset();<a name="line.2529"></a>
-<span class="sourceLineNo">2530</span>      rpcServices.rpcMutateRequestCount.reset();<a name="line.2530"></a>
-<span class="sourceLineNo">2531</span>      LOG.info("reportForDuty to master=" + masterServerName + " with port="<a name="line.2531"></a>
-<span class="sourceLineNo">2532</span>        + rpcServices.isa.getPort() + ", startcode=" + this.startcode);<a name="line.2532"></a>
-<span class="sourceLineNo">2533</span>      long now = EnvironmentEdgeManager.currentTime();<a name="line.2533"></a>
-<span class="sourceLineNo">2534</span>      int port = rpcServices.isa.getPort();<a name="line.2534"></a>
-<span class="sourceLineNo">2535</span>      RegionServerStartupRequest.Builder request = RegionServerStartupRequest.newBuilder();<a name="line.2535"></a>
-<span class="sourceLineNo">2536</span>      if (shouldUseThisHostnameInstead()) {<a name="line.2536"></a>
-<span class="sourceLineNo">2537</span>        request.setUseThisHostnameInstead(useThisHostnameInstead);<a name="line.2537"></a>
-<span class="sourceLineNo">2538</span>      }<a name="line.2538"></a>
-<span class="sourceLineNo">2539</span>      request.setPort(port);<a name="line.2539"></a>
-<span class="sourceLineNo">2540</span>      request.setServerStartCode(this.startcode);<a name="line.2540"></a>
-<span class="sourceLineNo">2541</span>      request.setServerCurrentTime(now);<a name="line.2541"></a>
-<span class="sourceLineNo">2542</span>      result = this.rssStub.regionServerStartup(null, request.build());<a name="line.2542"></a>
-<span class="sourceLineNo">2543</span>    } catch (ServiceException se) {<a name="line.2543"></a>
-<span class="sourceLineNo">2544</span>      IOException ioe = ProtobufUtil.getRemoteException(se);<a name="line.2544"></a>
-<span class="sourceLineNo">2545</span>      if (ioe instanceof ClockOutOfSyncException) {<a name="line.2545"></a>
-<span class="sourceLineNo">2546</span>        LOG.fatal("Master rejected startup because clock is out of sync", ioe);<a name="line.2546"></a>
-<span class="sourceLineNo">2547</span>        // Re-throw IOE will cause RS to abort<a name="line.2547"></a>
-<span class="sourceLineNo">2548</span>        throw ioe;<a name="line.2548"></a>
-<span class="sourceLineNo">2549</span>      } else if (ioe instanceof ServerNotRunningYetException) {<a name="line.2549"></a>
-<span class="sourceLineNo">2550</span>        LOG.debug("Master is not running yet");<a name="line.2550"></a>
-<span class="sourceLineNo">2551</span>      } else {<a name="line.2551"></a>
-<span class="sourceLineNo">2552</span>        LOG.warn("error telling master we are up", se);<a name="line.2552"></a>
-<span class="sourceLineNo">2553</span>      }<a name="line.2553"></a>
-<span class="sourceLineNo">2554</span>      rssStub = null;<a name="line.2554"></a>
-<span class="sourceLineNo">2555</span>    }<a name="line.2555"></a>
-<span class="sourceLineNo">2556</span>    return result;<a name="line.2556"></a>
-<span class="sourceLineNo">2557</span>  }<a name="line.2557"></a>
-<span class="sourceLineNo">2558</span><a name="line.2558"></a>
-<span class="sourceLineNo">2559</span>  @Override<a name="line.2559"></a>
-<span class="sourceLineNo">2560</span>  public RegionStoreSequenceIds getLastSequenceId(byte[] encodedRegionName) {<a name="line.2560"></a>
-<span class="sourceLineNo">2561</span>    try {<a name="line.2561"></a>
-<span class="sourceLineNo">2562</span>      GetLastFlushedSequenceIdRequest req =<a name="line.2562"></a>
-<span class="sourceLineNo">2563</span>          RequestConverter.buildGetLastFlushedSequenceIdRequest(encodedRegionName);<a name="line.2563"></a>
-<span class="sourceLineNo">2564</span>      RegionServerStatusService.BlockingInterface rss = rssStub;<a name="line.2564"></a>
-<span class="sourceLineNo">2565</span>      if (rss == null) { // Try to connect one more time<a name="line.2565"></a>
-<span class="sourceLineNo">2566</span>        createRegionServerStatusStub();<a name="line.2566"></a>
-<span class="sourceLineNo">2567</span>        rss = rssStub;<a name="line.2567"></a>
-<span class="sourceLineNo">2568</span>        if (rss == null) {<a name="line.2568"></a>
-<span class="sourceLineNo">2569</span>          // Still no luck, we tried<a name="line.2569"></a>
-<span class="sourceLineNo">2570</span>          LOG.warn("Unable to connect to the master to check " + "the last flushed sequence id");<a name="line.2570"></a>
-<span class="sourceLineNo">2571</span>          return RegionStoreSequenceIds.newBuilder().setLastFlushedSequenceId(HConstants.NO_SEQNUM)<a name="line.2571"></a>
-<span class="sourceLineNo">2572</span>              .build();<a name="line.2572"></a>
-<span class="sourceLineNo">2573</span>        }<a name="line.2573"></a>
-<span class="sourceLineNo">2574</span>      }<a name="line.2574"></a>
-<span class="sourceLineNo">2575</span>      GetLastFlushedSequenceIdResponse resp = rss.getLastFlushedSequenceId(null, req);<a name="line.2575"></a>
-<span class="sourceLineNo">2576</span>      return RegionStoreSequenceIds.newBuilder()<a name="line.2576"></a>
-<span class="sourceLineNo">2577</span>          .setLastFlushedSequenceId(resp.getLastFlushedSequenceId())<a name="line.2577"></a>
-<span class="sourceLineNo">2578</span>          .addAllStoreSequenceId(resp.getStoreLastFlushedSequenceIdList()).build();<a name="line.2578"></a>
-<span class="sourceLineNo">2579</span>    } catch (ServiceException e) {<a name="line.2579"></a>
-<span class="sourceLineNo">2580</span>      LOG.warn("Unable to connect to the master to check the last flushed sequence id", e);<a name="line.2580"></a>
-<span class="sourceLineNo">2581</span>      return RegionStoreSequenceIds.newBuilder().setLastFlushedSequenceId(HConstants.NO_SEQNUM)<a name="line.2581"></a>
-<span class="sourceLineNo">2582</span>          .build();<a name="line.2582"></a>
-<span class="sourceLineNo">2583</span>    }<a name="line.2583"></a>
-<span class="sourceLineNo">2584</span>  }<a name="line.2584"></a>
-<span class="sourceLineNo">2585</span><a name="line.2585"></a>
-<span class="sourceLineNo">2586</span>  /**<a name="line.2586"></a>
-<span class="sourceLineNo">2587</span>   * Closes all regions.  Called on our way out.<a name="line.2587"></a>
-<span class="sourceLineNo">2588</span>   * Assumes that its not possible for new regions to be added to onlineRegions<a name="line.2588"></a>
-<span class="sourceLineNo">2589</span>   * while this method runs.<a name="line.2589"></a>
-<span class="sourceLineNo">2590</span>   */<a name="line.2590"></a>
-<span class="sourceLineNo">2591</span>  protected void closeAllRegions(final boolean abort) {<a name="line.2591"></a>
-<span class="sourceLineNo">2592</span>    closeUserRegions(abort);<a name="line.2592"></a>
-<span class="sourceLineNo">2593</span>    closeMetaTableRegions(abort);<a name="line.2593"></a>
-<span class="sourceLineNo">2594</span>  }<a name="line.2594"></a>
-<span class="sourceLineNo">2595</span><a name="line.2595"></a>
-<span class="sourceLineNo">2596</span>  /**<a name="line.2596"></a>
-<span class="sourceLineNo">2597</span>   * Close meta region if we carry it<a name="line.2597"></a>
-<span class="sourceLineNo">2598</span>   * @param abort Whether we're running an abort.<a name="line.2598"></a>
-<span class="sourceLineNo">2599</span>   */<a name="line.2599"></a>
-<span class="sourceLineNo">2600</span>  void closeMetaTableRegions(final boolean abort) {<a name="line.2600"></a>
-<span class="sourceLineNo">2601</span>    Region meta = null;<a name="line.2601"></a>
-<span class="sourceLineNo">2602</span>    this.lock.writeLock().lock();<a name="line.2602"></a>
-<span class="sourceLineNo">2603</span>    try {<a name="line.2603"></a>
-<span class="sourceLineNo">2604</span>      for (Map.Entry&lt;String, Region&gt; e: onlineRegions.entrySet()) {<a name="line.2604"></a>
-<span class="sourceLineNo">2605</span>        HRegionInfo hri = e.getValue().getRegionInfo();<a name="line.2605"></a>
-<span class="sourceLineNo">2606</span>        if (hri.isMetaRegion()) {<a name="line.2606"></a>
-<span class="sourceLineNo">2607</span>          meta = e.getValue();<a name="line.2607"></a>
-<span class="sourceLineNo">2608</span>        }<a name="line.2608"></a>
-<span class="sourceLineNo">2609</span>        if (meta != null) break;<a name="line.2609"></a>
-<span class="sourceLineNo">2610</span>      }<a name="line.2610"></a>
-<span class="sourceLineNo">2611</span>    } finally {<a name="line.2611"></a>
-<span class="sourceLineNo">2612</span>      this.lock.writeLock().unlock();<a name="line.2612"></a>
-<span class="sourceLineNo">2613</span>    }<a name="line.2613"></a>
-<span class="sourceLineNo">2614</span>    if (meta != null) closeRegionIgnoreErrors(meta.getRegionInfo(), abort);<a name="line.2614"></a>
-<span class="sourceLineNo">2615</span>  }<a name="line.2615"></a>
-<span class="sourceLineNo">2616</span><a name="line.2616"></a>
-<span class="sourceLineNo">2617</span>  /**<a name="line.2617"></a>
-<span class="sourceLineNo">2618</span>   * Schedule closes on all user regions.<a name="line.2618"></a>
-<span class="sourceLineNo">2619</span>   * Should be safe calling multiple times because it wont' close regions<a name="line.2619"></a>
-<span class="sourceLineNo">2620</span>   * that are already closed or that are closing.<a name="line.2620"></a>
-<span class="sourceLineNo">2621</span>   * @param abort Whether we're running an abort.<a name="line.2621"></a>
-<span class="sourceLineNo">2622</span>   */<a name="line.2622"></a>
-<span class="sourceLineNo">2623</span>  void closeUserRegions(final boolean abort) {<a name="line.2623"></a>
-<span class="sourceLineNo">2624</span>    this.lock.writeLock().lock();<a name="line.2624"></a>
-<span class="sourceLineNo">2625</span>    try {<a name="line.2625"></a>
-<span class="sourceLineNo">2626</span>      for (Map.Entry&lt;String, Region&gt; e: this.onlineRegions.entrySet()) {<a name="line.2626"></a>
-<span class="sourceLineNo">2627</span>        Region r = e.getValue();<a name="line.2627"></a>
-<span class="sourceLineNo">2628</span>        if (!r.getRegionInfo().isMetaTable() &amp;&amp; r.isAvailable()) {<a name="line.2628"></a>
-<span class="sourceLineNo">2629</span>          // Don't update zk with this close transition; pass false.<a name="line.2629"></a>
-<span class="sourceLineNo">2630</span>          closeRegionIgnoreErrors(r.getRegionInfo(), abort);<a name="line.2630"></a>
-<span class="sourceLineNo">2631</span>        }<a name="line.2631"></a>
-<span class="sourceLineNo">2632</span>      }<a name="line.2632"></a>
-<span class="sourceLineNo">2633</span>    } finally {<a name="line.2633"></a>
-<span class="sourceLineNo">2634</span>      this.lock.writeLock().unlock();<a name="line.2634"></a>
-<span class="sourceLineNo">2635</span>    }<a name="line.2635"></a>
-<span class="sourceLineNo">2636</span>  }<a name="line.2636"></a>
-<span class="sourceLineNo">2637</span><a name="line.2637"></a>
-<span class="sourceLineNo">2638</span>  /** @return the info server */<a name="line.2638"></a>
-<span class="sourceLineNo">2639</span>  public InfoServer getInfoServer() {<a name="line.2639"></a>
-<span class="sourceLineNo">2640</span>    return infoServer;<a name="line.2640"></a>
-<span class="sourceLineNo">2641</span>  }<a name="line.2641"></a>
-<span class="sourceLineNo">2642</span><a name="line.2642"></a>
-<span class="sourceLineNo">2643</span>  /**<a name="line.2643"></a>
-<span class="sourceLineNo">2644</span>   * @return true if a stop has been requested.<a name="line.2644"></a>
-<span class="sourceLineNo">2645</span>   */<a name="line.2645"></a>
-<span class="sourceLineNo">2646</span>  @Override<a name="line.2646"></a>
-<span class="sourceLineNo">2647</span>  public boolean isStopped() {<a name="line.2647"></a>
-<span class="sourceLineNo">2648</span>    return this.stopped;<a name="line.2648"></a>
-<span class="sourceLineNo">2649</span>  }<a name="line.2649"></a>
-<span class="sourceLineNo">2650</span><a name="line.2650"></a>
-<span class="sourceLineNo">2651</span>  @Override<a name="line.2651"></a>
-<span class="sourceLineNo">2652</span>  public boolean isStopping() {<a name="line.2652"></a>
-<span class="sourceLineNo">2653</span>    return this.stopping;<a name="line.2653"></a>
-<span class="sourceLineNo">2654</span>  }<a name="line.2654"></a>
-<span class="sourceLineNo">2655</span><a name="line.2655"></a>
-<span class="sourceLineNo">2656</span>  @Override<a name="line.2656"></a>
-<span class="sourceLineNo">2657</span>  public Map&lt;String, Region&gt; getRecoveringRegions() {<a name="line.2657"></a>
-<span class="sourceLineNo">2658</span>    return this.recoveringRegions;<a name="line.2658"></a>
-<span class="sourceLineNo">2659</span>  }<a name="line.2659"></a>
-<span class="sourceLineNo">2660</span><a name="line.2660"></a>
-<span class="sourceLineNo">2661</span>  /**<a name="line.2661"></a>
-<span class="sourceLineNo">2662</span>   *<a name="line.2662"></a>
-<span class="sourceLineNo">2663</span>   * @return the configuration<a name="line.2663"></a>
-<span class="sourceLineNo">2664</span>   */<a name="line.2664"></a>
-<span class="sourceLineNo">2665</span>  @Override<a name="line.2665"></a>
-<span class="sourceLineNo">2666</span>  public Configuration getConfiguration() {<a name="line.2666"></a>
-<span class="sourceLineNo">2667</span>    return conf;<a name="line.2667"></a>
-<span class="sourceLineNo">2668</span>  }<a name="line.2668"></a>
-<span class="sourceLineNo">2669</span><a name="line.2669"></a>
-<span class="sourceLineNo">2670</span>  /** @return the write lock for the server */<a name="line.2670"></a>
-<span class="sourceLineNo">2671</span>  ReentrantReadWriteLock.WriteLock getWriteLock() {<a name="line.2671"></a>
-<span class="sourceLineNo">2672</span>    return lock.writeLock();<a name="line.2672"></a>
-<span class="sourceLineNo">2673</span>  }<a name="line.2673"></a>
-<span class="sourceLineNo">2674</span><a name="line.2674"></a>
-<span class="sourceLineNo">2675</span>  public int getNumberOfOnlineRegions() {<a name="line.2675"></a>
-<span class="sourceLineNo">2676</span>    return this.onlineRegions.size();<a name="line.2676"></a>
-<span class="sourceLineNo">2677</span>  }<a name="line.2677"></a>
-<span class="sourceLineNo">2678</span><a name="line.2678"></a>
-<span class="sourceLineNo">2679</span>  boolean isOnlineRegionsEmpty() {<a name="line.2679"></a>
-<span class="sourceLineNo">2680</span>    return this.onlineRegions.isEmpty();<a name="line.2680"></a>
-<span class="sourceLineNo">2681</span>  }<a name="line.2681"></a>
-<span class="sourceLineNo">2682</span><a name="line.2682"></a>
-<span class="sourceLineNo">2683</span>  /**<a name="line.2683"></a>
-<span class="sourceLineNo">2684</span>   * For tests, web ui and metrics.<a name="line.2684"></a>
-<span class="sourceLineNo">2685</span>   * This method will only work if HRegionServer is in the same JVM as client;<a name="line.2685"></a>
-<span class="sourceLineNo">2686</span>   * HRegion cannot be serialized to cross an rpc.<a name="line.2686"></a>
-<span class="sourceLineNo">2687</span>   */<a name="line.2687"></a>
-<span class="sourceLineNo">2688</span>  public Collection&lt;Region&gt; getOnlineRegionsLocalContext() {<a name="line.2688"></a>
-<span class="sourceLineNo">2689</span>    Collection&lt;Region&gt; regions = this.onlineRegions.values();<a name="line.2689"></a>
-<span class="sourceLineNo">2690</span>    return Collections.unmodifiableCollection(regions);<a name="line.2690"></a>
-<span class="sourceLineNo">2691</span>  }<a name="line.2691"></a>
-<span class="sourceLineNo">2692</span><a name="line.2692"></a>
-<span class="sourceLineNo">2693</span>  @Override<a name="line.2693"></a>
-<span class="sourceLineNo">2694</span>  public void addToOnlineRegions(Region region) {<a name="line.2694"></a>
-<span class="sourceLineNo">2695</span>    this.onlineRegions.put(region.getRegionInfo().getEncodedName(), region);<a name="line.2695"></a>
-<span class="sourceLineNo">2696</span>    configurationManager.registerObserver(region);<a name="line.2696"></a>
-<span class="sourceLineNo">2697</span>  }<a name="line.2697"></a>
-<span class="sourceLineNo">2698</span><a name="line.2698"></a>
-<span class="sourceLineNo">2699</span>  /**<a name="line.2699"></a>
-<span class="sourceLineNo">2700</span>   * @return A new Map of online regions sorted by region size with the first entry being the<a name="line.2700"></a>
-<span class="sourceLineNo">2701</span>   * biggest.  If two regions are the same size, then the last one found wins; i.e. this method<a name="line.2701"></a>
-<span class="sourceLineNo">2702</span>   * may NOT return all regions.<a name="line.2702"></a>
-<span class="sourceLineNo">2703</span>   */<a name="line.2703"></a>
-<span class="sourceLineNo">2704</span>  SortedMap&lt;Long, Region&gt; getCopyOfOnlineRegionsSortedBySize() {<a name="line.2704"></a>
-<span class="sourceLineNo">2705</span>    // we'll sort the regions in reverse<a name="line.2705"></a>
-<span class="sourceLineNo">2706</span>    SortedMap&lt;Long, Region&gt; sortedRegions = new TreeMap&lt;&gt;(<a name="line.2706"></a>
-<span class="sourceLineNo">2707</span>        new Comparator&lt;Long&gt;() {<a name="line.2707"></a>
-<span class="sourceLineNo">2708</span>          @Override<a name="line.2708"></a>
-<span class="sourceLineNo">2709</span>          public int compare(Long a, Long b) {<a name="line.2709"></a>
-<span class="sourceLineNo">2710</span>            return -1 * a.compareTo(b);<a name="line.2710"></a>
-<span class="sourceLineNo">2711</span>          }<a name="line.2711"></a>
-<span class="sourceLineNo">2712</span>        });<a name="line.2712"></a>
-<span class="sourceLineNo">2713</span>    // Copy over all regions. Regions are sorted by size with biggest first.<a name="line.2713"></a>
-<span class="sourceLineNo">2714</span>    for (Region region : this.onlineRegions.values()) {<a name="line.2714"></a>
-<span class="sourceLineNo">2715</span>      sortedRegions.put(region.getMemstoreSize(), region);<a name="line.2715"></a>
-<span class="sourceLineNo">2716</span>    }<a name="line.2716"></a>
-<span class="sourceLineNo">2717</span>    return sortedRegions;<a name="line.2717"></a>
-<span class="sourceLineNo">2718</span>  }<a name="line.2718"></a>
-<span class="sourceLineNo">2719</span><a name="line.2719"></a>
-<span class="sourceLineNo">2720</span>  /**<a name="line.2720"></a>
-<span class="sourceLineNo">2721</span>   * @return time stamp in millis of when this region server was started<a name="line.2721"></a>
-<span class="sourceLineNo">2722</span>   */<a name="line.2722"></a>
-<span class="sourceLineNo">2723</span>  public long getStartcode() {<a name="line.2723"></a>
-<span class="sourceLineNo">2724</span>    return this.startcode;<a name="line.2724"></a>
-<span class="sourceLineNo">2725</span>  }<a name="line.2725"></a>
-<span class="sourceLineNo">2726</span><a name="line.2726"></a>
-<span class="sourceLineNo">2727</span>  /** @return reference to FlushRequester */<a name="line.2727"></a>
-<span class="sourceLineNo">2728</span>  @Override<a name="line.2728"></a>
-<span class="sourceLineNo">2729</span>  public FlushRequester getFlushRequester() {<a name="line.2729"></a>
-<span class="sourceLineNo">2730</span>    return this.cacheFlusher;<a name="line.2730"></a>
-<span class="sourceLineNo">2731</span>  }<a name="line.2731"></a>
-<span class="sourceLineNo">2732</span><a name="line.2732"></a>
-<span class="sourceLineNo">2733</span>  /**<a name="line.2733"></a>
-<span class="sourceLineNo">2734</span>   * Get the top N most loaded regions this server is serving so we can tell the<a name="line.2734"></a>
-<span class="sourceLineNo">2735</span>   * master which regions it can reallocate if we're overloaded. TODO: actually<a name="line.2735"></a>
-<span class="sourceLineNo">2736</span>   * calculate which regions are most loaded. (Right now, we're just grabbing<a name="line.2736"></a>
-<span class="sourceLineNo">2737</span>   * the first N regions being served regardless of load.)<a name="line.2737"></a>
-<span class="sourceLineNo">2738</span>   */<a name="line.2738"></a>
-<span class="sourceLineNo">2739</span>  protected HRegionInfo[] getMostLoadedRegions() {<a name="line.2739"></a>
-<span class="sourceLineNo">2740</span>    ArrayList&lt;HRegionInfo&gt; regions = new ArrayList&lt;&gt;();<a name="line.2740"></a>
-<span class="sourceLineNo">2741</span>    for (Region r : onlineRegions.values()) {<a name="line.2741"></a>
-<span class="sourceLineNo">2742</span>      if (!r.isAvailable()) {<a name="line.2742"></a>
-<span class="sourceLineNo">2743</span>        continue;<a name="line.2743"></a>
-<span class="sourceLineNo">2744</span>      }<a name="line.2744"></a>
-<span class="sourceLineNo">2745</span>      if (regions.size() &lt; numRegionsToReport) {<a name="line.2745"></a>
-<span class="sourceLineNo">2746</span>        regions.add(r.getRegionInfo());<a name="line.2746"></a>
-<span class="sourceLineNo">2747</span>      } else {<a name="line.2747"></a>
-<span class="sourceLineNo">2748</span>        break;<a name="line.2748"></a>
-<span class="sourceLineNo">2749</span>      }<a name="line.2749"></a>
-<span class="sourceLineNo">2750</span>    }<a name="line.2750"></a>
-<span class="sourceLineNo">2751</span>    return regions.toArray(new HRegionInfo[regions.size()]);<a name="line.2751"></a>
-<span class="sourceLineNo">2752</span>  }<a name="line.2752"></a>
-<span class="sourceLineNo">2753</span><a name="line.2753"></a>
-<span class="sourceLineNo">2754</span>  @Override<a name="line.2754"></a>
-<span class="sourceLineNo">2755</span>  public Leases getLeases() {<a name="line.2755"></a>
-<span class="sourceLineNo">2756</span>    return leases;<a name="line.2756"></a>
-<span class="sourceLineNo">2757</span>  }<a name="line.2757"></a>
-<span class="sourceLineNo">2758</span><a name="line.2758"></a>
-<span class="sourceLineNo">2759</span>  /**<a name="line.2759"></a>
-<span class="sourceLineNo">2760</span>   * @return Return the rootDir.<a name="line.2760"></a>
-<span class="sourceLineNo">2761</span>   */<a name="line.2761"></a>
-<span class="sourceLineNo">2762</span>  protected Path getRootDir() {<a name="line.2762"></a>
-<span class="sourceLineNo">2763</span>    return rootDir;<a name="line.2763"></a>
-<span class="sourceLineNo">2764</span>  }<a name="line.2764"></a>
-<span class="sourceLineNo">2765</span><a name="line.2765"></a>
-<span class="sourceLineNo">2766</span>  /**<a name="line.2766"></a>
-<span class="sourceLineNo">2767</span>   * @return Return the fs.<a name="line.2767"></a>
-<span class="sourceLineNo">2768</span>   */<a name="line.2768"></a>
-<span class="sourceLineNo">2769</span>  @Override<a name="line.2769"></a>
-<span class="sourceLineNo">2770</span>  public FileSystem getFileSystem() {<a name="line.2770"></a>
-<span class="sourceLineNo">2771</span>    return fs;<a name="line.2771"></a>
-<span class="sourceLineNo">2772</span>  }<a name="line.2772"></a>
-<span class="sourceLineNo">2773</span><a name="line.2773"></a>
-<span class="sourceLineNo">2774</span>  /**<a name="line.2774"></a>
-<span class="sourceLineNo">2775</span>   * @return Return the walRootDir.<a name="line.2775"></a>
-<span class="sourceLineNo">2776</span>   */<a name="line.2776"></a>
-<span class="sourceLineNo">2777</span>  protected Path getWALRootDir() {<a name="line.2777"></a>
-<span class="sourceLineNo">2778</span>    return walRootDir;<a name="line.2778"></a>
-<span class="sourceLineNo">2779</span>  }<a name="line.2779"></a>
-<span class="sourceLineNo">2780</span><a name="line.2780"></a>
-<span class="sourceLineNo">2781</span>  /**<a name="line.2781"></a>
-<span class="sourceLineNo">2782</span>   * @return Return the walFs.<a name="line.2782"></a>
-<span class="sourceLineNo">2783</span>   */<a name="line.2783"></a>
-<span class="sourceLineNo">2784</span>  protected FileSystem getWALFileSystem() {<a name="line.2784"></a>
-<span class="sourceLineNo">2785</span>    return walFs;<a name="line.2785"></a>
-<span class="sourceLineNo">2786</span>  }<a name="line.2786"></a>
-<span class="sourceLineNo">2787</span><a name="line.2787"></a>
-<span class="sourceLineNo">2788</span>  @Override<a name="line.2788"></a>
-<span class="sourceLineNo">2789</span>  public String toString() {<a name="line.2789"></a>
-<span class="sourceLineNo">2790</span>    return getServerName().toString();<a name="line.2790"></a>
-<span class="sourceLineNo">2791</span>  }<a name="line.2791"></a>
-<span class="sourceLineNo">2792</span><a name="line.2792"></a>
-<span class="sourceLineNo">2793</span>  /**<a name="line.2793"></a>
-<span class="sourceLineNo">2794</span>   * Interval at which threads should run<a name="line.2794"></a>
-<span class="sourceLineNo">2795</span>   *<a name="line.2795"></a>
-<span class="sourceLineNo">2796</span>   * @return the interval<a name="line.2796"></a>
-<span class="sourceLineNo">2797</span>   */<a name="line.2797"></a>
-<span class="sourceLineNo">2798</span>  public int getThreadWakeFrequency() {<a name="line.2798"></a>
-<span class="sourceLineNo">2799</span>    return threadWakeFrequency;<a name="line.2799"></a>
-<span class="sourceLineNo">2800</span>  }<a name="line.2800"></a>
-<span class="sourceLineNo">2801</span><a name="line.2801"></a>
-<span class="sourceLineNo">2802</span>  @Override<a name="line.2802"></a>
-<span class="sourceLineNo">2803</span>  public ZooKeeperWatcher getZooKeeper() {<a name="line.2803"></a>
-<span class="sourceLineNo">2804</span>    return zooKeeper;<a name="line.2804"></a>
-<span class="sourceLineNo">2805</span>  }<a name="line.2805"></a>
-<span class="sourceLineNo">2806</span><a name="line.2806"></a>
-<span class="sourceLineNo">2807</span>  @Override<a name="line.2807"></a>
-<span class="sourceLineNo">2808</span>  public BaseCoordinatedStateManager getCoordinatedStateManager() {<a name="line.2808"></a>
-<span class="sourceLineNo">2809</span>    return csm;<a name="line.2809"></a>
-<span class="sourceLineNo">2810</span>  }<a name="line.2810"></a>
-<span class="sourceLineNo">2811</span><a name="line.2811"></a>
-<span class="sourceLineNo">2812</span>  @Override<a name="line.2812"></a>
-<span class="sourceLineNo">2813</span>  public ServerName getServerName() {<a name="line.2813"></a>
-<span class="sourceLineNo">2814</span>    return serverName;<a name="line.2814"></a>
-<span class="sourceLineNo">2815</span>  }<a name="line.2815"></a>
-<span class="sourceLineNo">2816</span><a name="line.2816"></a>
-<span class="sourceLineNo">2817</span>  @Override<a name="line.2817"></a>
-<span class="sourceLineNo">2818</span>  public CompactionRequestor getCompactionRequester() {<a name="line.2818"></a>
-<span class="sourceLineNo">2819</span>    return this.compactSplitThread;<a name="line.2819"></a>
-<span class="sourceLineNo">2820</span>  }<a name="line.2820"></a>
-<span class="sourceLineNo">2821</span><a name="line.2821"></a>
-<span class="sourceLineNo">2822</span>  public RegionServerCoprocessorHost getRegionServerCoprocessorHost(){<a name="line.2822"></a>
-<span class="sourceLineNo">2823</span>    return this.rsHost;<a name="line.2823"></a>
-<span class="sourceLineNo">2824</span>  }<a name="line.2824"></a>
-<span class="sourceLineNo">2825</span><a name="line.2825"></a>
-<span class="sourceLineNo">2826</span>  @Override<a name="line.2826"></a>
-<span class="sourceLineNo">2827</span>  public ConcurrentMap&lt;byte[], Boolean&gt; getRegionsInTransitionInRS() {<a name="line.2827"></a>
-<span class="sourceLineNo">2828</span>    return this.regionsInTransitionInRS;<a name="line.2828"></a>
-<span class="sourceLineNo">2829</span>  }<a name="line.2829"></a>
-<span class="sourceLineNo">2830</span><a name="line.2830"></a>
-<span class="sourceLineNo">2831</span>  @Override<a name="line.2831"></a>
-<span class="sourceLineNo">2832</span>  public ExecutorService getExecutorService() {<a name="line.2832"></a>
-<span class="sourceLineNo">2833</span>    return service;<a name="line.2833"></a>
-<span class="sourceLineNo">2834</span>  }<a name="line.2834"></a>
-<span class="sourceLineNo">2835</span><a name="line.2835"></a>
-<span class="sourceLineNo">2836</span>  @Override<a name="line.2836"></a>
-<span class="sourceLineNo">2837</span>  public ChoreService getChoreService() {<a name="line.2837"></a>
-<span class="sourceLineNo">2838</span>    return choreService;<a name="line.2838"></a>
-<span class="sourceLineNo">2839</span>  }<a name="line.2839"></a>
-<span class="sourceLineNo">2840</span><a name="line.2840"></a>
-<span class="sourceLineNo">2841</span>  @Override<a name="line.2841"></a>
-<span class="sourceLineNo">2842</span>  public RegionServerRpcQuotaManager getRegionServerRpcQuotaManager() {<a name="line.2842"></a>
-<span class="sourceLineNo">2843</span>    return rsQuotaManager;<a name="line.2843"></a>
-<span class="sourceLineNo">2844</span>  }<a name="line.2844"></a>
-<span class="sourceLineNo">2845</span><a name="line.2845"></a>
-<span class="sourceLineNo">2846</span>  //<a name="line.2846"></a>
-<span class="sourceLineNo">2847</span>  // Main program and support routines<a name="line.2847"></a>
-<span class="sourceLineNo">2848</span>  //<a name="line.2848"></a>
-<span class="sourceLineNo">2849</span><a name="line.2849"></a>
-<span class="sourceLineNo">2850</span>  /**<a name="line.2850"></a>
-<span class="sourceLineNo">2851</span>   * Load the replication service objects, if any<a name="line.2851"></a>
-<span class="sourceLineNo">2852</span>   */<a name="line.2852"></a>
-<span class="sourceLineNo">2853</span>  static private void createNewReplicationInstance(Configuration conf,<a name="line.2853"></a>
-<span class="sourceLineNo">2854</span>    HRegionServer server, FileSystem walFs, Path walDir, Path oldWALDir) throws IOException{<a name="line.2854"></a>
-<span class="sourceLineNo">2855</span><a name="line.2855"></a>
-<span class="sourceLineNo">2856</span>    if ((server instanceof HMaster) &amp;&amp;<a name="line.2856"></a>
-<span class="sourceLineNo">2857</span>        (!BaseLoadBalancer.userTablesOnMaster(conf))) {<a name="line.2857"></a>
-<span class="sourceLineNo">2858</span>      return;<a name="line.2858"></a>
-<span class="sourceLineNo">2859</span>    }<a name="line.2859"></a>
-<span class="sourceLineNo">2860</span><a name="line.2860"></a>
-<span class="sourceLineNo">2861</span>    // read in the name of the source replication class from the config file.<a name="line.2861"></a>
-<span class="sourceLineNo">2862</span>    String sourceClassname = conf.get(HConstants.REPLICATION_SOURCE_SERVICE_CLASSNAME,<a name="line.2862"></a>
-<span class="sourceLineNo">2863</span>                               HConstants.REPLICATION_SERVICE_CLASSNAME_DEFAULT);<a name="line.2863"></a>
-<span class="sourceLineNo">2864</span><a name="line.2864"></a>
-<span class="sourceLineNo">2865</span>    // read in the name of the sink replication class from the config file.<a name="line.2865"></a>
-<span class="sourceLineNo">2866</span>    String sinkClassname = conf.get(HConstants.REPLICATION_SINK_SERVICE_CLASSNAME,<a name="line.2866"></a>
-<span class="sourceLineNo">2867</span>                             HConstants.REPLICATION_SERVICE_CLASSNAME_DEFAULT);<a name="line.2867"></a>
-<span class="sourceLineNo">2868</span><a name="line.2868"></a>
-<span class="sourceLineNo">2869</span>    // If both the sink and the source class names are the same, then instantiate<a name="line.2869"></a>
-<span class="sourceLineNo">2870</span>    // only one object.<a name="line.2870"></a>
-<span class="sourceLineNo">2871</span>    if (sourceClassname.equals(sinkClassname)) {<a name="line.2871"></a>
-<span class="sourceLineNo">2872</span>      server.replicationSourceHandler = (ReplicationSourceService)<a name="line.2872"></a>
-<span class="sourceLineNo">2873</span>                                         newReplicationInstance(sourceClassname,<a name="line.2873"></a>
-<span class="sourceLineNo">2874</span>                                         conf, server, walFs, walDir, oldWALDir);<a name="line.2874"></a>
-<span class="sourceLineNo">2875</span>      server.replicationSinkHandler = (ReplicationSinkService)<a name="line.2875"></a>
-<span class="sourceLineNo">2876</span>                                         server.replicationSourceHandler;<a name="line.2876"></a>
-<span class="sourceLineNo">2877</span>    } else {<a name="line.2877"></a>
-<span class="sourceLineNo">2878</span>      server.replicationSourceHandler = (ReplicationSourceService)<a name="line.2878"></a>
-<span class="sourceLineNo">2879</span>                                         newReplicationInstance(sourceClassname,<a name="line.2879"></a>
-<span class="sourceLineNo">2880</span>                                         conf, server, walFs, walDir, oldWALDir);<a name="line.2880"></a>
-<span class="sourceLineNo">2881</span>      server.replicationSinkHandler = (ReplicationSinkService)<a name="line.2881"></a>
-<span class="sourceLineNo">2882</span>                                         newReplicationInstance(sinkClassname,<a name="line.2882"></a>
-<span class="sourceLineNo">2883</span>                                         conf, server, walFs, walDir, oldWALDir);<a name="line.2883"></a>
-<span class="sourceLineNo">2884</span>    }<a name="line.2884"></a>
-<span class="sourceLineNo">2885</span>  }<a name="line.2885"></a>
-<span class="sourceLineNo">2886</span><a name="line.2886"></a>
-<span class="sourceLineNo">2887</span>  static private ReplicationService newReplicationInstance(String classname,<a name="line.2887"></a>
-<span class="sourceLineNo">2888</span>    Configuration conf, HRegionServer server, FileSystem walFs, Path logDir,<a name="line.2888"></a>
-<span class="sourceLineNo">2889</span>    Path oldLogDir) throws IOException{<a name="line.2889"></a>
-<span class="sourceLineNo">2890</span><a name="line.2890"></a>
-<span class="sourceLineNo">2891</span>    Class&lt;?&gt; clazz = null;<a name="line.2891"></a>
-<span class="sourceLineNo">2892</span>    try {<a name="line.2892"></a>
-<span class="sourceLineNo">2893</span>      ClassLoader classLoader = Thread.currentThread().getContextClassLoader();<a name="line.2893"></a>
-<span class="sourceLineNo">2894</span>      clazz = Class.forName(classname, true, classLoader);<a name="line.2894"></a>
-<span class="sourceLineNo">2895</span>    } catch (java.lang.ClassNotFoundException nfe) {<a name="line.2895"></a>
-<span class="sourceLineNo">2896</span>      throw new IOException("Could not find class for " + classname);<a name="line.2896"></a>
-<span class="sourceLineNo">2897</span>    }<a name="line.2897"></a>
-<span class="sourceLineNo">2898</span><a name="line.2898"></a>
-<span class="sourceLineNo">2899</span>    // create an instance of the replication object.<a name="line.2899"></a>
-<span class="sourceLineNo">2900</span>    ReplicationService service = (ReplicationService)<a name="line.2900"></a>
-<span class="sourceLineNo">2901</span>                              ReflectionUtils.newInstance(clazz, conf);<a name="line.2901"></a>
-<span class="sourceLineNo">2902</span>    service.initialize(server, walFs, logDir, oldLogDir);<a name="line.2902"></a>
-<span class="sourceLineNo">2903</span>    return service;<a name="line.2903"></a>
-<span class="sourceLineNo">2904</span>  }<a name="line.2904"></a>
-<span class="sourceLineNo">2905</span><a name="line.2905"></a>
-<span class="sourceLineNo">2906</span>  /**<a name="line.2906"></a>
-<span class="sourceLineNo">2907</span>   * Utility for constructing an instance of the passed HRegionServer class.<a name="line.2907"></a>
-<span class="sourceLineNo">2908</span>   *<a name="line.2908"></a>
-<span class="sourceLineNo">2909</span>   * @param regionServerClass<a name="line.2909"></a>
-<span class="sourceLineNo">2910</span>   * @param conf2<a name="line.2910"></a>
-<span class="sourceLineNo">2911</span>   * @return HRegionServer instance.<a name="line.2911"></a>
-<span class="sourceLineNo">2912</span>   */<a name="line.2912"></a>
-<span class="sourceLineNo">2913</span>  public static HRegionServer constructRegionServer(<a name="line.2913"></a>
-<span class="sourceLineNo">2914</span>      Class&lt;? extends HRegionServer&gt; regionServerClass,<a name="line.2914"></a>
-<span class="sourceLineNo">2915</span>      final Configuration conf2, CoordinatedStateManager cp) {<a name="line.2915"></a>
-<span class="sourceLineNo">2916</span>    try {<a name="line.2916"></a>
-<span class="sourceLineNo">2917</span>      Constructor&lt;? extends HRegionServer&gt; c = regionServerClass<a name="line.2917"></a>
-<span class="sourceLineNo">2918</span>          .getConstructor(Configuration.class, CoordinatedStateManager.class);<a name="line.2918"></a>
-<span class="sourceLineNo">2919</span>      return c.newInstance(conf2, cp);<a name="line.2919"></a>
-<span class="sourceLineNo">2920</span>    } catch (Exception e) {<a name="line.2920"></a>
-<span class="sourceLineNo">2921</span>      throw new RuntimeException("Failed construction of " + "Regionserver: "<a name="line.2921"></a>
-<span class="sourceLineNo">2922</span>          + regionServerClass.toString(), e);<a name="line.2922"></a>
-<span class="sourceLineNo">2923</span>    }<a name="line.2923"></a>
-<span class="sourceLineNo">2924</span>  }<a name="line.2924"></a>
-<span class="sourceLineNo">2925</span><a name="line.2925"></a>
-<span class="sourceLineNo">2926</span>  /**<a name="line.2926"></a>
-<span class="sourceLineNo">2927</span>   * @see org.apache.hadoop.hbase.regionserver.HRegionServerCommandLine<a name="line.2927"></a>
-<span class="sourceLineNo">2928</span>   */<a name="line.2928"></a>
-<span class="sourceLineNo">2929</span>  public static void main(String[] args) throws Exception {<a name="line.2929"></a>
-<span class="sourceLineNo">2930</span>    LOG.info("STARTING service '" + HRegionServer.class.getSimpleName());<a name="line.2930"></a>
-<span class="sourceLineNo">2931</span>    VersionInfo.logVersion();<a name="line.2931"></a>
-<span class="sourceLineNo">2932</span>    Configuration conf = HBaseConfiguration.create();<a name="line.2932"></a>
-<span class="sourceLineNo">2933</span>    @SuppressWarnings("unchecked")<a name="line.2933"></a>
-<span class="sourceLineNo">2934</span>    Class&lt;? extends HRegionServer&gt; regionServerClass = (Class&lt;? extends HRegionServer&gt;) conf<a name="line.2934"></a>
-<span class="sourceLineNo">2935</span>        .getClass(HConstants.REGION_SERVER_IMPL, HRegionServer.class);<a name="line.2935"></a>
-<span class="sourceLineNo">2936</span><a name="line.2936"></a>
-<span class="sourceLineNo">2937</span>    new HRegionServerCommandLine(regionServerClass).doMain(args);<a name="line.2937"></a>
-<span class="sourceLineNo">2938</span>  }<a name="line.2938"></a>
-<span class="sourceLineNo">2939</span><a name="line.2939"></a>
-<span class="sourceLineNo">2940</span>  /**<a name="line.2940"></a>
-<span class="sourceLineNo">2941</span>   * Gets the online regions of the specified table.<a name="line.2941"></a>
-<span class="sourceLineNo">2942</span>   * This method looks at the in-memory onlineRegions.  It does not go to &lt;code&gt;hbase:meta&lt;/code&gt;.<a name="line.2942"></a>
-<span class="sourceLineNo">2943</span>   * Only returns &lt;em&gt;online&lt;/em&gt; regions.  If a region on this table has been<a name="line.2943"></a>
-<span class="sourceLineNo">2944</span>   * closed during a disable, etc., it will not be included in the returned list.<a name="line.2944"></a>
-<span class="sourceLineNo">2945</span>   * So, the returned list may not necessarily be ALL regions in this table, its<a name="line.2945"></a>
-<span class="sourceLineNo">2946</span>   * all the ONLINE regions in the table.<a name="line.2946"></a>
-<span class="sourceLineNo">2947</span>   * @param tableName<a name="line.2947"></a>
-<span class="sourceLineNo">2948</span>   * @return Online regions from &lt;code&gt;tableName&lt;/code&gt;<a name="line.2948"></a>
-<span class="sourceLineNo">2949</span>   */<a name="line.2949"></a>
-<span class="sourceLineNo">2950</span>  @Override<a name="line.2950"></a>
-<span class="sourceLineNo">2951</span>  public List&lt;Region&gt; getOnlineRegions(TableName tableName) {<a name="line.2951"></a>
-<span class="sourceLineNo">2952</span>     List&lt;Region&gt; tableRegions = new ArrayList&lt;&gt;();<a name="line.2952"></a>
-<span class="sourceLineNo">2953</span>     synchronized (this.onlineRegions) {<a name="line.2953"></a>
-<span class="sourceLineNo">2954</span>       for (Region region: this.onlineRegions.values()) {<a name="line.2954"></a>
-<span class="sourceLineNo">2955</span>         HRegionInfo regionInfo = region.getRegionInfo();<a name="line.2955"></a>
-<span class="sourceLineNo">2956</span>         if(regionInfo.getTable().equals(tableName)) {<a name="line.2956"></a>
-<span class="sourceLineNo">2957</span>           tableRegions.add(region);<a name="line.2957"></a>
-<span class="sourceLineNo">2958</span>         }<a name="line.2958"></a>
-<span class="sourceLineNo">2959</span>       }<a name="line.2959"></a>
-<span class="sourceLineNo">2960</span>     }<a name="line.2960"></a>
-<span class="sourceLineNo">2961</span>     return tableRegions;<a name="line.2961"></a>
-<span class="sourceLineNo">2962</span>   }<a name="line.2962"></a>
-<span class="sourceLineNo">2963</span><a name="line.2963"></a>
-<span class="sourceLineNo">2964</span>  @Override<a name="line.2964"></a>
-<span class="sourceLineNo">2965</span>  public List&lt;Region&gt; getOnlineRegions() {<a name="line.2965"></a>
-<span class="sourceLineNo">2966</span>    List&lt;Region&gt; allRegions = new ArrayList&lt;&gt;();<a name="line.2966"></a>
-<span class="sourceLineNo">2967</span>    synchronized (this.onlineRegions) {<a name="line.2967"></a>
-<span class="sourceLineNo">2968</span>      // Return a clone copy of the onlineRegions<a name="line.2968"></a>
-<span class="sourceLineNo">2969</span>      allRegions.addAll(onlineRegions.values());<a name="line.2969"></a>
-<span class="sourceLineNo">2970</span>    }<a name="line.2970"></a>
-<span class="sourceLineNo">2971</span>    return allRegions;<a name="line.2971"></a>
-<span class="sourceLineNo">2972</span>  }<a name="line.2972"></a>
-<span class="sourceLineNo">2973</span>  /**<a name="line.2973"></a>
-<span class="sourceLineNo">2974</span>   * Gets the online tables in this RS.<a name="line.2974"></a>
-<span class="sourceLineNo">2975</span>   * This method looks at the in-memory onlineRegions.<a name="line.2975"></a>
-<span class="sourceLineNo">2976</span>   * @return all the online tables in this RS<a name="line.2976"></a>
-<span class="sourceLineNo">2977</span>   */<a name="line.2977"></a>
-<span class="sourceLineNo">2978</span>  @Override<a name="line.2978"></a>
-<span class="sourceLineNo">2979</span>  public Set&lt;TableName&gt; getOnlineTables() {<a name="line.2979"></a>
-<span class="sourceLineNo">2980</span>    Set&lt;TableName&gt; tables = new HashSet&lt;&gt;();<a name="line.2980"></a>
-<span class="sourceLineNo">2981</span>    synchronized (this.onlineRegions) {<a name="line.2981"></a>
-<span class="sourceLineNo">2982</span>      for (Region region: this.onlineRegions.values()) {<a name="line.2982"></a>
-<span class="sourceLineNo">2983</span>        tables.add(region.getTableDesc().getTableName());<a name="line.2983"></a>
-<span class="sourceLineNo">2984</span>      }<a name="line.2984"></a>
-<span class="sourceLineNo">2985</span>    }<a name="line.2985"></a>
-<span class="sourceLineNo">2986</span>    return tables;<a name="line.2986"></a>
-<span class="sourceLineNo">2987</span>  }<a name="line.2987"></a>
-<span class="sourceLineNo">2988</span><a name="line.2988"></a>
-<span class="sourceLineNo">2989</span>  // used by org/apache/hbase/tmpl/regionserver/RSStatusTmpl.jamon (HBASE-4070).<a name="line.2989"></a>
-<span class="sourceLineNo">2990</span>  public String[] getRegionServerCoprocessors() {<a name="line.2990"></a>
-<span class="sourceLineNo">2991</span>    TreeSet&lt;String&gt; coprocessors = new TreeSet&lt;&gt;();<a name="line.2991"></a>
-<span class="sourceLineNo">2992</span>    try {<a name="line.2992"></a>
-<span class="sourceLineNo">2993</span>      coprocessors.addAll(getWAL(null).getCoprocessorHost().getCoprocessors());<a name="line.2993"></a>
-<span class="sourceLineNo">2994</span>    } catch (IOException exception) {<a name="line.2994"></a>
-<span class="sourceLineNo">2995</span>      LOG.warn("Exception attempting to fetch wal coprocessor information for the common wal; " +<a name="line.2995"></a>
-<span class="sourceLineNo">2996</span>          "skipping.");<a name="line.2996"></a>
-<span class="sourceLineNo">2997</span>      LOG.debug("Exception details for failure to fetch wal coprocessor information.", exception);<a name="line.2997"></a>
-<span class="sourceLineNo">2998</span>    }<a name="line.2998"></a>
-<span class="sourceLineNo">2999</span>    Collection&lt;Region&gt; regions = getOnlineRegionsLocalContext();<a name="line.2999"></a>
-<span class="sourceLineNo">3000</span>    for (Region region: regions) {<a name="line.3000"></a>
-<span class="sourceLineNo">3001</span>      coprocessors.addAll(region.getCoprocessorHost().getCoprocessors());<a name="line.3001"></a>
-<span class="sourceLineNo">3002</span>      try {<a name="line.3002"></a>
-<span class="sourceLineNo">3003</span>        coprocessors.addAll(getWAL(region.getRegionInfo()).getCoprocessorHost().getCoprocessors());<a name="line.3003"></a>
-<span class="sourceLineNo">3004</span>      } catch (IOException exception) {<a name="line.3004"></a>
-<span class="sourceLineNo">3005</span>        LOG.warn("Exception attempting to fetch wal coprocessor information for region " + region +<a name="line.3005"></a>
-<span class="sourceLineNo">3006</span>            "; skipping.");<a name="line.3006"></a>
-<span class="sourceLineNo">3007</span>        LOG.debug("Exception details for failure to fetch wal coprocessor information.", exception);<a name="line.3007"></a>
-<span class="sourceLineNo">3008</span>      }<a name="line.3008"></a>
-<span class="sourceLineNo">3009</span>    }<a name="line.3009"></a>
-<span class="sourceLineNo">3010</span>    coprocessors.addAll(rsHost.getCoprocessors());<a name="line.3010"></a>
-<span class="sourceLineNo">3011</span>    return coprocessors.toArray(new String[coprocessors.size()]);<a name="line.3011"></a>
-<span class="sourceLineNo">3012</span>  }<a name="line.3012"></a>
-<span class="sourceLineNo">3013</span><a name="line.3013"></a>
-<span class="sourceLineNo">3014</span>  /**<a name="line.3014"></a>
-<span class="sourceLineNo">3015</span>   * Try to close the region, logs a warning on failure but continues.<a name="line.3015"></a>
-<span class="sourceLineNo">3016</span>   * @param region Region to close<a name="line.3016"></a>
-<span class="sourceLineNo">3017</span>   */<a name="line.3017"></a>
-<span class="sourceLineNo">3018</span>  private void closeRegionIgnoreErrors(HRegionInfo region, final boolean abort) {<a name="line.3018"></a>
-<span class="sourceLineNo">3019</span>    try {<a name="line.3019"></a>
-<span class="sourceLineNo">3020</span>      if (!closeRegion(region.getEncodedName(), abort, null)) {<a name="line.3020"></a>
-<span class="sourceLineNo">3021</span>        LOG.warn("Failed to close " + region.getRegionNameAsString() +<a name="line.3021"></a>
-<span class="sourceLineNo">3022</span>            " - ignoring and continuing");<a name="line.3022"></a>
-<span class="sourceLineNo">3023</span>      }<a name="line.3023"></a>
-<span class="sourceLineNo">3024</span>    } catch (IOException e) {<a name="line.3024"></a>
-<span class="sourceLineNo">3025</span>      LOG.warn("Failed to close " + region.getRegionNameAsString() +<a name="line.3025"></a>
-<span class="sourceLineNo">3026</span>          " - ignoring and continuing", e);<a name="line.3026"></a>
-<span class="sourceLineNo">3027</span>    }<a name="line.3027"></a>
-<span class="sourceLineNo">3028</span>  }<a name="line.3028"></a>
-<span class="sourceLineNo">3029</span><a name="line.3029"></a>
-<span class="sourceLineNo">3030</span>  /**<a name="line.3030"></a>
-<span class="sourceLineNo">3031</span>   * Close asynchronously a region, can be called from the master or internally by the regionserver<a name="line.3031"></a>
-<span class="sourceLineNo">3032</span>   * when stopping. If called from the master, the region will update the znode status.<a name="line.3032"></a>
-<span class="sourceLineNo">3033</span>   *<a name="line.3033"></a>
-<span class="sourceLineNo">3034</span>   * &lt;p&gt;<a name="line.3034"></a>
-<span class="sourceLineNo">3035</span>   * If an opening was in progress, this method will cancel it, but will not start a new close. The<a name="line.3035"></a>
-<span class="sourceLineNo">3036</span>   * coprocessors are not called in this case. A NotServingRegionException exception is thrown.<a name="line.3036"></a>
-<span class="sourceLineNo">3037</span>   * &lt;/p&gt;<a name="line.3037"></a>
-<span class="sourceLineNo">3038</span><a name="line.3038"></a>
-<span class="sourceLineNo">3039</span>   * &lt;p&gt;<a name="line.3039"></a>
-<span class="sourceLineNo">3040</span>   *   If a close was in progress, this new request will be ignored, and an exception thrown.<a name="line.3040"></a>
-<span class="sourceLineNo">3041</span>   * &lt;/p&gt;<a name="line.3041"></a>
-<span class="sourceLineNo">3042</span>   *<a name="line.3042"></a>
-<span class="sourceLineNo">3043</span>   * @param encodedName Region to close<a name="line.3043"></a>
-<span class="sourceLineNo">3044</span>   * @param abort True if we are aborting<a name="line.3044"></a>
-<span class="sourceLineNo">3045</span>   * @return True if closed a region.<a name="line.3045"></a>
-<span class="sourceLineNo">3046</span>   * @throws NotServingRegionException if the region is not online<a name="line.3046"></a>
-<span class="sourceLineNo">3047</span>   */<a name="line.3047"></a>
-<span class="sourceLineNo">3048</span>  protected boolean closeRegion(String encodedName, final boolean abort, final ServerName sn)<a name="line.3048"></a>
-<span class="sourceLineNo">3049</span>      throws NotServingRegionException {<a name="line.3049"></a>
-<span class="sourceLineNo">3050</span>    //Check for permissions to close.<a name="line.3050"></a>
-<span class="sourceLineNo">3051</span>    Region actualRegion = this.getFromOnlineRegions(encodedName);<a name="line.3051"></a>
-<span class="sourceLineNo">3052</span>    // Can be null if we're calling close on a region that's not online<a name="line.3052"></a>
-<span class="sourceLineNo">3053</span>    if ((actualRegion != null) &amp;&amp; (actualRegion.getCoprocessorHost() != null)) {<a name="line.3053"></a>
-<span class="sourceLineNo">3054</span>      try {<a name="line.3054"></a>
-<span class="sourceLineNo">3055</span>        actualRegion.getCoprocessorHost().preClose(false);<a name="line.3055"></a>
-<span class="sourceLineNo">3056</span>      } catch (IOException exp) {<a name="line.3056"></a>
-<span class="sourceLineNo">3057</span>        LOG.warn("Unable to close region: the coprocessor launched an error ", exp);<a name="line.3057"></a>
-<span class="sourceLineNo">3058</span>        return false;<a name="line.3058"></a>
-<span class="sourceLineNo">3059</span>      }<a name="line.3059"></a>
-<span class="sourceLineNo">3060</span>    }<a name="line.3060"></a>
-<span class="sourceLineNo">3061</span><a name="line.3061"></a>
-<span class="sourceLineNo">3062</span>    final Boolean previous = this.regionsInTransitionInRS.putIfAbsent(encodedName.getBytes(),<a name="line.3062"></a>
-<span class="sourceLineNo">3063</span>        Boolean.FALSE);<a name="line.3063"></a>
-<span class="sourceLineNo">3064</span><a name="line.3064"></a>
-<span class="sourceLineNo">3065</span>    if (Boolean.TRUE.equals(previous)) {<a name="line.3065"></a>
-<span class="sourceLineNo">3066</span>      LOG.info("Received CLOSE for the region:" + encodedName + " , which we are already " +<a name="line.3066"></a>
-<span class="sourceLineNo">3067</span>          "trying to OPEN. Cancelling OPENING.");<a name="line.3067"></a>
-<span class="sourceLineNo">3068</span>      if (!regionsInTransitionInRS.replace(encodedName.getBytes(), previous, Boolean.FALSE)){<a name="line.3068"></a>
-<span class="sourceLineNo">3069</span>        // The replace failed. That should be an exceptional case, but theoretically it can happen.<a name="line.3069"></a>
-<span class="sourceLineNo">3070</span>        // We're going to try to do a standard close then.<a name="line.3070"></a>
-<span class="sourceLineNo">3071</span>        LOG.warn("The opening for region " + encodedName + " was done before we could cancel it." +<a name="line.3071"></a>
-<span class="sourceLineNo">3072</span>            " Doing a standard close now");<a name="line.3072"></a>
-<span class="sourceLineNo">3073</span>        return closeRegion(encodedName, abort, sn);<a name="line.3073"></a>
-<span class="sourceLineNo">3074</span>      }<a name="line.3074"></a>
-<span class="sourceLineNo">3075</span>      // Let's get the region from the online region list again<a name="line.3075"></a>
-<span class="sourceLineNo">3076</span>      actualRegion = this.getFromOnlineRegions(encodedName);<a name="line.3076"></a>
-<span class="sourceLineNo">3077</span>      if (actualRegion == null) { // If already online, we still need to close it.<a name="line.3077"></a>
-<span class="sourceLineNo">3078</span>        LOG.info("The opening previously in progress has been cancelled by a CLOSE request.");<a name="line.3078"></a>
-<span class="sourceLineNo">3079</span>        // The master deletes the znode when it receives this exception.<a name="line.3079"></a>
-<span class="sourceLineNo">3080</span>        throw new NotServingRegionException("The region " + encodedName +<a name="line.3080"></a>
-<span class="sourceLineNo">3081</span>          " was opening but not yet served. Opening is cancelled.");<a name="line.3081"></a>
-<span class="sourceLineNo">3082</span>      }<a name="line.3082"></a>
-<span class="sourceLineNo">3083</span>    } else if (Boolean.FALSE.equals(previous)) {<a name="line.3083"></a>
-<span class="sourceLineNo">3084</span>      LOG.info("Received CLOSE for the region: " + encodedName +<a name="line.3084"></a>
-<span class="sourceLineNo">3085</span>        ", which we are already trying to CLOSE, but not completed yet");<a name="line.3085"></a>
-<span class="sourceLineNo">3086</span>      return true;<a name="line.3086"></a>
-<span class="sourceLineNo">3087</span>    }<a name="line.3087"></a>
-<span class="sourceLineNo">3088</span><a name="line.3088"></a>
-<span class="sourceLineNo">3089</span>    if (actualRegion == null) {<a name="line.3089"></a>
-<span class="sourceLineNo">3090</span>      LOG.debug("Received CLOSE for a region which is not online, and we're not opening.");<a name="line.3090"></a>
-<span class="sourceLineNo">3091</span>      this.regionsInTransitionInRS.remove(encodedName.getBytes());<a name="line.3091"></a>
-<span class="sourceLineNo">3092</span>      // The master deletes the znode when it receives this exception.<a name="line.3092"></a>
-<span class="sourceLineNo">3093</span>      throw new NotServingRegionException("The region " + encodedName +<a name="line.3093"></a>
-<span class="sourceLineNo">3094</span>          " is not online, and is not opening.");<a name="line.3094"></a>
-<span class="sourceLineNo">3095</span>    }<a name="line.3095"></a>
-<span class="sourceLineNo">3096</span><a name="line.3096"></a>
-<span class="sourceLineNo">3097</span>    CloseRegionHandler crh;<a name="line.3097"></a>
-<span class="sourceLineNo">3098</span>    final HRegionInfo hri = actualRegion.getRegionInfo();<a name="line.3098"></a>
-<span cl

<TRUNCATED>

Mime
View raw message