http://git-wip-us.apache.org/repos/asf/hbase-site/blob/b9830530/devapidocs/src-html/org/apache/hadoop/hbase/master/procedure/RSProcedureDispatcher.html ---------------------------------------------------------------------- diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/master/procedure/RSProcedureDispatcher.html b/devapidocs/src-html/org/apache/hadoop/hbase/master/procedure/RSProcedureDispatcher.html index f0a9b50..13cebd8 100644 --- a/devapidocs/src-html/org/apache/hadoop/hbase/master/procedure/RSProcedureDispatcher.html +++ b/devapidocs/src-html/org/apache/hadoop/hbase/master/procedure/RSProcedureDispatcher.html @@ -69,7 +69,7 @@ <span class="sourceLineNo">061</span> "hbase.regionserver.rpc.startup.waittime";<a name="line.61"></a> <span class="sourceLineNo">062</span> private static final int DEFAULT_RS_RPC_STARTUP_WAIT_TIME = 60000;<a name="line.62"></a> <span class="sourceLineNo">063</span><a name="line.63"></a> -<span class="sourceLineNo">064</span> private static final int RS_VERSION_WITH_EXEC_PROCS = 0x0201000; // 2.1<a name="line.64"></a> +<span class="sourceLineNo">064</span> private static final int RS_VERSION_WITH_EXEC_PROCS = 0x0200000; // 2.0<a name="line.64"></a> <span class="sourceLineNo">065</span><a name="line.65"></a> <span class="sourceLineNo">066</span> protected final MasterServices master;<a name="line.66"></a> <span class="sourceLineNo">067</span> protected final long rsStartupWaitTime;<a name="line.67"></a> @@ -267,286 +267,289 @@ <span class="sourceLineNo">259</span> final MasterProcedureEnv env = master.getMasterProcedureExecutor().getEnvironment();<a name="line.259"></a> <span class="sourceLineNo">260</span><a name="line.260"></a> <span class="sourceLineNo">261</span> request = ExecuteProceduresRequest.newBuilder();<a name="line.261"></a> -<span class="sourceLineNo">262</span> splitAndResolveOperation(getServerName(), operations, this);<a name="line.262"></a> -<span class="sourceLineNo">263</span><a name="line.263"></a> -<span class="sourceLineNo">264</span> try {<a name="line.264"></a> -<span class="sourceLineNo">265</span> final ExecuteProceduresResponse response = sendRequest(getServerName(), request.build());<a name="line.265"></a> -<span class="sourceLineNo">266</span> remoteCallCompleted(env, response);<a name="line.266"></a> -<span class="sourceLineNo">267</span> } catch (IOException e) {<a name="line.267"></a> -<span class="sourceLineNo">268</span> e = unwrapException(e);<a name="line.268"></a> -<span class="sourceLineNo">269</span> // TODO: In the future some operation may want to bail out early.<a name="line.269"></a> -<span class="sourceLineNo">270</span> // TODO: How many times should we retry (use numberOfAttemptsSoFar)<a name="line.270"></a> -<span class="sourceLineNo">271</span> if (!scheduleForRetry(e)) {<a name="line.271"></a> -<span class="sourceLineNo">272</span> remoteCallFailed(env, e);<a name="line.272"></a> -<span class="sourceLineNo">273</span> }<a name="line.273"></a> -<span class="sourceLineNo">274</span> }<a name="line.274"></a> -<span class="sourceLineNo">275</span> return null;<a name="line.275"></a> -<span class="sourceLineNo">276</span> }<a name="line.276"></a> -<span class="sourceLineNo">277</span><a name="line.277"></a> -<span class="sourceLineNo">278</span> public void dispatchOpenRequests(final MasterProcedureEnv env,<a name="line.278"></a> -<span class="sourceLineNo">279</span> final List<RegionOpenOperation> operations) {<a name="line.279"></a> -<span class="sourceLineNo">280</span> request.addOpenRegion(buildOpenRegionRequest(env, getServerName(), operations));<a name="line.280"></a> -<span class="sourceLineNo">281</span> }<a name="line.281"></a> -<span class="sourceLineNo">282</span><a name="line.282"></a> -<span class="sourceLineNo">283</span> public void dispatchCloseRequests(final MasterProcedureEnv env,<a name="line.283"></a> -<span class="sourceLineNo">284</span> final List<RegionCloseOperation> operations) {<a name="line.284"></a> -<span class="sourceLineNo">285</span> for (RegionCloseOperation op: operations) {<a name="line.285"></a> -<span class="sourceLineNo">286</span> request.addCloseRegion(op.buildCloseRegionRequest(getServerName()));<a name="line.286"></a> -<span class="sourceLineNo">287</span> }<a name="line.287"></a> -<span class="sourceLineNo">288</span> }<a name="line.288"></a> -<span class="sourceLineNo">289</span><a name="line.289"></a> -<span class="sourceLineNo">290</span> protected ExecuteProceduresResponse sendRequest(final ServerName serverName,<a name="line.290"></a> -<span class="sourceLineNo">291</span> final ExecuteProceduresRequest request) throws IOException {<a name="line.291"></a> -<span class="sourceLineNo">292</span> try {<a name="line.292"></a> -<span class="sourceLineNo">293</span> return getRsAdmin().executeProcedures(null, request);<a name="line.293"></a> -<span class="sourceLineNo">294</span> } catch (ServiceException se) {<a name="line.294"></a> -<span class="sourceLineNo">295</span> throw ProtobufUtil.getRemoteException(se);<a name="line.295"></a> -<span class="sourceLineNo">296</span> }<a name="line.296"></a> -<span class="sourceLineNo">297</span> }<a name="line.297"></a> -<span class="sourceLineNo">298</span><a name="line.298"></a> -<span class="sourceLineNo">299</span><a name="line.299"></a> -<span class="sourceLineNo">300</span> private void remoteCallCompleted(final MasterProcedureEnv env,<a name="line.300"></a> -<span class="sourceLineNo">301</span> final ExecuteProceduresResponse response) {<a name="line.301"></a> -<span class="sourceLineNo">302</span> /*<a name="line.302"></a> -<span class="sourceLineNo">303</span> for (RemoteProcedure proc: operations) {<a name="line.303"></a> -<span class="sourceLineNo">304</span> proc.remoteCallCompleted(env, getServerName(), response);<a name="line.304"></a> -<span class="sourceLineNo">305</span> }*/<a name="line.305"></a> -<span class="sourceLineNo">306</span> }<a name="line.306"></a> -<span class="sourceLineNo">307</span><a name="line.307"></a> -<span class="sourceLineNo">308</span> private void remoteCallFailed(final MasterProcedureEnv env, final IOException e) {<a name="line.308"></a> -<span class="sourceLineNo">309</span> for (RemoteProcedure proc: operations) {<a name="line.309"></a> -<span class="sourceLineNo">310</span> proc.remoteCallFailed(env, getServerName(), e);<a name="line.310"></a> -<span class="sourceLineNo">311</span> }<a name="line.311"></a> -<span class="sourceLineNo">312</span> }<a name="line.312"></a> -<span class="sourceLineNo">313</span> }<a name="line.313"></a> -<span class="sourceLineNo">314</span><a name="line.314"></a> -<span class="sourceLineNo">315</span> // ==========================================================================<a name="line.315"></a> -<span class="sourceLineNo">316</span> // Compatibility calls<a name="line.316"></a> -<span class="sourceLineNo">317</span> // Since we don't have a "batch proc-exec" request on the target RS<a name="line.317"></a> -<span class="sourceLineNo">318</span> // we have to chunk the requests by type and dispatch the specific request.<a name="line.318"></a> -<span class="sourceLineNo">319</span> // ==========================================================================<a name="line.319"></a> -<span class="sourceLineNo">320</span> private static OpenRegionRequest buildOpenRegionRequest(final MasterProcedureEnv env,<a name="line.320"></a> -<span class="sourceLineNo">321</span> final ServerName serverName, final List<RegionOpenOperation> operations) {<a name="line.321"></a> -<span class="sourceLineNo">322</span> final OpenRegionRequest.Builder builder = OpenRegionRequest.newBuilder();<a name="line.322"></a> -<span class="sourceLineNo">323</span> builder.setServerStartCode(serverName.getStartcode());<a name="line.323"></a> -<span class="sourceLineNo">324</span> builder.setMasterSystemTime(EnvironmentEdgeManager.currentTime());<a name="line.324"></a> -<span class="sourceLineNo">325</span> for (RegionOpenOperation op: operations) {<a name="line.325"></a> -<span class="sourceLineNo">326</span> builder.addOpenInfo(op.buildRegionOpenInfoRequest(env));<a name="line.326"></a> -<span class="sourceLineNo">327</span> }<a name="line.327"></a> -<span class="sourceLineNo">328</span> return builder.build();<a name="line.328"></a> -<span class="sourceLineNo">329</span> }<a name="line.329"></a> -<span class="sourceLineNo">330</span><a name="line.330"></a> -<span class="sourceLineNo">331</span> private final class OpenRegionRemoteCall extends AbstractRSRemoteCall {<a name="line.331"></a> -<span class="sourceLineNo">332</span> private final List<RegionOpenOperation> operations;<a name="line.332"></a> +<span class="sourceLineNo">262</span> if (LOG.isTraceEnabled()) {<a name="line.262"></a> +<span class="sourceLineNo">263</span> LOG.trace("Building request with operations count=" + operations.size());<a name="line.263"></a> +<span class="sourceLineNo">264</span> }<a name="line.264"></a> +<span class="sourceLineNo">265</span> splitAndResolveOperation(getServerName(), operations, this);<a name="line.265"></a> +<span class="sourceLineNo">266</span><a name="line.266"></a> +<span class="sourceLineNo">267</span> try {<a name="line.267"></a> +<span class="sourceLineNo">268</span> final ExecuteProceduresResponse response = sendRequest(getServerName(), request.build());<a name="line.268"></a> +<span class="sourceLineNo">269</span> remoteCallCompleted(env, response);<a name="line.269"></a> +<span class="sourceLineNo">270</span> } catch (IOException e) {<a name="line.270"></a> +<span class="sourceLineNo">271</span> e = unwrapException(e);<a name="line.271"></a> +<span class="sourceLineNo">272</span> // TODO: In the future some operation may want to bail out early.<a name="line.272"></a> +<span class="sourceLineNo">273</span> // TODO: How many times should we retry (use numberOfAttemptsSoFar)<a name="line.273"></a> +<span class="sourceLineNo">274</span> if (!scheduleForRetry(e)) {<a name="line.274"></a> +<span class="sourceLineNo">275</span> remoteCallFailed(env, e);<a name="line.275"></a> +<span class="sourceLineNo">276</span> }<a name="line.276"></a> +<span class="sourceLineNo">277</span> }<a name="line.277"></a> +<span class="sourceLineNo">278</span> return null;<a name="line.278"></a> +<span class="sourceLineNo">279</span> }<a name="line.279"></a> +<span class="sourceLineNo">280</span><a name="line.280"></a> +<span class="sourceLineNo">281</span> public void dispatchOpenRequests(final MasterProcedureEnv env,<a name="line.281"></a> +<span class="sourceLineNo">282</span> final List<RegionOpenOperation> operations) {<a name="line.282"></a> +<span class="sourceLineNo">283</span> request.addOpenRegion(buildOpenRegionRequest(env, getServerName(), operations));<a name="line.283"></a> +<span class="sourceLineNo">284</span> }<a name="line.284"></a> +<span class="sourceLineNo">285</span><a name="line.285"></a> +<span class="sourceLineNo">286</span> public void dispatchCloseRequests(final MasterProcedureEnv env,<a name="line.286"></a> +<span class="sourceLineNo">287</span> final List<RegionCloseOperation> operations) {<a name="line.287"></a> +<span class="sourceLineNo">288</span> for (RegionCloseOperation op: operations) {<a name="line.288"></a> +<span class="sourceLineNo">289</span> request.addCloseRegion(op.buildCloseRegionRequest(getServerName()));<a name="line.289"></a> +<span class="sourceLineNo">290</span> }<a name="line.290"></a> +<span class="sourceLineNo">291</span> }<a name="line.291"></a> +<span class="sourceLineNo">292</span><a name="line.292"></a> +<span class="sourceLineNo">293</span> protected ExecuteProceduresResponse sendRequest(final ServerName serverName,<a name="line.293"></a> +<span class="sourceLineNo">294</span> final ExecuteProceduresRequest request) throws IOException {<a name="line.294"></a> +<span class="sourceLineNo">295</span> try {<a name="line.295"></a> +<span class="sourceLineNo">296</span> return getRsAdmin().executeProcedures(null, request);<a name="line.296"></a> +<span class="sourceLineNo">297</span> } catch (ServiceException se) {<a name="line.297"></a> +<span class="sourceLineNo">298</span> throw ProtobufUtil.getRemoteException(se);<a name="line.298"></a> +<span class="sourceLineNo">299</span> }<a name="line.299"></a> +<span class="sourceLineNo">300</span> }<a name="line.300"></a> +<span class="sourceLineNo">301</span><a name="line.301"></a> +<span class="sourceLineNo">302</span><a name="line.302"></a> +<span class="sourceLineNo">303</span> private void remoteCallCompleted(final MasterProcedureEnv env,<a name="line.303"></a> +<span class="sourceLineNo">304</span> final ExecuteProceduresResponse response) {<a name="line.304"></a> +<span class="sourceLineNo">305</span> /*<a name="line.305"></a> +<span class="sourceLineNo">306</span> for (RemoteProcedure proc: operations) {<a name="line.306"></a> +<span class="sourceLineNo">307</span> proc.remoteCallCompleted(env, getServerName(), response);<a name="line.307"></a> +<span class="sourceLineNo">308</span> }*/<a name="line.308"></a> +<span class="sourceLineNo">309</span> }<a name="line.309"></a> +<span class="sourceLineNo">310</span><a name="line.310"></a> +<span class="sourceLineNo">311</span> private void remoteCallFailed(final MasterProcedureEnv env, final IOException e) {<a name="line.311"></a> +<span class="sourceLineNo">312</span> for (RemoteProcedure proc: operations) {<a name="line.312"></a> +<span class="sourceLineNo">313</span> proc.remoteCallFailed(env, getServerName(), e);<a name="line.313"></a> +<span class="sourceLineNo">314</span> }<a name="line.314"></a> +<span class="sourceLineNo">315</span> }<a name="line.315"></a> +<span class="sourceLineNo">316</span> }<a name="line.316"></a> +<span class="sourceLineNo">317</span><a name="line.317"></a> +<span class="sourceLineNo">318</span> // ==========================================================================<a name="line.318"></a> +<span class="sourceLineNo">319</span> // Compatibility calls<a name="line.319"></a> +<span class="sourceLineNo">320</span> // Since we don't have a "batch proc-exec" request on the target RS<a name="line.320"></a> +<span class="sourceLineNo">321</span> // we have to chunk the requests by type and dispatch the specific request.<a name="line.321"></a> +<span class="sourceLineNo">322</span> // ==========================================================================<a name="line.322"></a> +<span class="sourceLineNo">323</span> private static OpenRegionRequest buildOpenRegionRequest(final MasterProcedureEnv env,<a name="line.323"></a> +<span class="sourceLineNo">324</span> final ServerName serverName, final List<RegionOpenOperation> operations) {<a name="line.324"></a> +<span class="sourceLineNo">325</span> final OpenRegionRequest.Builder builder = OpenRegionRequest.newBuilder();<a name="line.325"></a> +<span class="sourceLineNo">326</span> builder.setServerStartCode(serverName.getStartcode());<a name="line.326"></a> +<span class="sourceLineNo">327</span> builder.setMasterSystemTime(EnvironmentEdgeManager.currentTime());<a name="line.327"></a> +<span class="sourceLineNo">328</span> for (RegionOpenOperation op: operations) {<a name="line.328"></a> +<span class="sourceLineNo">329</span> builder.addOpenInfo(op.buildRegionOpenInfoRequest(env));<a name="line.329"></a> +<span class="sourceLineNo">330</span> }<a name="line.330"></a> +<span class="sourceLineNo">331</span> return builder.build();<a name="line.331"></a> +<span class="sourceLineNo">332</span> }<a name="line.332"></a> <span class="sourceLineNo">333</span><a name="line.333"></a> -<span class="sourceLineNo">334</span> public OpenRegionRemoteCall(final ServerName serverName,<a name="line.334"></a> -<span class="sourceLineNo">335</span> final List<RegionOpenOperation> operations) {<a name="line.335"></a> -<span class="sourceLineNo">336</span> super(serverName);<a name="line.336"></a> -<span class="sourceLineNo">337</span> this.operations = operations;<a name="line.337"></a> -<span class="sourceLineNo">338</span> }<a name="line.338"></a> -<span class="sourceLineNo">339</span><a name="line.339"></a> -<span class="sourceLineNo">340</span> @Override<a name="line.340"></a> -<span class="sourceLineNo">341</span> public Void call() {<a name="line.341"></a> -<span class="sourceLineNo">342</span> final MasterProcedureEnv env = master.getMasterProcedureExecutor().getEnvironment();<a name="line.342"></a> -<span class="sourceLineNo">343</span> final OpenRegionRequest request = buildOpenRegionRequest(env, getServerName(), operations);<a name="line.343"></a> -<span class="sourceLineNo">344</span><a name="line.344"></a> -<span class="sourceLineNo">345</span> try {<a name="line.345"></a> -<span class="sourceLineNo">346</span> OpenRegionResponse response = sendRequest(getServerName(), request);<a name="line.346"></a> -<span class="sourceLineNo">347</span> remoteCallCompleted(env, response);<a name="line.347"></a> -<span class="sourceLineNo">348</span> } catch (IOException e) {<a name="line.348"></a> -<span class="sourceLineNo">349</span> e = unwrapException(e);<a name="line.349"></a> -<span class="sourceLineNo">350</span> // TODO: In the future some operation may want to bail out early.<a name="line.350"></a> -<span class="sourceLineNo">351</span> // TODO: How many times should we retry (use numberOfAttemptsSoFar)<a name="line.351"></a> -<span class="sourceLineNo">352</span> if (!scheduleForRetry(e)) {<a name="line.352"></a> -<span class="sourceLineNo">353</span> remoteCallFailed(env, e);<a name="line.353"></a> -<span class="sourceLineNo">354</span> }<a name="line.354"></a> -<span class="sourceLineNo">355</span> }<a name="line.355"></a> -<span class="sourceLineNo">356</span> return null;<a name="line.356"></a> -<span class="sourceLineNo">357</span> }<a name="line.357"></a> -<span class="sourceLineNo">358</span><a name="line.358"></a> -<span class="sourceLineNo">359</span> private OpenRegionResponse sendRequest(final ServerName serverName,<a name="line.359"></a> -<span class="sourceLineNo">360</span> final OpenRegionRequest request) throws IOException {<a name="line.360"></a> -<span class="sourceLineNo">361</span> try {<a name="line.361"></a> -<span class="sourceLineNo">362</span> return getRsAdmin().openRegion(null, request);<a name="line.362"></a> -<span class="sourceLineNo">363</span> } catch (ServiceException se) {<a name="line.363"></a> -<span class="sourceLineNo">364</span> throw ProtobufUtil.getRemoteException(se);<a name="line.364"></a> -<span class="sourceLineNo">365</span> }<a name="line.365"></a> -<span class="sourceLineNo">366</span> }<a name="line.366"></a> -<span class="sourceLineNo">367</span><a name="line.367"></a> -<span class="sourceLineNo">368</span> private void remoteCallCompleted(final MasterProcedureEnv env,<a name="line.368"></a> -<span class="sourceLineNo">369</span> final OpenRegionResponse response) {<a name="line.369"></a> -<span class="sourceLineNo">370</span> int index = 0;<a name="line.370"></a> -<span class="sourceLineNo">371</span> for (RegionOpenOperation op: operations) {<a name="line.371"></a> -<span class="sourceLineNo">372</span> OpenRegionResponse.RegionOpeningState state = response.getOpeningState(index++);<a name="line.372"></a> -<span class="sourceLineNo">373</span> op.setFailedOpen(state == OpenRegionResponse.RegionOpeningState.FAILED_OPENING);<a name="line.373"></a> -<span class="sourceLineNo">374</span> op.getRemoteProcedure().remoteCallCompleted(env, getServerName(), op);<a name="line.374"></a> -<span class="sourceLineNo">375</span> }<a name="line.375"></a> -<span class="sourceLineNo">376</span> }<a name="line.376"></a> -<span class="sourceLineNo">377</span><a name="line.377"></a> -<span class="sourceLineNo">378</span> private void remoteCallFailed(final MasterProcedureEnv env, final IOException e) {<a name="line.378"></a> -<span class="sourceLineNo">379</span> for (RegionOpenOperation op: operations) {<a name="line.379"></a> -<span class="sourceLineNo">380</span> op.getRemoteProcedure().remoteCallFailed(env, getServerName(), e);<a name="line.380"></a> -<span class="sourceLineNo">381</span> }<a name="line.381"></a> -<span class="sourceLineNo">382</span> }<a name="line.382"></a> -<span class="sourceLineNo">383</span> }<a name="line.383"></a> -<span class="sourceLineNo">384</span><a name="line.384"></a> -<span class="sourceLineNo">385</span> private final class CloseRegionRemoteCall extends AbstractRSRemoteCall {<a name="line.385"></a> -<span class="sourceLineNo">386</span> private final RegionCloseOperation operation;<a name="line.386"></a> +<span class="sourceLineNo">334</span> private final class OpenRegionRemoteCall extends AbstractRSRemoteCall {<a name="line.334"></a> +<span class="sourceLineNo">335</span> private final List<RegionOpenOperation> operations;<a name="line.335"></a> +<span class="sourceLineNo">336</span><a name="line.336"></a> +<span class="sourceLineNo">337</span> public OpenRegionRemoteCall(final ServerName serverName,<a name="line.337"></a> +<span class="sourceLineNo">338</span> final List<RegionOpenOperation> operations) {<a name="line.338"></a> +<span class="sourceLineNo">339</span> super(serverName);<a name="line.339"></a> +<span class="sourceLineNo">340</span> this.operations = operations;<a name="line.340"></a> +<span class="sourceLineNo">341</span> }<a name="line.341"></a> +<span class="sourceLineNo">342</span><a name="line.342"></a> +<span class="sourceLineNo">343</span> @Override<a name="line.343"></a> +<span class="sourceLineNo">344</span> public Void call() {<a name="line.344"></a> +<span class="sourceLineNo">345</span> final MasterProcedureEnv env = master.getMasterProcedureExecutor().getEnvironment();<a name="line.345"></a> +<span class="sourceLineNo">346</span> final OpenRegionRequest request = buildOpenRegionRequest(env, getServerName(), operations);<a name="line.346"></a> +<span class="sourceLineNo">347</span><a name="line.347"></a> +<span class="sourceLineNo">348</span> try {<a name="line.348"></a> +<span class="sourceLineNo">349</span> OpenRegionResponse response = sendRequest(getServerName(), request);<a name="line.349"></a> +<span class="sourceLineNo">350</span> remoteCallCompleted(env, response);<a name="line.350"></a> +<span class="sourceLineNo">351</span> } catch (IOException e) {<a name="line.351"></a> +<span class="sourceLineNo">352</span> e = unwrapException(e);<a name="line.352"></a> +<span class="sourceLineNo">353</span> // TODO: In the future some operation may want to bail out early.<a name="line.353"></a> +<span class="sourceLineNo">354</span> // TODO: How many times should we retry (use numberOfAttemptsSoFar)<a name="line.354"></a> +<span class="sourceLineNo">355</span> if (!scheduleForRetry(e)) {<a name="line.355"></a> +<span class="sourceLineNo">356</span> remoteCallFailed(env, e);<a name="line.356"></a> +<span class="sourceLineNo">357</span> }<a name="line.357"></a> +<span class="sourceLineNo">358</span> }<a name="line.358"></a> +<span class="sourceLineNo">359</span> return null;<a name="line.359"></a> +<span class="sourceLineNo">360</span> }<a name="line.360"></a> +<span class="sourceLineNo">361</span><a name="line.361"></a> +<span class="sourceLineNo">362</span> private OpenRegionResponse sendRequest(final ServerName serverName,<a name="line.362"></a> +<span class="sourceLineNo">363</span> final OpenRegionRequest request) throws IOException {<a name="line.363"></a> +<span class="sourceLineNo">364</span> try {<a name="line.364"></a> +<span class="sourceLineNo">365</span> return getRsAdmin().openRegion(null, request);<a name="line.365"></a> +<span class="sourceLineNo">366</span> } catch (ServiceException se) {<a name="line.366"></a> +<span class="sourceLineNo">367</span> throw ProtobufUtil.getRemoteException(se);<a name="line.367"></a> +<span class="sourceLineNo">368</span> }<a name="line.368"></a> +<span class="sourceLineNo">369</span> }<a name="line.369"></a> +<span class="sourceLineNo">370</span><a name="line.370"></a> +<span class="sourceLineNo">371</span> private void remoteCallCompleted(final MasterProcedureEnv env,<a name="line.371"></a> +<span class="sourceLineNo">372</span> final OpenRegionResponse response) {<a name="line.372"></a> +<span class="sourceLineNo">373</span> int index = 0;<a name="line.373"></a> +<span class="sourceLineNo">374</span> for (RegionOpenOperation op: operations) {<a name="line.374"></a> +<span class="sourceLineNo">375</span> OpenRegionResponse.RegionOpeningState state = response.getOpeningState(index++);<a name="line.375"></a> +<span class="sourceLineNo">376</span> op.setFailedOpen(state == OpenRegionResponse.RegionOpeningState.FAILED_OPENING);<a name="line.376"></a> +<span class="sourceLineNo">377</span> op.getRemoteProcedure().remoteCallCompleted(env, getServerName(), op);<a name="line.377"></a> +<span class="sourceLineNo">378</span> }<a name="line.378"></a> +<span class="sourceLineNo">379</span> }<a name="line.379"></a> +<span class="sourceLineNo">380</span><a name="line.380"></a> +<span class="sourceLineNo">381</span> private void remoteCallFailed(final MasterProcedureEnv env, final IOException e) {<a name="line.381"></a> +<span class="sourceLineNo">382</span> for (RegionOpenOperation op: operations) {<a name="line.382"></a> +<span class="sourceLineNo">383</span> op.getRemoteProcedure().remoteCallFailed(env, getServerName(), e);<a name="line.383"></a> +<span class="sourceLineNo">384</span> }<a name="line.384"></a> +<span class="sourceLineNo">385</span> }<a name="line.385"></a> +<span class="sourceLineNo">386</span> }<a name="line.386"></a> <span class="sourceLineNo">387</span><a name="line.387"></a> -<span class="sourceLineNo">388</span> public CloseRegionRemoteCall(final ServerName serverName,<a name="line.388"></a> -<span class="sourceLineNo">389</span> final RegionCloseOperation operation) {<a name="line.389"></a> -<span class="sourceLineNo">390</span> super(serverName);<a name="line.390"></a> -<span class="sourceLineNo">391</span> this.operation = operation;<a name="line.391"></a> -<span class="sourceLineNo">392</span> }<a name="line.392"></a> -<span class="sourceLineNo">393</span><a name="line.393"></a> -<span class="sourceLineNo">394</span> @Override<a name="line.394"></a> -<span class="sourceLineNo">395</span> public Void call() {<a name="line.395"></a> -<span class="sourceLineNo">396</span> final MasterProcedureEnv env = master.getMasterProcedureExecutor().getEnvironment();<a name="line.396"></a> -<span class="sourceLineNo">397</span> final CloseRegionRequest request = operation.buildCloseRegionRequest(getServerName());<a name="line.397"></a> -<span class="sourceLineNo">398</span> try {<a name="line.398"></a> -<span class="sourceLineNo">399</span> CloseRegionResponse response = sendRequest(getServerName(), request);<a name="line.399"></a> -<span class="sourceLineNo">400</span> remoteCallCompleted(env, response);<a name="line.400"></a> -<span class="sourceLineNo">401</span> } catch (IOException e) {<a name="line.401"></a> -<span class="sourceLineNo">402</span> e = unwrapException(e);<a name="line.402"></a> -<span class="sourceLineNo">403</span> // TODO: In the future some operation may want to bail out early.<a name="line.403"></a> -<span class="sourceLineNo">404</span> // TODO: How many times should we retry (use numberOfAttemptsSoFar)<a name="line.404"></a> -<span class="sourceLineNo">405</span> if (!scheduleForRetry(e)) {<a name="line.405"></a> -<span class="sourceLineNo">406</span> remoteCallFailed(env, e);<a name="line.406"></a> -<span class="sourceLineNo">407</span> }<a name="line.407"></a> -<span class="sourceLineNo">408</span> }<a name="line.408"></a> -<span class="sourceLineNo">409</span> return null;<a name="line.409"></a> -<span class="sourceLineNo">410</span> }<a name="line.410"></a> -<span class="sourceLineNo">411</span><a name="line.411"></a> -<span class="sourceLineNo">412</span> private CloseRegionResponse sendRequest(final ServerName serverName,<a name="line.412"></a> -<span class="sourceLineNo">413</span> final CloseRegionRequest request) throws IOException {<a name="line.413"></a> -<span class="sourceLineNo">414</span> try {<a name="line.414"></a> -<span class="sourceLineNo">415</span> return getRsAdmin().closeRegion(null, request);<a name="line.415"></a> -<span class="sourceLineNo">416</span> } catch (ServiceException se) {<a name="line.416"></a> -<span class="sourceLineNo">417</span> throw ProtobufUtil.getRemoteException(se);<a name="line.417"></a> -<span class="sourceLineNo">418</span> }<a name="line.418"></a> -<span class="sourceLineNo">419</span> }<a name="line.419"></a> -<span class="sourceLineNo">420</span><a name="line.420"></a> -<span class="sourceLineNo">421</span> private void remoteCallCompleted(final MasterProcedureEnv env,<a name="line.421"></a> -<span class="sourceLineNo">422</span> final CloseRegionResponse response) {<a name="line.422"></a> -<span class="sourceLineNo">423</span> operation.setClosed(response.getClosed());<a name="line.423"></a> -<span class="sourceLineNo">424</span> operation.getRemoteProcedure().remoteCallCompleted(env, getServerName(), operation);<a name="line.424"></a> -<span class="sourceLineNo">425</span> }<a name="line.425"></a> -<span class="sourceLineNo">426</span><a name="line.426"></a> -<span class="sourceLineNo">427</span> private void remoteCallFailed(final MasterProcedureEnv env, final IOException e) {<a name="line.427"></a> -<span class="sourceLineNo">428</span> operation.getRemoteProcedure().remoteCallFailed(env, getServerName(), e);<a name="line.428"></a> -<span class="sourceLineNo">429</span> }<a name="line.429"></a> -<span class="sourceLineNo">430</span> }<a name="line.430"></a> -<span class="sourceLineNo">431</span><a name="line.431"></a> -<span class="sourceLineNo">432</span> protected class CompatRemoteProcedureResolver implements Callable<Void>, RemoteProcedureResolver {<a name="line.432"></a> -<span class="sourceLineNo">433</span> private final Set<RemoteProcedure> operations;<a name="line.433"></a> -<span class="sourceLineNo">434</span> private final ServerName serverName;<a name="line.434"></a> -<span class="sourceLineNo">435</span><a name="line.435"></a> -<span class="sourceLineNo">436</span> public CompatRemoteProcedureResolver(final ServerName serverName,<a name="line.436"></a> -<span class="sourceLineNo">437</span> final Set<RemoteProcedure> operations) {<a name="line.437"></a> -<span class="sourceLineNo">438</span> this.serverName = serverName;<a name="line.438"></a> -<span class="sourceLineNo">439</span> this.operations = operations;<a name="line.439"></a> -<span class="sourceLineNo">440</span> }<a name="line.440"></a> -<span class="sourceLineNo">441</span><a name="line.441"></a> -<span class="sourceLineNo">442</span> @Override<a name="line.442"></a> -<span class="sourceLineNo">443</span> public Void call() {<a name="line.443"></a> -<span class="sourceLineNo">444</span> splitAndResolveOperation(serverName, operations, this);<a name="line.444"></a> -<span class="sourceLineNo">445</span> return null;<a name="line.445"></a> -<span class="sourceLineNo">446</span> }<a name="line.446"></a> -<span class="sourceLineNo">447</span><a name="line.447"></a> -<span class="sourceLineNo">448</span> public void dispatchOpenRequests(final MasterProcedureEnv env,<a name="line.448"></a> -<span class="sourceLineNo">449</span> final List<RegionOpenOperation> operations) {<a name="line.449"></a> -<span class="sourceLineNo">450</span> submitTask(new OpenRegionRemoteCall(serverName, operations));<a name="line.450"></a> -<span class="sourceLineNo">451</span> }<a name="line.451"></a> -<span class="sourceLineNo">452</span><a name="line.452"></a> -<span class="sourceLineNo">453</span> public void dispatchCloseRequests(final MasterProcedureEnv env,<a name="line.453"></a> -<span class="sourceLineNo">454</span> final List<RegionCloseOperation> operations) {<a name="line.454"></a> -<span class="sourceLineNo">455</span> for (RegionCloseOperation op: operations) {<a name="line.455"></a> -<span class="sourceLineNo">456</span> submitTask(new CloseRegionRemoteCall(serverName, op));<a name="line.456"></a> -<span class="sourceLineNo">457</span> }<a name="line.457"></a> -<span class="sourceLineNo">458</span> }<a name="line.458"></a> -<span class="sourceLineNo">459</span> }<a name="line.459"></a> -<span class="sourceLineNo">460</span><a name="line.460"></a> -<span class="sourceLineNo">461</span> // ==========================================================================<a name="line.461"></a> -<span class="sourceLineNo">462</span> // RPC Messages<a name="line.462"></a> -<span class="sourceLineNo">463</span> // - ServerOperation: refreshConfig, grant, revoke, ...<a name="line.463"></a> -<span class="sourceLineNo">464</span> // - RegionOperation: open, close, flush, snapshot, ...<a name="line.464"></a> -<span class="sourceLineNo">465</span> // ==========================================================================<a name="line.465"></a> -<span class="sourceLineNo">466</span> public static abstract class ServerOperation extends RemoteOperation {<a name="line.466"></a> -<span class="sourceLineNo">467</span> protected ServerOperation(final RemoteProcedure remoteProcedure) {<a name="line.467"></a> -<span class="sourceLineNo">468</span> super(remoteProcedure);<a name="line.468"></a> -<span class="sourceLineNo">469</span> }<a name="line.469"></a> -<span class="sourceLineNo">470</span> }<a name="line.470"></a> -<span class="sourceLineNo">471</span><a name="line.471"></a> -<span class="sourceLineNo">472</span> public static abstract class RegionOperation extends RemoteOperation {<a name="line.472"></a> -<span class="sourceLineNo">473</span> private final HRegionInfo regionInfo;<a name="line.473"></a> +<span class="sourceLineNo">388</span> private final class CloseRegionRemoteCall extends AbstractRSRemoteCall {<a name="line.388"></a> +<span class="sourceLineNo">389</span> private final RegionCloseOperation operation;<a name="line.389"></a> +<span class="sourceLineNo">390</span><a name="line.390"></a> +<span class="sourceLineNo">391</span> public CloseRegionRemoteCall(final ServerName serverName,<a name="line.391"></a> +<span class="sourceLineNo">392</span> final RegionCloseOperation operation) {<a name="line.392"></a> +<span class="sourceLineNo">393</span> super(serverName);<a name="line.393"></a> +<span class="sourceLineNo">394</span> this.operation = operation;<a name="line.394"></a> +<span class="sourceLineNo">395</span> }<a name="line.395"></a> +<span class="sourceLineNo">396</span><a name="line.396"></a> +<span class="sourceLineNo">397</span> @Override<a name="line.397"></a> +<span class="sourceLineNo">398</span> public Void call() {<a name="line.398"></a> +<span class="sourceLineNo">399</span> final MasterProcedureEnv env = master.getMasterProcedureExecutor().getEnvironment();<a name="line.399"></a> +<span class="sourceLineNo">400</span> final CloseRegionRequest request = operation.buildCloseRegionRequest(getServerName());<a name="line.400"></a> +<span class="sourceLineNo">401</span> try {<a name="line.401"></a> +<span class="sourceLineNo">402</span> CloseRegionResponse response = sendRequest(getServerName(), request);<a name="line.402"></a> +<span class="sourceLineNo">403</span> remoteCallCompleted(env, response);<a name="line.403"></a> +<span class="sourceLineNo">404</span> } catch (IOException e) {<a name="line.404"></a> +<span class="sourceLineNo">405</span> e = unwrapException(e);<a name="line.405"></a> +<span class="sourceLineNo">406</span> // TODO: In the future some operation may want to bail out early.<a name="line.406"></a> +<span class="sourceLineNo">407</span> // TODO: How many times should we retry (use numberOfAttemptsSoFar)<a name="line.407"></a> +<span class="sourceLineNo">408</span> if (!scheduleForRetry(e)) {<a name="line.408"></a> +<span class="sourceLineNo">409</span> remoteCallFailed(env, e);<a name="line.409"></a> +<span class="sourceLineNo">410</span> }<a name="line.410"></a> +<span class="sourceLineNo">411</span> }<a name="line.411"></a> +<span class="sourceLineNo">412</span> return null;<a name="line.412"></a> +<span class="sourceLineNo">413</span> }<a name="line.413"></a> +<span class="sourceLineNo">414</span><a name="line.414"></a> +<span class="sourceLineNo">415</span> private CloseRegionResponse sendRequest(final ServerName serverName,<a name="line.415"></a> +<span class="sourceLineNo">416</span> final CloseRegionRequest request) throws IOException {<a name="line.416"></a> +<span class="sourceLineNo">417</span> try {<a name="line.417"></a> +<span class="sourceLineNo">418</span> return getRsAdmin().closeRegion(null, request);<a name="line.418"></a> +<span class="sourceLineNo">419</span> } catch (ServiceException se) {<a name="line.419"></a> +<span class="sourceLineNo">420</span> throw ProtobufUtil.getRemoteException(se);<a name="line.420"></a> +<span class="sourceLineNo">421</span> }<a name="line.421"></a> +<span class="sourceLineNo">422</span> }<a name="line.422"></a> +<span class="sourceLineNo">423</span><a name="line.423"></a> +<span class="sourceLineNo">424</span> private void remoteCallCompleted(final MasterProcedureEnv env,<a name="line.424"></a> +<span class="sourceLineNo">425</span> final CloseRegionResponse response) {<a name="line.425"></a> +<span class="sourceLineNo">426</span> operation.setClosed(response.getClosed());<a name="line.426"></a> +<span class="sourceLineNo">427</span> operation.getRemoteProcedure().remoteCallCompleted(env, getServerName(), operation);<a name="line.427"></a> +<span class="sourceLineNo">428</span> }<a name="line.428"></a> +<span class="sourceLineNo">429</span><a name="line.429"></a> +<span class="sourceLineNo">430</span> private void remoteCallFailed(final MasterProcedureEnv env, final IOException e) {<a name="line.430"></a> +<span class="sourceLineNo">431</span> operation.getRemoteProcedure().remoteCallFailed(env, getServerName(), e);<a name="line.431"></a> +<span class="sourceLineNo">432</span> }<a name="line.432"></a> +<span class="sourceLineNo">433</span> }<a name="line.433"></a> +<span class="sourceLineNo">434</span><a name="line.434"></a> +<span class="sourceLineNo">435</span> protected class CompatRemoteProcedureResolver implements Callable<Void>, RemoteProcedureResolver {<a name="line.435"></a> +<span class="sourceLineNo">436</span> private final Set<RemoteProcedure> operations;<a name="line.436"></a> +<span class="sourceLineNo">437</span> private final ServerName serverName;<a name="line.437"></a> +<span class="sourceLineNo">438</span><a name="line.438"></a> +<span class="sourceLineNo">439</span> public CompatRemoteProcedureResolver(final ServerName serverName,<a name="line.439"></a> +<span class="sourceLineNo">440</span> final Set<RemoteProcedure> operations) {<a name="line.440"></a> +<span class="sourceLineNo">441</span> this.serverName = serverName;<a name="line.441"></a> +<span class="sourceLineNo">442</span> this.operations = operations;<a name="line.442"></a> +<span class="sourceLineNo">443</span> }<a name="line.443"></a> +<span class="sourceLineNo">444</span><a name="line.444"></a> +<span class="sourceLineNo">445</span> @Override<a name="line.445"></a> +<span class="sourceLineNo">446</span> public Void call() {<a name="line.446"></a> +<span class="sourceLineNo">447</span> splitAndResolveOperation(serverName, operations, this);<a name="line.447"></a> +<span class="sourceLineNo">448</span> return null;<a name="line.448"></a> +<span class="sourceLineNo">449</span> }<a name="line.449"></a> +<span class="sourceLineNo">450</span><a name="line.450"></a> +<span class="sourceLineNo">451</span> public void dispatchOpenRequests(final MasterProcedureEnv env,<a name="line.451"></a> +<span class="sourceLineNo">452</span> final List<RegionOpenOperation> operations) {<a name="line.452"></a> +<span class="sourceLineNo">453</span> submitTask(new OpenRegionRemoteCall(serverName, operations));<a name="line.453"></a> +<span class="sourceLineNo">454</span> }<a name="line.454"></a> +<span class="sourceLineNo">455</span><a name="line.455"></a> +<span class="sourceLineNo">456</span> public void dispatchCloseRequests(final MasterProcedureEnv env,<a name="line.456"></a> +<span class="sourceLineNo">457</span> final List<RegionCloseOperation> operations) {<a name="line.457"></a> +<span class="sourceLineNo">458</span> for (RegionCloseOperation op: operations) {<a name="line.458"></a> +<span class="sourceLineNo">459</span> submitTask(new CloseRegionRemoteCall(serverName, op));<a name="line.459"></a> +<span class="sourceLineNo">460</span> }<a name="line.460"></a> +<span class="sourceLineNo">461</span> }<a name="line.461"></a> +<span class="sourceLineNo">462</span> }<a name="line.462"></a> +<span class="sourceLineNo">463</span><a name="line.463"></a> +<span class="sourceLineNo">464</span> // ==========================================================================<a name="line.464"></a> +<span class="sourceLineNo">465</span> // RPC Messages<a name="line.465"></a> +<span class="sourceLineNo">466</span> // - ServerOperation: refreshConfig, grant, revoke, ...<a name="line.466"></a> +<span class="sourceLineNo">467</span> // - RegionOperation: open, close, flush, snapshot, ...<a name="line.467"></a> +<span class="sourceLineNo">468</span> // ==========================================================================<a name="line.468"></a> +<span class="sourceLineNo">469</span> public static abstract class ServerOperation extends RemoteOperation {<a name="line.469"></a> +<span class="sourceLineNo">470</span> protected ServerOperation(final RemoteProcedure remoteProcedure) {<a name="line.470"></a> +<span class="sourceLineNo">471</span> super(remoteProcedure);<a name="line.471"></a> +<span class="sourceLineNo">472</span> }<a name="line.472"></a> +<span class="sourceLineNo">473</span> }<a name="line.473"></a> <span class="sourceLineNo">474</span><a name="line.474"></a> -<span class="sourceLineNo">475</span> protected RegionOperation(final RemoteProcedure remoteProcedure,<a name="line.475"></a> -<span class="sourceLineNo">476</span> final HRegionInfo regionInfo) {<a name="line.476"></a> -<span class="sourceLineNo">477</span> super(remoteProcedure);<a name="line.477"></a> -<span class="sourceLineNo">478</span> this.regionInfo = regionInfo;<a name="line.478"></a> -<span class="sourceLineNo">479</span> }<a name="line.479"></a> -<span class="sourceLineNo">480</span><a name="line.480"></a> -<span class="sourceLineNo">481</span> public HRegionInfo getRegionInfo() {<a name="line.481"></a> -<span class="sourceLineNo">482</span> return this.regionInfo;<a name="line.482"></a> -<span class="sourceLineNo">483</span> }<a name="line.483"></a> -<span class="sourceLineNo">484</span> }<a name="line.484"></a> -<span class="sourceLineNo">485</span><a name="line.485"></a> -<span class="sourceLineNo">486</span> public static class RegionOpenOperation extends RegionOperation {<a name="line.486"></a> -<span class="sourceLineNo">487</span> private final List<ServerName> favoredNodes;<a name="line.487"></a> -<span class="sourceLineNo">488</span> private final boolean openForReplay;<a name="line.488"></a> -<span class="sourceLineNo">489</span> private boolean failedOpen;<a name="line.489"></a> -<span class="sourceLineNo">490</span><a name="line.490"></a> -<span class="sourceLineNo">491</span> public RegionOpenOperation(final RemoteProcedure remoteProcedure,<a name="line.491"></a> -<span class="sourceLineNo">492</span> final HRegionInfo regionInfo, final List<ServerName> favoredNodes,<a name="line.492"></a> -<span class="sourceLineNo">493</span> final boolean openForReplay) {<a name="line.493"></a> -<span class="sourceLineNo">494</span> super(remoteProcedure, regionInfo);<a name="line.494"></a> -<span class="sourceLineNo">495</span> this.favoredNodes = favoredNodes;<a name="line.495"></a> -<span class="sourceLineNo">496</span> this.openForReplay = openForReplay;<a name="line.496"></a> -<span class="sourceLineNo">497</span> }<a name="line.497"></a> -<span class="sourceLineNo">498</span><a name="line.498"></a> -<span class="sourceLineNo">499</span> protected void setFailedOpen(final boolean failedOpen) {<a name="line.499"></a> -<span class="sourceLineNo">500</span> this.failedOpen = failedOpen;<a name="line.500"></a> -<span class="sourceLineNo">501</span> }<a name="line.501"></a> -<span class="sourceLineNo">502</span><a name="line.502"></a> -<span class="sourceLineNo">503</span> public boolean isFailedOpen() {<a name="line.503"></a> -<span class="sourceLineNo">504</span> return failedOpen;<a name="line.504"></a> -<span class="sourceLineNo">505</span> }<a name="line.505"></a> -<span class="sourceLineNo">506</span><a name="line.506"></a> -<span class="sourceLineNo">507</span> public OpenRegionRequest.RegionOpenInfo buildRegionOpenInfoRequest(<a name="line.507"></a> -<span class="sourceLineNo">508</span> final MasterProcedureEnv env) {<a name="line.508"></a> -<span class="sourceLineNo">509</span> return RequestConverter.buildRegionOpenInfo(getRegionInfo(),<a name="line.509"></a> -<span class="sourceLineNo">510</span> env.getAssignmentManager().getFavoredNodes(getRegionInfo()), false);<a name="line.510"></a> -<span class="sourceLineNo">511</span> }<a name="line.511"></a> -<span class="sourceLineNo">512</span> }<a name="line.512"></a> -<span class="sourceLineNo">513</span><a name="line.513"></a> -<span class="sourceLineNo">514</span> public static class RegionCloseOperation extends RegionOperation {<a name="line.514"></a> -<span class="sourceLineNo">515</span> private final ServerName destinationServer;<a name="line.515"></a> -<span class="sourceLineNo">516</span> private boolean closed = false;<a name="line.516"></a> -<span class="sourceLineNo">517</span><a name="line.517"></a> -<span class="sourceLineNo">518</span> public RegionCloseOperation(final RemoteProcedure remoteProcedure,<a name="line.518"></a> -<span class="sourceLineNo">519</span> final HRegionInfo regionInfo, final ServerName destinationServer) {<a name="line.519"></a> -<span class="sourceLineNo">520</span> super(remoteProcedure, regionInfo);<a name="line.520"></a> -<span class="sourceLineNo">521</span> this.destinationServer = destinationServer;<a name="line.521"></a> -<span class="sourceLineNo">522</span> }<a name="line.522"></a> -<span class="sourceLineNo">523</span><a name="line.523"></a> -<span class="sourceLineNo">524</span> public ServerName getDestinationServer() {<a name="line.524"></a> -<span class="sourceLineNo">525</span> return destinationServer;<a name="line.525"></a> -<span class="sourceLineNo">526</span> }<a name="line.526"></a> -<span class="sourceLineNo">527</span><a name="line.527"></a> -<span class="sourceLineNo">528</span> protected void setClosed(final boolean closed) {<a name="line.528"></a> -<span class="sourceLineNo">529</span> this.closed = closed;<a name="line.529"></a> -<span class="sourceLineNo">530</span> }<a name="line.530"></a> -<span class="sourceLineNo">531</span><a name="line.531"></a> -<span class="sourceLineNo">532</span> public boolean isClosed() {<a name="line.532"></a> -<span class="sourceLineNo">533</span> return closed;<a name="line.533"></a> -<span class="sourceLineNo">534</span> }<a name="line.534"></a> -<span class="sourceLineNo">535</span><a name="line.535"></a> -<span class="sourceLineNo">536</span> public CloseRegionRequest buildCloseRegionRequest(final ServerName serverName) {<a name="line.536"></a> -<span class="sourceLineNo">537</span> return ProtobufUtil.buildCloseRegionRequest(serverName,<a name="line.537"></a> -<span class="sourceLineNo">538</span> getRegionInfo().getRegionName(), getDestinationServer());<a name="line.538"></a> -<span class="sourceLineNo">539</span> }<a name="line.539"></a> -<span class="sourceLineNo">540</span> }<a name="line.540"></a> -<span class="sourceLineNo">541</span>}<a name="line.541"></a> +<span class="sourceLineNo">475</span> public static abstract class RegionOperation extends RemoteOperation {<a name="line.475"></a> +<span class="sourceLineNo">476</span> private final HRegionInfo regionInfo;<a name="line.476"></a> +<span class="sourceLineNo">477</span><a name="line.477"></a> +<span class="sourceLineNo">478</span> protected RegionOperation(final RemoteProcedure remoteProcedure,<a name="line.478"></a> +<span class="sourceLineNo">479</span> final HRegionInfo regionInfo) {<a name="line.479"></a> +<span class="sourceLineNo">480</span> super(remoteProcedure);<a name="line.480"></a> +<span class="sourceLineNo">481</span> this.regionInfo = regionInfo;<a name="line.481"></a> +<span class="sourceLineNo">482</span> }<a name="line.482"></a> +<span class="sourceLineNo">483</span><a name="line.483"></a> +<span class="sourceLineNo">484</span> public HRegionInfo getRegionInfo() {<a name="line.484"></a> +<span class="sourceLineNo">485</span> return this.regionInfo;<a name="line.485"></a> +<span class="sourceLineNo">486</span> }<a name="line.486"></a> +<span class="sourceLineNo">487</span> }<a name="line.487"></a> +<span class="sourceLineNo">488</span><a name="line.488"></a> +<span class="sourceLineNo">489</span> public static class RegionOpenOperation extends RegionOperation {<a name="line.489"></a> +<span class="sourceLineNo">490</span> private final List<ServerName> favoredNodes;<a name="line.490"></a> +<span class="sourceLineNo">491</span> private final boolean openForReplay;<a name="line.491"></a> +<span class="sourceLineNo">492</span> private boolean failedOpen;<a name="line.492"></a> +<span class="sourceLineNo">493</span><a name="line.493"></a> +<span class="sourceLineNo">494</span> public RegionOpenOperation(final RemoteProcedure remoteProcedure,<a name="line.494"></a> +<span class="sourceLineNo">495</span> final HRegionInfo regionInfo, final List<ServerName> favoredNodes,<a name="line.495"></a> +<span class="sourceLineNo">496</span> final boolean openForReplay) {<a name="line.496"></a> +<span class="sourceLineNo">497</span> super(remoteProcedure, regionInfo);<a name="line.497"></a> +<span class="sourceLineNo">498</span> this.favoredNodes = favoredNodes;<a name="line.498"></a> +<span class="sourceLineNo">499</span> this.openForReplay = openForReplay;<a name="line.499"></a> +<span class="sourceLineNo">500</span> }<a name="line.500"></a> +<span class="sourceLineNo">501</span><a name="line.501"></a> +<span class="sourceLineNo">502</span> protected void setFailedOpen(final boolean failedOpen) {<a name="line.502"></a> +<span class="sourceLineNo">503</span> this.failedOpen = failedOpen;<a name="line.503"></a> +<span class="sourceLineNo">504</span> }<a name="line.504"></a> +<span class="sourceLineNo">505</span><a name="line.505"></a> +<span class="sourceLineNo">506</span> public boolean isFailedOpen() {<a name="line.506"></a> +<span class="sourceLineNo">507</span> return failedOpen;<a name="line.507"></a> +<span class="sourceLineNo">508</span> }<a name="line.508"></a> +<span class="sourceLineNo">509</span><a name="line.509"></a> +<span class="sourceLineNo">510</span> public OpenRegionRequest.RegionOpenInfo buildRegionOpenInfoRequest(<a name="line.510"></a> +<span class="sourceLineNo">511</span> final MasterProcedureEnv env) {<a name="line.511"></a> +<span class="sourceLineNo">512</span> return RequestConverter.buildRegionOpenInfo(getRegionInfo(),<a name="line.512"></a> +<span class="sourceLineNo">513</span> env.getAssignmentManager().getFavoredNodes(getRegionInfo()), false);<a name="line.513"></a> +<span class="sourceLineNo">514</span> }<a name="line.514"></a> +<span class="sourceLineNo">515</span> }<a name="line.515"></a> +<span class="sourceLineNo">516</span><a name="line.516"></a> +<span class="sourceLineNo">517</span> public static class RegionCloseOperation extends RegionOperation {<a name="line.517"></a> +<span class="sourceLineNo">518</span> private final ServerName destinationServer;<a name="line.518"></a> +<span class="sourceLineNo">519</span> private boolean closed = false;<a name="line.519"></a> +<span class="sourceLineNo">520</span><a name="line.520"></a> +<span class="sourceLineNo">521</span> public RegionCloseOperation(final RemoteProcedure remoteProcedure,<a name="line.521"></a> +<span class="sourceLineNo">522</span> final HRegionInfo regionInfo, final ServerName destinationServer) {<a name="line.522"></a> +<span class="sourceLineNo">523</span> super(remoteProcedure, regionInfo);<a name="line.523"></a> +<span class="sourceLineNo">524</span> this.destinationServer = destinationServer;<a name="line.524"></a> +<span class="sourceLineNo">525</span> }<a name="line.525"></a> +<span class="sourceLineNo">526</span><a name="line.526"></a> +<span class="sourceLineNo">527</span> public ServerName getDestinationServer() {<a name="line.527"></a> +<span class="sourceLineNo">528</span> return destinationServer;<a name="line.528"></a> +<span class="sourceLineNo">529</span> }<a name="line.529"></a> +<span class="sourceLineNo">530</span><a name="line.530"></a> +<span class="sourceLineNo">531</span> protected void setClosed(final boolean closed) {<a name="line.531"></a> +<span class="sourceLineNo">532</span> this.closed = closed;<a name="line.532"></a> +<span class="sourceLineNo">533</span> }<a name="line.533"></a> +<span class="sourceLineNo">534</span><a name="line.534"></a> +<span class="sourceLineNo">535</span> public boolean isClosed() {<a name="line.535"></a> +<span class="sourceLineNo">536</span> return closed;<a name="line.536"></a> +<span class="sourceLineNo">537</span> }<a name="line.537"></a> +<span class="sourceLineNo">538</span><a name="line.538"></a> +<span class="sourceLineNo">539</span> public CloseRegionRequest buildCloseRegionRequest(final ServerName serverName) {<a name="line.539"></a> +<span class="sourceLineNo">540</span> return ProtobufUtil.buildCloseRegionRequest(serverName,<a name="line.540"></a> +<span class="sourceLineNo">541</span> getRegionInfo().getRegionName(), getDestinationServer());<a name="line.541"></a> +<span class="sourceLineNo">542</span> }<a name="line.542"></a> +<span class="sourceLineNo">543</span> }<a name="line.543"></a> +<span class="sourceLineNo">544</span>}<a name="line.544"></a>
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/b9830530/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/RSRpcServices.RegionScannerCloseCallBack.html ---------------------------------------------------------------------- diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/RSRpcServices.RegionScannerCloseCallBack.html b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/RSRpcServices.RegionScannerCloseCallBack.html index 2f3c0cd..04ecf44 100644 --- a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/RSRpcServices.RegionScannerCloseCallBack.html +++ b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/RSRpcServices.RegionScannerCloseCallBack.html @@ -2816,7 +2816,7 @@ <span class="sourceLineNo">2808</span> // Yes, should be the same instance<a name="line.2808"></a> <span class="sourceLineNo">2809</span> if (regionServer.getOnlineRegion(hri.getRegionName()) != rsh.r) {<a name="line.2809"></a> <span class="sourceLineNo">2810</span> String msg = "Region has changed on the scanner " + scannerName + ": regionName="<a name="line.2810"></a> -<span class="sourceLineNo">2811</span> + hri.getRegionName() + ", scannerRegionName=" + rsh.r;<a name="line.2811"></a> +<span class="sourceLineNo">2811</span> + hri.getRegionNameAsString() + ", scannerRegionName=" + rsh.r;<a name="line.2811"></a> <span class="sourceLineNo">2812</span> LOG.warn(msg + ", closing...");<a name="line.2812"></a> <span class="sourceLineNo">2813</span> scanners.remove(scannerName);<a name="line.2813"></a> <span class="sourceLineNo">2814</span> try {<a name="line.2814"></a> http://git-wip-us.apache.org/repos/asf/hbase-site/blob/b9830530/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/RSRpcServices.RegionScannerHolder.html ---------------------------------------------------------------------- diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/RSRpcServices.RegionScannerHolder.html b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/RSRpcServices.RegionScannerHolder.html index 2f3c0cd..04ecf44 100644 --- a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/RSRpcServices.RegionScannerHolder.html +++ b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/RSRpcServices.RegionScannerHolder.html @@ -2816,7 +2816,7 @@ <span class="sourceLineNo">2808</span> // Yes, should be the same instance<a name="line.2808"></a> <span class="sourceLineNo">2809</span> if (regionServer.getOnlineRegion(hri.getRegionName()) != rsh.r) {<a name="line.2809"></a> <span class="sourceLineNo">2810</span> String msg = "Region has changed on the scanner " + scannerName + ": regionName="<a name="line.2810"></a> -<span class="sourceLineNo">2811</span> + hri.getRegionName() + ", scannerRegionName=" + rsh.r;<a name="line.2811"></a> +<span class="sourceLineNo">2811</span> + hri.getRegionNameAsString() + ", scannerRegionName=" + rsh.r;<a name="line.2811"></a> <span class="sourceLineNo">2812</span> LOG.warn(msg + ", closing...");<a name="line.2812"></a> <span class="sourceLineNo">2813</span> scanners.remove(scannerName);<a name="line.2813"></a> <span class="sourceLineNo">2814</span> try {<a name="line.2814"></a> http://git-wip-us.apache.org/repos/asf/hbase-site/blob/b9830530/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/RSRpcServices.RegionScannerShippedCallBack.html ---------------------------------------------------------------------- diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/RSRpcServices.RegionScannerShippedCallBack.html b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/RSRpcServices.RegionScannerShippedCallBack.html index 2f3c0cd..04ecf44 100644 --- a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/RSRpcServices.RegionScannerShippedCallBack.html +++ b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/RSRpcServices.RegionScannerShippedCallBack.html @@ -2816,7 +2816,7 @@ <span class="sourceLineNo">2808</span> // Yes, should be the same instance<a name="line.2808"></a> <span class="sourceLineNo">2809</span> if (regionServer.getOnlineRegion(hri.getRegionName()) != rsh.r) {<a name="line.2809"></a> <span class="sourceLineNo">2810</span> String msg = "Region has changed on the scanner " + scannerName + ": regionName="<a name="line.2810"></a> -<span class="sourceLineNo">2811</span> + hri.getRegionName() + ", scannerRegionName=" + rsh.r;<a name="line.2811"></a> +<span class="sourceLineNo">2811</span> + hri.getRegionNameAsString() + ", scannerRegionName=" + rsh.r;<a name="line.2811"></a> <span class="sourceLineNo">2812</span> LOG.warn(msg + ", closing...");<a name="line.2812"></a> <span class="sourceLineNo">2813</span> scanners.remove(scannerName);<a name="line.2813"></a> <span class="sourceLineNo">2814</span> try {<a name="line.2814"></a> http://git-wip-us.apache.org/repos/asf/hbase-site/blob/b9830530/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 2f3c0cd..04ecf44 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 @@ -2816,7 +2816,7 @@ <span class="sourceLineNo">2808</span> // Yes, should be the same instance<a name="line.2808"></a> <span class="sourceLineNo">2809</span> if (regionServer.getOnlineRegion(hri.getRegionName()) != rsh.r) {<a name="line.2809"></a> <span class="sourceLineNo">2810</span> String msg = "Region has changed on the scanner " + scannerName + ": regionName="<a name="line.2810"></a> -<span class="sourceLineNo">2811</span> + hri.getRegionName() + ", scannerRegionName=" + rsh.r;<a name="line.2811"></a> +<span class="sourceLineNo">2811</span> + hri.getRegionNameAsString() + ", scannerRegionName=" + rsh.r;<a name="line.2811"></a> <span class="sourceLineNo">2812</span> LOG.warn(msg + ", closing...");<a name="line.2812"></a> <span class="sourceLineNo">2813</span> scanners.remove(scannerName);<a name="line.2813"></a> <span class="sourceLineNo">2814</span> try {<a name="line.2814"></a> http://git-wip-us.apache.org/repos/asf/hbase-site/blob/b9830530/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/RSRpcServices.ScannerListener.html ---------------------------------------------------------------------- diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/RSRpcServices.ScannerListener.html b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/RSRpcServices.ScannerListener.html index 2f3c0cd..04ecf44 100644 --- a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/RSRpcServices.ScannerListener.html +++ b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/RSRpcServices.ScannerListener.html @@ -2816,7 +2816,7 @@ <span class="sourceLineNo">2808</span> // Yes, should be the same instance<a name="line.2808"></a> <span class="sourceLineNo">2809</span> if (regionServer.getOnlineRegion(hri.getRegionName()) != rsh.r) {<a name="line.2809"></a> <span class="sourceLineNo">2810</span> String msg = "Region has changed on the scanner " + scannerName + ": regionName="<a name="line.2810"></a> -<span class="sourceLineNo">2811</span> + hri.getRegionName() + ", scannerRegionName=" + rsh.r;<a name="line.2811"></a> +<span class="sourceLineNo">2811</span> + hri.getRegionNameAsString() + ", scannerRegionName=" + rsh.r;<a name="line.2811"></a> <span class="sourceLineNo">2812</span> LOG.warn(msg + ", closing...");<a name="line.2812"></a> <span class="sourceLineNo">2813</span> scanners.remove(scannerName);<a name="line.2813"></a> <span class="sourceLineNo">2814</span> try {<a name="line.2814"></a> http://git-wip-us.apache.org/repos/asf/hbase-site/blob/b9830530/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/RSRpcServices.html ---------------------------------------------------------------------- diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/RSRpcServices.html b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/RSRpcServices.html index 2f3c0cd..04ecf44 100644 --- a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/RSRpcServices.html +++ b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/RSRpcServices.html @@ -2816,7 +2816,7 @@ <span class="sourceLineNo">2808</span> // Yes, should be the same instance<a name="line.2808"></a> <span class="sourceLineNo">2809</span> if (regionServer.getOnlineRegion(hri.getRegionName()) != rsh.r) {<a name="line.2809"></a> <span class="sourceLineNo">2810</span> String msg = "Region has changed on the scanner " + scannerName + ": regionName="<a name="line.2810"></a> -<span class="sourceLineNo">2811</span> + hri.getRegionName() + ", scannerRegionName=" + rsh.r;<a name="line.2811"></a> +<span class="sourceLineNo">2811</span> + hri.getRegionNameAsString() + ", scannerRegionName=" + rsh.r;<a name="line.2811"></a> <span class="sourceLineNo">2812</span> LOG.warn(msg + ", closing...");<a name="line.2812"></a> <span class="sourceLineNo">2813</span> scanners.remove(scannerName);<a name="line.2813"></a> <span class="sourceLineNo">2814</span> try {<a name="line.2814"></a>