hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From git-site-r...@apache.org
Subject [28/51] [partial] hbase-site git commit: Published site at .
Date Fri, 10 Nov 2017 15:30:15 GMT
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/a108018f/devapidocs/src-html/org/apache/hadoop/hbase/master/assignment/AssignmentManager.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/master/assignment/AssignmentManager.html b/devapidocs/src-html/org/apache/hadoop/hbase/master/assignment/AssignmentManager.html
index f0775d0..40cd159 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/master/assignment/AssignmentManager.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/master/assignment/AssignmentManager.html
@@ -943,7 +943,7 @@
 <span class="sourceLineNo">935</span>    wakeServerReportEvent(serverNode);<a name="line.935"></a>
 <span class="sourceLineNo">936</span>  }<a name="line.936"></a>
 <span class="sourceLineNo">937</span><a name="line.937"></a>
-<span class="sourceLineNo">938</span>  public void checkOnlineRegionsReportForMeta(final ServerStateNode serverNode,<a name="line.938"></a>
+<span class="sourceLineNo">938</span>  void checkOnlineRegionsReportForMeta(final ServerStateNode serverNode,<a name="line.938"></a>
 <span class="sourceLineNo">939</span>      final Set&lt;byte[]&gt; regionNames) {<a name="line.939"></a>
 <span class="sourceLineNo">940</span>    try {<a name="line.940"></a>
 <span class="sourceLineNo">941</span>      for (byte[] regionName: regionNames) {<a name="line.941"></a>
@@ -959,7 +959,7 @@
 <span class="sourceLineNo">951</span>        final RegionStateNode regionNode = regionStates.getOrCreateRegionNode(hri);<a name="line.951"></a>
 <span class="sourceLineNo">952</span>        LOG.info("META REPORTED: " + regionNode);<a name="line.952"></a>
 <span class="sourceLineNo">953</span>        if (!reportTransition(regionNode, serverNode, TransitionCode.OPENED, 0)) {<a name="line.953"></a>
-<span class="sourceLineNo">954</span>          LOG.warn("META REPORTED but no procedure found");<a name="line.954"></a>
+<span class="sourceLineNo">954</span>          LOG.warn("META REPORTED but no procedure found (complete?)");<a name="line.954"></a>
 <span class="sourceLineNo">955</span>          regionNode.setRegionLocation(serverNode.getServerName());<a name="line.955"></a>
 <span class="sourceLineNo">956</span>        } else if (LOG.isTraceEnabled()) {<a name="line.956"></a>
 <span class="sourceLineNo">957</span>          LOG.trace("META REPORTED: " + regionNode);<a name="line.957"></a>
@@ -1191,671 +1191,685 @@
 <span class="sourceLineNo">1183</span>      public void visitRegionState(final RegionInfo regionInfo, final State state,<a name="line.1183"></a>
 <span class="sourceLineNo">1184</span>          final ServerName regionLocation, final ServerName lastHost, final long openSeqNum) {<a name="line.1184"></a>
 <span class="sourceLineNo">1185</span>        final RegionStateNode regionNode = regionStates.getOrCreateRegionNode(regionInfo);<a name="line.1185"></a>
-<span class="sourceLineNo">1186</span>        synchronized (regionNode) {<a name="line.1186"></a>
-<span class="sourceLineNo">1187</span>          if (!regionNode.isInTransition()) {<a name="line.1187"></a>
-<span class="sourceLineNo">1188</span>            regionNode.setState(state);<a name="line.1188"></a>
-<span class="sourceLineNo">1189</span>            regionNode.setLastHost(lastHost);<a name="line.1189"></a>
-<span class="sourceLineNo">1190</span>            regionNode.setRegionLocation(regionLocation);<a name="line.1190"></a>
-<span class="sourceLineNo">1191</span>            regionNode.setOpenSeqNum(openSeqNum);<a name="line.1191"></a>
-<span class="sourceLineNo">1192</span><a name="line.1192"></a>
-<span class="sourceLineNo">1193</span>            if (state == State.OPEN) {<a name="line.1193"></a>
-<span class="sourceLineNo">1194</span>              assert regionLocation != null : "found null region location for " + regionNode;<a name="line.1194"></a>
-<span class="sourceLineNo">1195</span>              regionStates.addRegionToServer(regionLocation, regionNode);<a name="line.1195"></a>
-<span class="sourceLineNo">1196</span>            } else if (state == State.OFFLINE || regionInfo.isOffline()) {<a name="line.1196"></a>
-<span class="sourceLineNo">1197</span>              regionStates.addToOfflineRegions(regionNode);<a name="line.1197"></a>
-<span class="sourceLineNo">1198</span>            } else {<a name="line.1198"></a>
-<span class="sourceLineNo">1199</span>              // These regions should have a procedure in replay<a name="line.1199"></a>
-<span class="sourceLineNo">1200</span>              regionStates.addRegionInTransition(regionNode, null);<a name="line.1200"></a>
-<span class="sourceLineNo">1201</span>            }<a name="line.1201"></a>
-<span class="sourceLineNo">1202</span>          }<a name="line.1202"></a>
-<span class="sourceLineNo">1203</span>        }<a name="line.1203"></a>
-<span class="sourceLineNo">1204</span>      }<a name="line.1204"></a>
-<span class="sourceLineNo">1205</span>    });<a name="line.1205"></a>
-<span class="sourceLineNo">1206</span><a name="line.1206"></a>
-<span class="sourceLineNo">1207</span>    // every assignment is blocked until meta is loaded.<a name="line.1207"></a>
-<span class="sourceLineNo">1208</span>    wakeMetaLoadedEvent();<a name="line.1208"></a>
-<span class="sourceLineNo">1209</span>  }<a name="line.1209"></a>
-<span class="sourceLineNo">1210</span><a name="line.1210"></a>
-<span class="sourceLineNo">1211</span>  // TODO: the assumption here is that if RSs are crashing while we are executing this<a name="line.1211"></a>
-<span class="sourceLineNo">1212</span>  // they will be handled by the SSH that are put in the ServerManager "queue".<a name="line.1212"></a>
-<span class="sourceLineNo">1213</span>  // we can integrate this a bit better.<a name="line.1213"></a>
-<span class="sourceLineNo">1214</span>  private boolean processofflineServersWithOnlineRegions() {<a name="line.1214"></a>
-<span class="sourceLineNo">1215</span>    boolean failover = !master.getServerManager().getDeadServers().isEmpty();<a name="line.1215"></a>
-<span class="sourceLineNo">1216</span><a name="line.1216"></a>
-<span class="sourceLineNo">1217</span>    final Set&lt;ServerName&gt; offlineServersWithOnlineRegions = new HashSet&lt;ServerName&gt;();<a name="line.1217"></a>
-<span class="sourceLineNo">1218</span>    final ArrayList&lt;RegionInfo&gt; regionsToAssign = new ArrayList&lt;RegionInfo&gt;();<a name="line.1218"></a>
-<span class="sourceLineNo">1219</span>    long st, et;<a name="line.1219"></a>
-<span class="sourceLineNo">1220</span><a name="line.1220"></a>
-<span class="sourceLineNo">1221</span>    st = System.currentTimeMillis();<a name="line.1221"></a>
-<span class="sourceLineNo">1222</span>    for (RegionStateNode regionNode: regionStates.getRegionNodes()) {<a name="line.1222"></a>
-<span class="sourceLineNo">1223</span>      if (regionNode.getState() == State.OPEN) {<a name="line.1223"></a>
-<span class="sourceLineNo">1224</span>        final ServerName serverName = regionNode.getRegionLocation();<a name="line.1224"></a>
-<span class="sourceLineNo">1225</span>        if (!master.getServerManager().isServerOnline(serverName)) {<a name="line.1225"></a>
-<span class="sourceLineNo">1226</span>          offlineServersWithOnlineRegions.add(serverName);<a name="line.1226"></a>
-<span class="sourceLineNo">1227</span>        }<a name="line.1227"></a>
-<span class="sourceLineNo">1228</span>      } else if (regionNode.getState() == State.OFFLINE) {<a name="line.1228"></a>
-<span class="sourceLineNo">1229</span>        if (isTableEnabled(regionNode.getTable())) {<a name="line.1229"></a>
-<span class="sourceLineNo">1230</span>          regionsToAssign.add(regionNode.getRegionInfo());<a name="line.1230"></a>
-<span class="sourceLineNo">1231</span>        }<a name="line.1231"></a>
-<span class="sourceLineNo">1232</span>      }<a name="line.1232"></a>
-<span class="sourceLineNo">1233</span>    }<a name="line.1233"></a>
-<span class="sourceLineNo">1234</span>    et = System.currentTimeMillis();<a name="line.1234"></a>
-<span class="sourceLineNo">1235</span>    LOG.info("[STEP-1] " + StringUtils.humanTimeDiff(et - st));<a name="line.1235"></a>
-<span class="sourceLineNo">1236</span><a name="line.1236"></a>
-<span class="sourceLineNo">1237</span>    // kill servers with online regions<a name="line.1237"></a>
-<span class="sourceLineNo">1238</span>    st = System.currentTimeMillis();<a name="line.1238"></a>
-<span class="sourceLineNo">1239</span>    for (ServerName serverName: offlineServersWithOnlineRegions) {<a name="line.1239"></a>
-<span class="sourceLineNo">1240</span>      if (!master.getServerManager().isServerOnline(serverName)) {<a name="line.1240"></a>
-<span class="sourceLineNo">1241</span>        LOG.info("KILL RS hosting regions but not online " + serverName +<a name="line.1241"></a>
-<span class="sourceLineNo">1242</span>          " (master=" + master.getServerName() + ")");<a name="line.1242"></a>
-<span class="sourceLineNo">1243</span>        killRegionServer(serverName);<a name="line.1243"></a>
-<span class="sourceLineNo">1244</span>      }<a name="line.1244"></a>
-<span class="sourceLineNo">1245</span>    }<a name="line.1245"></a>
-<span class="sourceLineNo">1246</span>    et = System.currentTimeMillis();<a name="line.1246"></a>
-<span class="sourceLineNo">1247</span>    LOG.info("[STEP-2] " + StringUtils.humanTimeDiff(et - st));<a name="line.1247"></a>
-<span class="sourceLineNo">1248</span><a name="line.1248"></a>
-<span class="sourceLineNo">1249</span>    setFailoverCleanupDone(true);<a name="line.1249"></a>
-<span class="sourceLineNo">1250</span><a name="line.1250"></a>
-<span class="sourceLineNo">1251</span>    // assign offline regions<a name="line.1251"></a>
-<span class="sourceLineNo">1252</span>    st = System.currentTimeMillis();<a name="line.1252"></a>
-<span class="sourceLineNo">1253</span>    for (RegionInfo regionInfo: getOrderedRegions(regionsToAssign)) {<a name="line.1253"></a>
-<span class="sourceLineNo">1254</span>      master.getMasterProcedureExecutor().submitProcedure(<a name="line.1254"></a>
-<span class="sourceLineNo">1255</span>        createAssignProcedure(regionInfo, false));<a name="line.1255"></a>
-<span class="sourceLineNo">1256</span>    }<a name="line.1256"></a>
-<span class="sourceLineNo">1257</span>    et = System.currentTimeMillis();<a name="line.1257"></a>
-<span class="sourceLineNo">1258</span>    LOG.info("[STEP-3] " + StringUtils.humanTimeDiff(et - st));<a name="line.1258"></a>
+<span class="sourceLineNo">1186</span>        State localState = state;<a name="line.1186"></a>
+<span class="sourceLineNo">1187</span>        if (localState == null) {<a name="line.1187"></a>
+<span class="sourceLineNo">1188</span>          // No region state column data in hbase:meta table! Are I doing a rolling upgrade from<a name="line.1188"></a>
+<span class="sourceLineNo">1189</span>          // hbase1 to hbase2? Am I restoring a SNAPSHOT or otherwise adding a region to hbase:meta?<a name="line.1189"></a>
+<span class="sourceLineNo">1190</span>          // In any of these cases, state is empty. For now, presume OFFLINE but there are probably<a name="line.1190"></a>
+<span class="sourceLineNo">1191</span>          // cases where we need to probe more to be sure this correct; TODO informed by experience.<a name="line.1191"></a>
+<span class="sourceLineNo">1192</span>          LOG.info(regionInfo.getEncodedName() + " state=null; presuming " + State.OFFLINE);<a name="line.1192"></a>
+<span class="sourceLineNo">1193</span>          localState = State.OFFLINE;<a name="line.1193"></a>
+<span class="sourceLineNo">1194</span>        }<a name="line.1194"></a>
+<span class="sourceLineNo">1195</span>        synchronized (regionNode) {<a name="line.1195"></a>
+<span class="sourceLineNo">1196</span>          if (!regionNode.isInTransition()) {<a name="line.1196"></a>
+<span class="sourceLineNo">1197</span>            regionNode.setState(localState);<a name="line.1197"></a>
+<span class="sourceLineNo">1198</span>            regionNode.setLastHost(lastHost);<a name="line.1198"></a>
+<span class="sourceLineNo">1199</span>            regionNode.setRegionLocation(regionLocation);<a name="line.1199"></a>
+<span class="sourceLineNo">1200</span>            regionNode.setOpenSeqNum(openSeqNum);<a name="line.1200"></a>
+<span class="sourceLineNo">1201</span><a name="line.1201"></a>
+<span class="sourceLineNo">1202</span>            if (localState == State.OPEN) {<a name="line.1202"></a>
+<span class="sourceLineNo">1203</span>              assert regionLocation != null : "found null region location for " + regionNode;<a name="line.1203"></a>
+<span class="sourceLineNo">1204</span>              regionStates.addRegionToServer(regionLocation, regionNode);<a name="line.1204"></a>
+<span class="sourceLineNo">1205</span>            } else if (localState == State.OFFLINE || regionInfo.isOffline()) {<a name="line.1205"></a>
+<span class="sourceLineNo">1206</span>              regionStates.addToOfflineRegions(regionNode);<a name="line.1206"></a>
+<span class="sourceLineNo">1207</span>            } else {<a name="line.1207"></a>
+<span class="sourceLineNo">1208</span>              // These regions should have a procedure in replay<a name="line.1208"></a>
+<span class="sourceLineNo">1209</span>              regionStates.addRegionInTransition(regionNode, null);<a name="line.1209"></a>
+<span class="sourceLineNo">1210</span>            }<a name="line.1210"></a>
+<span class="sourceLineNo">1211</span>          }<a name="line.1211"></a>
+<span class="sourceLineNo">1212</span>        }<a name="line.1212"></a>
+<span class="sourceLineNo">1213</span>      }<a name="line.1213"></a>
+<span class="sourceLineNo">1214</span>    });<a name="line.1214"></a>
+<span class="sourceLineNo">1215</span><a name="line.1215"></a>
+<span class="sourceLineNo">1216</span>    // every assignment is blocked until meta is loaded.<a name="line.1216"></a>
+<span class="sourceLineNo">1217</span>    wakeMetaLoadedEvent();<a name="line.1217"></a>
+<span class="sourceLineNo">1218</span>  }<a name="line.1218"></a>
+<span class="sourceLineNo">1219</span><a name="line.1219"></a>
+<span class="sourceLineNo">1220</span>  // TODO: the assumption here is that if RSs are crashing while we are executing this<a name="line.1220"></a>
+<span class="sourceLineNo">1221</span>  // they will be handled by the SSH that are put in the ServerManager "queue".<a name="line.1221"></a>
+<span class="sourceLineNo">1222</span>  // we can integrate this a bit better.<a name="line.1222"></a>
+<span class="sourceLineNo">1223</span>  private boolean processofflineServersWithOnlineRegions() {<a name="line.1223"></a>
+<span class="sourceLineNo">1224</span>    boolean failover = !master.getServerManager().getDeadServers().isEmpty();<a name="line.1224"></a>
+<span class="sourceLineNo">1225</span><a name="line.1225"></a>
+<span class="sourceLineNo">1226</span>    final Set&lt;ServerName&gt; offlineServersWithOnlineRegions = new HashSet&lt;ServerName&gt;();<a name="line.1226"></a>
+<span class="sourceLineNo">1227</span>    final ArrayList&lt;RegionInfo&gt; regionsToAssign = new ArrayList&lt;RegionInfo&gt;();<a name="line.1227"></a>
+<span class="sourceLineNo">1228</span>    long st, et;<a name="line.1228"></a>
+<span class="sourceLineNo">1229</span><a name="line.1229"></a>
+<span class="sourceLineNo">1230</span>    st = System.currentTimeMillis();<a name="line.1230"></a>
+<span class="sourceLineNo">1231</span>    for (RegionStateNode regionNode: regionStates.getRegionNodes()) {<a name="line.1231"></a>
+<span class="sourceLineNo">1232</span>      if (regionNode.getState() == State.OPEN) {<a name="line.1232"></a>
+<span class="sourceLineNo">1233</span>        final ServerName serverName = regionNode.getRegionLocation();<a name="line.1233"></a>
+<span class="sourceLineNo">1234</span>        if (!master.getServerManager().isServerOnline(serverName)) {<a name="line.1234"></a>
+<span class="sourceLineNo">1235</span>          offlineServersWithOnlineRegions.add(serverName);<a name="line.1235"></a>
+<span class="sourceLineNo">1236</span>        }<a name="line.1236"></a>
+<span class="sourceLineNo">1237</span>      } else if (regionNode.getState() == State.OFFLINE) {<a name="line.1237"></a>
+<span class="sourceLineNo">1238</span>        if (isTableEnabled(regionNode.getTable())) {<a name="line.1238"></a>
+<span class="sourceLineNo">1239</span>          regionsToAssign.add(regionNode.getRegionInfo());<a name="line.1239"></a>
+<span class="sourceLineNo">1240</span>        }<a name="line.1240"></a>
+<span class="sourceLineNo">1241</span>      }<a name="line.1241"></a>
+<span class="sourceLineNo">1242</span>    }<a name="line.1242"></a>
+<span class="sourceLineNo">1243</span>    et = System.currentTimeMillis();<a name="line.1243"></a>
+<span class="sourceLineNo">1244</span>    LOG.info("[STEP-1] " + StringUtils.humanTimeDiff(et - st));<a name="line.1244"></a>
+<span class="sourceLineNo">1245</span><a name="line.1245"></a>
+<span class="sourceLineNo">1246</span>    // kill servers with online regions<a name="line.1246"></a>
+<span class="sourceLineNo">1247</span>    st = System.currentTimeMillis();<a name="line.1247"></a>
+<span class="sourceLineNo">1248</span>    for (ServerName serverName: offlineServersWithOnlineRegions) {<a name="line.1248"></a>
+<span class="sourceLineNo">1249</span>      if (!master.getServerManager().isServerOnline(serverName)) {<a name="line.1249"></a>
+<span class="sourceLineNo">1250</span>        LOG.info("KILL RS hosting regions but not online " + serverName +<a name="line.1250"></a>
+<span class="sourceLineNo">1251</span>          " (master=" + master.getServerName() + ")");<a name="line.1251"></a>
+<span class="sourceLineNo">1252</span>        killRegionServer(serverName);<a name="line.1252"></a>
+<span class="sourceLineNo">1253</span>      }<a name="line.1253"></a>
+<span class="sourceLineNo">1254</span>    }<a name="line.1254"></a>
+<span class="sourceLineNo">1255</span>    et = System.currentTimeMillis();<a name="line.1255"></a>
+<span class="sourceLineNo">1256</span>    LOG.info("[STEP-2] " + StringUtils.humanTimeDiff(et - st));<a name="line.1256"></a>
+<span class="sourceLineNo">1257</span><a name="line.1257"></a>
+<span class="sourceLineNo">1258</span>    setFailoverCleanupDone(true);<a name="line.1258"></a>
 <span class="sourceLineNo">1259</span><a name="line.1259"></a>
-<span class="sourceLineNo">1260</span>    return failover;<a name="line.1260"></a>
-<span class="sourceLineNo">1261</span>  }<a name="line.1261"></a>
-<span class="sourceLineNo">1262</span><a name="line.1262"></a>
-<span class="sourceLineNo">1263</span>  /**<a name="line.1263"></a>
-<span class="sourceLineNo">1264</span>   * Used by ServerCrashProcedure to make sure AssignmentManager has completed<a name="line.1264"></a>
-<span class="sourceLineNo">1265</span>   * the failover cleanup before re-assigning regions of dead servers. So that<a name="line.1265"></a>
-<span class="sourceLineNo">1266</span>   * when re-assignment happens, AssignmentManager has proper region states.<a name="line.1266"></a>
-<span class="sourceLineNo">1267</span>   */<a name="line.1267"></a>
-<span class="sourceLineNo">1268</span>  public boolean isFailoverCleanupDone() {<a name="line.1268"></a>
-<span class="sourceLineNo">1269</span>    return failoverCleanupDone.isReady();<a name="line.1269"></a>
+<span class="sourceLineNo">1260</span>    // assign offline regions<a name="line.1260"></a>
+<span class="sourceLineNo">1261</span>    st = System.currentTimeMillis();<a name="line.1261"></a>
+<span class="sourceLineNo">1262</span>    for (RegionInfo regionInfo: getOrderedRegions(regionsToAssign)) {<a name="line.1262"></a>
+<span class="sourceLineNo">1263</span>      master.getMasterProcedureExecutor().submitProcedure(<a name="line.1263"></a>
+<span class="sourceLineNo">1264</span>        createAssignProcedure(regionInfo, false));<a name="line.1264"></a>
+<span class="sourceLineNo">1265</span>    }<a name="line.1265"></a>
+<span class="sourceLineNo">1266</span>    et = System.currentTimeMillis();<a name="line.1266"></a>
+<span class="sourceLineNo">1267</span>    LOG.info("[STEP-3] " + StringUtils.humanTimeDiff(et - st));<a name="line.1267"></a>
+<span class="sourceLineNo">1268</span><a name="line.1268"></a>
+<span class="sourceLineNo">1269</span>    return failover;<a name="line.1269"></a>
 <span class="sourceLineNo">1270</span>  }<a name="line.1270"></a>
 <span class="sourceLineNo">1271</span><a name="line.1271"></a>
 <span class="sourceLineNo">1272</span>  /**<a name="line.1272"></a>
-<span class="sourceLineNo">1273</span>   * Used by ServerCrashProcedure tests verify the ability to suspend the<a name="line.1273"></a>
-<span class="sourceLineNo">1274</span>   * execution of the ServerCrashProcedure.<a name="line.1274"></a>
-<span class="sourceLineNo">1275</span>   */<a name="line.1275"></a>
-<span class="sourceLineNo">1276</span>  @VisibleForTesting<a name="line.1276"></a>
-<span class="sourceLineNo">1277</span>  public void setFailoverCleanupDone(final boolean b) {<a name="line.1277"></a>
-<span class="sourceLineNo">1278</span>    master.getMasterProcedureExecutor().getEnvironment()<a name="line.1278"></a>
-<span class="sourceLineNo">1279</span>      .setEventReady(failoverCleanupDone, b);<a name="line.1279"></a>
-<span class="sourceLineNo">1280</span>  }<a name="line.1280"></a>
-<span class="sourceLineNo">1281</span><a name="line.1281"></a>
-<span class="sourceLineNo">1282</span>  public ProcedureEvent getFailoverCleanupEvent() {<a name="line.1282"></a>
-<span class="sourceLineNo">1283</span>    return failoverCleanupDone;<a name="line.1283"></a>
-<span class="sourceLineNo">1284</span>  }<a name="line.1284"></a>
-<span class="sourceLineNo">1285</span><a name="line.1285"></a>
-<span class="sourceLineNo">1286</span>  /**<a name="line.1286"></a>
-<span class="sourceLineNo">1287</span>   * Used to check if the failover cleanup is done.<a name="line.1287"></a>
-<span class="sourceLineNo">1288</span>   * if not we throw PleaseHoldException since we are rebuilding the RegionStates<a name="line.1288"></a>
-<span class="sourceLineNo">1289</span>   * @param hri region to check if it is already rebuild<a name="line.1289"></a>
-<span class="sourceLineNo">1290</span>   * @throws PleaseHoldException if the failover cleanup is not completed<a name="line.1290"></a>
-<span class="sourceLineNo">1291</span>   */<a name="line.1291"></a>
-<span class="sourceLineNo">1292</span>  private void checkFailoverCleanupCompleted(final RegionInfo hri) throws PleaseHoldException {<a name="line.1292"></a>
-<span class="sourceLineNo">1293</span>    if (!isRunning()) {<a name="line.1293"></a>
-<span class="sourceLineNo">1294</span>      throw new PleaseHoldException("AssignmentManager not running");<a name="line.1294"></a>
-<span class="sourceLineNo">1295</span>    }<a name="line.1295"></a>
-<span class="sourceLineNo">1296</span><a name="line.1296"></a>
-<span class="sourceLineNo">1297</span>    // TODO: can we avoid throwing an exception if hri is already loaded?<a name="line.1297"></a>
-<span class="sourceLineNo">1298</span>    //       at the moment we bypass only meta<a name="line.1298"></a>
-<span class="sourceLineNo">1299</span>    boolean meta = isMetaRegion(hri);<a name="line.1299"></a>
-<span class="sourceLineNo">1300</span>    boolean cleanup = isFailoverCleanupDone();<a name="line.1300"></a>
-<span class="sourceLineNo">1301</span>    if (!isMetaRegion(hri) &amp;&amp; !isFailoverCleanupDone()) {<a name="line.1301"></a>
-<span class="sourceLineNo">1302</span>      String msg = "Master not fully online; hbase:meta=" + meta + ", failoverCleanup=" + cleanup;<a name="line.1302"></a>
-<span class="sourceLineNo">1303</span>      throw new PleaseHoldException(msg);<a name="line.1303"></a>
+<span class="sourceLineNo">1273</span>   * Used by ServerCrashProcedure to make sure AssignmentManager has completed<a name="line.1273"></a>
+<span class="sourceLineNo">1274</span>   * the failover cleanup before re-assigning regions of dead servers. So that<a name="line.1274"></a>
+<span class="sourceLineNo">1275</span>   * when re-assignment happens, AssignmentManager has proper region states.<a name="line.1275"></a>
+<span class="sourceLineNo">1276</span>   */<a name="line.1276"></a>
+<span class="sourceLineNo">1277</span>  public boolean isFailoverCleanupDone() {<a name="line.1277"></a>
+<span class="sourceLineNo">1278</span>    return failoverCleanupDone.isReady();<a name="line.1278"></a>
+<span class="sourceLineNo">1279</span>  }<a name="line.1279"></a>
+<span class="sourceLineNo">1280</span><a name="line.1280"></a>
+<span class="sourceLineNo">1281</span>  /**<a name="line.1281"></a>
+<span class="sourceLineNo">1282</span>   * Used by ServerCrashProcedure tests verify the ability to suspend the<a name="line.1282"></a>
+<span class="sourceLineNo">1283</span>   * execution of the ServerCrashProcedure.<a name="line.1283"></a>
+<span class="sourceLineNo">1284</span>   */<a name="line.1284"></a>
+<span class="sourceLineNo">1285</span>  @VisibleForTesting<a name="line.1285"></a>
+<span class="sourceLineNo">1286</span>  public void setFailoverCleanupDone(final boolean b) {<a name="line.1286"></a>
+<span class="sourceLineNo">1287</span>    master.getMasterProcedureExecutor().getEnvironment()<a name="line.1287"></a>
+<span class="sourceLineNo">1288</span>      .setEventReady(failoverCleanupDone, b);<a name="line.1288"></a>
+<span class="sourceLineNo">1289</span>  }<a name="line.1289"></a>
+<span class="sourceLineNo">1290</span><a name="line.1290"></a>
+<span class="sourceLineNo">1291</span>  public ProcedureEvent getFailoverCleanupEvent() {<a name="line.1291"></a>
+<span class="sourceLineNo">1292</span>    return failoverCleanupDone;<a name="line.1292"></a>
+<span class="sourceLineNo">1293</span>  }<a name="line.1293"></a>
+<span class="sourceLineNo">1294</span><a name="line.1294"></a>
+<span class="sourceLineNo">1295</span>  /**<a name="line.1295"></a>
+<span class="sourceLineNo">1296</span>   * Used to check if the failover cleanup is done.<a name="line.1296"></a>
+<span class="sourceLineNo">1297</span>   * if not we throw PleaseHoldException since we are rebuilding the RegionStates<a name="line.1297"></a>
+<span class="sourceLineNo">1298</span>   * @param hri region to check if it is already rebuild<a name="line.1298"></a>
+<span class="sourceLineNo">1299</span>   * @throws PleaseHoldException if the failover cleanup is not completed<a name="line.1299"></a>
+<span class="sourceLineNo">1300</span>   */<a name="line.1300"></a>
+<span class="sourceLineNo">1301</span>  private void checkFailoverCleanupCompleted(final RegionInfo hri) throws PleaseHoldException {<a name="line.1301"></a>
+<span class="sourceLineNo">1302</span>    if (!isRunning()) {<a name="line.1302"></a>
+<span class="sourceLineNo">1303</span>      throw new PleaseHoldException("AssignmentManager not running");<a name="line.1303"></a>
 <span class="sourceLineNo">1304</span>    }<a name="line.1304"></a>
-<span class="sourceLineNo">1305</span>  }<a name="line.1305"></a>
-<span class="sourceLineNo">1306</span><a name="line.1306"></a>
-<span class="sourceLineNo">1307</span>  // ============================================================================================<a name="line.1307"></a>
-<span class="sourceLineNo">1308</span>  //  TODO: Metrics<a name="line.1308"></a>
-<span class="sourceLineNo">1309</span>  // ============================================================================================<a name="line.1309"></a>
-<span class="sourceLineNo">1310</span>  public int getNumRegionsOpened() {<a name="line.1310"></a>
-<span class="sourceLineNo">1311</span>    // TODO: Used by TestRegionPlacement.java and assume monotonically increasing value<a name="line.1311"></a>
-<span class="sourceLineNo">1312</span>    return 0;<a name="line.1312"></a>
-<span class="sourceLineNo">1313</span>  }<a name="line.1313"></a>
-<span class="sourceLineNo">1314</span><a name="line.1314"></a>
-<span class="sourceLineNo">1315</span>  public void submitServerCrash(final ServerName serverName, final boolean shouldSplitWal) {<a name="line.1315"></a>
-<span class="sourceLineNo">1316</span>    boolean carryingMeta = master.getAssignmentManager().isCarryingMeta(serverName);<a name="line.1316"></a>
-<span class="sourceLineNo">1317</span>    ProcedureExecutor&lt;MasterProcedureEnv&gt; procExec = this.master.getMasterProcedureExecutor();<a name="line.1317"></a>
-<span class="sourceLineNo">1318</span>    procExec.submitProcedure(new ServerCrashProcedure(procExec.getEnvironment(), serverName,<a name="line.1318"></a>
-<span class="sourceLineNo">1319</span>      shouldSplitWal, carryingMeta));<a name="line.1319"></a>
-<span class="sourceLineNo">1320</span>    LOG.debug("Added=" + serverName +<a name="line.1320"></a>
-<span class="sourceLineNo">1321</span>      " to dead servers, submitted shutdown handler to be executed meta=" + carryingMeta);<a name="line.1321"></a>
+<span class="sourceLineNo">1305</span><a name="line.1305"></a>
+<span class="sourceLineNo">1306</span>    // TODO: can we avoid throwing an exception if hri is already loaded?<a name="line.1306"></a>
+<span class="sourceLineNo">1307</span>    //       at the moment we bypass only meta<a name="line.1307"></a>
+<span class="sourceLineNo">1308</span>    boolean meta = isMetaRegion(hri);<a name="line.1308"></a>
+<span class="sourceLineNo">1309</span>    boolean cleanup = isFailoverCleanupDone();<a name="line.1309"></a>
+<span class="sourceLineNo">1310</span>    if (!isMetaRegion(hri) &amp;&amp; !isFailoverCleanupDone()) {<a name="line.1310"></a>
+<span class="sourceLineNo">1311</span>      String msg = "Master not fully online; hbase:meta=" + meta + ", failoverCleanup=" + cleanup;<a name="line.1311"></a>
+<span class="sourceLineNo">1312</span>      throw new PleaseHoldException(msg);<a name="line.1312"></a>
+<span class="sourceLineNo">1313</span>    }<a name="line.1313"></a>
+<span class="sourceLineNo">1314</span>  }<a name="line.1314"></a>
+<span class="sourceLineNo">1315</span><a name="line.1315"></a>
+<span class="sourceLineNo">1316</span>  // ============================================================================================<a name="line.1316"></a>
+<span class="sourceLineNo">1317</span>  //  TODO: Metrics<a name="line.1317"></a>
+<span class="sourceLineNo">1318</span>  // ============================================================================================<a name="line.1318"></a>
+<span class="sourceLineNo">1319</span>  public int getNumRegionsOpened() {<a name="line.1319"></a>
+<span class="sourceLineNo">1320</span>    // TODO: Used by TestRegionPlacement.java and assume monotonically increasing value<a name="line.1320"></a>
+<span class="sourceLineNo">1321</span>    return 0;<a name="line.1321"></a>
 <span class="sourceLineNo">1322</span>  }<a name="line.1322"></a>
 <span class="sourceLineNo">1323</span><a name="line.1323"></a>
-<span class="sourceLineNo">1324</span>  public void offlineRegion(final RegionInfo regionInfo) {<a name="line.1324"></a>
-<span class="sourceLineNo">1325</span>    // TODO used by MasterRpcServices ServerCrashProcedure<a name="line.1325"></a>
-<span class="sourceLineNo">1326</span>    final RegionStateNode node = regionStates.getRegionNode(regionInfo);<a name="line.1326"></a>
-<span class="sourceLineNo">1327</span>    if (node != null) node.offline();<a name="line.1327"></a>
-<span class="sourceLineNo">1328</span>  }<a name="line.1328"></a>
-<span class="sourceLineNo">1329</span><a name="line.1329"></a>
-<span class="sourceLineNo">1330</span>  public void onlineRegion(final RegionInfo regionInfo, final ServerName serverName) {<a name="line.1330"></a>
-<span class="sourceLineNo">1331</span>    // TODO used by TestSplitTransactionOnCluster.java<a name="line.1331"></a>
-<span class="sourceLineNo">1332</span>  }<a name="line.1332"></a>
-<span class="sourceLineNo">1333</span><a name="line.1333"></a>
-<span class="sourceLineNo">1334</span>  public Map&lt;ServerName, List&lt;RegionInfo&gt;&gt; getSnapShotOfAssignment(<a name="line.1334"></a>
-<span class="sourceLineNo">1335</span>      final Collection&lt;RegionInfo&gt; regions) {<a name="line.1335"></a>
-<span class="sourceLineNo">1336</span>    return regionStates.getSnapShotOfAssignment(regions);<a name="line.1336"></a>
+<span class="sourceLineNo">1324</span>  public void submitServerCrash(final ServerName serverName, final boolean shouldSplitWal) {<a name="line.1324"></a>
+<span class="sourceLineNo">1325</span>    boolean carryingMeta = master.getAssignmentManager().isCarryingMeta(serverName);<a name="line.1325"></a>
+<span class="sourceLineNo">1326</span>    ProcedureExecutor&lt;MasterProcedureEnv&gt; procExec = this.master.getMasterProcedureExecutor();<a name="line.1326"></a>
+<span class="sourceLineNo">1327</span>    procExec.submitProcedure(new ServerCrashProcedure(procExec.getEnvironment(), serverName,<a name="line.1327"></a>
+<span class="sourceLineNo">1328</span>      shouldSplitWal, carryingMeta));<a name="line.1328"></a>
+<span class="sourceLineNo">1329</span>    LOG.debug("Added=" + serverName +<a name="line.1329"></a>
+<span class="sourceLineNo">1330</span>      " to dead servers, submitted shutdown handler to be executed meta=" + carryingMeta);<a name="line.1330"></a>
+<span class="sourceLineNo">1331</span>  }<a name="line.1331"></a>
+<span class="sourceLineNo">1332</span><a name="line.1332"></a>
+<span class="sourceLineNo">1333</span>  public void offlineRegion(final RegionInfo regionInfo) {<a name="line.1333"></a>
+<span class="sourceLineNo">1334</span>    // TODO used by MasterRpcServices ServerCrashProcedure<a name="line.1334"></a>
+<span class="sourceLineNo">1335</span>    final RegionStateNode node = regionStates.getRegionNode(regionInfo);<a name="line.1335"></a>
+<span class="sourceLineNo">1336</span>    if (node != null) node.offline();<a name="line.1336"></a>
 <span class="sourceLineNo">1337</span>  }<a name="line.1337"></a>
 <span class="sourceLineNo">1338</span><a name="line.1338"></a>
-<span class="sourceLineNo">1339</span>  // ============================================================================================<a name="line.1339"></a>
-<span class="sourceLineNo">1340</span>  //  TODO: UTILS/HELPERS?<a name="line.1340"></a>
-<span class="sourceLineNo">1341</span>  // ============================================================================================<a name="line.1341"></a>
-<span class="sourceLineNo">1342</span>  /**<a name="line.1342"></a>
-<span class="sourceLineNo">1343</span>   * Used by the client (via master) to identify if all regions have the schema updates<a name="line.1343"></a>
-<span class="sourceLineNo">1344</span>   *<a name="line.1344"></a>
-<span class="sourceLineNo">1345</span>   * @param tableName<a name="line.1345"></a>
-<span class="sourceLineNo">1346</span>   * @return Pair indicating the status of the alter command (pending/total)<a name="line.1346"></a>
-<span class="sourceLineNo">1347</span>   * @throws IOException<a name="line.1347"></a>
-<span class="sourceLineNo">1348</span>   */<a name="line.1348"></a>
-<span class="sourceLineNo">1349</span>  public Pair&lt;Integer, Integer&gt; getReopenStatus(TableName tableName) {<a name="line.1349"></a>
-<span class="sourceLineNo">1350</span>    if (isTableDisabled(tableName)) return new Pair&lt;Integer, Integer&gt;(0, 0);<a name="line.1350"></a>
-<span class="sourceLineNo">1351</span><a name="line.1351"></a>
-<span class="sourceLineNo">1352</span>    final List&lt;RegionState&gt; states = regionStates.getTableRegionStates(tableName);<a name="line.1352"></a>
-<span class="sourceLineNo">1353</span>    int ritCount = 0;<a name="line.1353"></a>
-<span class="sourceLineNo">1354</span>    for (RegionState regionState: states) {<a name="line.1354"></a>
-<span class="sourceLineNo">1355</span>      if (!regionState.isOpened()) ritCount++;<a name="line.1355"></a>
-<span class="sourceLineNo">1356</span>    }<a name="line.1356"></a>
-<span class="sourceLineNo">1357</span>    return new Pair&lt;Integer, Integer&gt;(ritCount, states.size());<a name="line.1357"></a>
-<span class="sourceLineNo">1358</span>  }<a name="line.1358"></a>
-<span class="sourceLineNo">1359</span><a name="line.1359"></a>
-<span class="sourceLineNo">1360</span>  /**<a name="line.1360"></a>
-<span class="sourceLineNo">1361</span>   * Used when assign regions, this method will put system regions in<a name="line.1361"></a>
-<span class="sourceLineNo">1362</span>   * front of user regions<a name="line.1362"></a>
-<span class="sourceLineNo">1363</span>   * @param regions<a name="line.1363"></a>
-<span class="sourceLineNo">1364</span>   * @return A list of regions with system regions at front<a name="line.1364"></a>
-<span class="sourceLineNo">1365</span>   */<a name="line.1365"></a>
-<span class="sourceLineNo">1366</span>  public List&lt;RegionInfo&gt; getOrderedRegions(<a name="line.1366"></a>
-<span class="sourceLineNo">1367</span>      final List&lt;RegionInfo&gt; regions) {<a name="line.1367"></a>
-<span class="sourceLineNo">1368</span>    if (regions == null) return Collections.emptyList();<a name="line.1368"></a>
-<span class="sourceLineNo">1369</span><a name="line.1369"></a>
-<span class="sourceLineNo">1370</span>    List&lt;RegionInfo&gt; systemList = new ArrayList&lt;&gt;();<a name="line.1370"></a>
-<span class="sourceLineNo">1371</span>    List&lt;RegionInfo&gt; userList = new ArrayList&lt;&gt;();<a name="line.1371"></a>
-<span class="sourceLineNo">1372</span>    for (RegionInfo hri : regions) {<a name="line.1372"></a>
-<span class="sourceLineNo">1373</span>      if (hri.getTable().isSystemTable()) systemList.add(hri);<a name="line.1373"></a>
-<span class="sourceLineNo">1374</span>      else userList.add(hri);<a name="line.1374"></a>
-<span class="sourceLineNo">1375</span>    }<a name="line.1375"></a>
-<span class="sourceLineNo">1376</span>    // Append userList to systemList<a name="line.1376"></a>
-<span class="sourceLineNo">1377</span>    systemList.addAll(userList);<a name="line.1377"></a>
-<span class="sourceLineNo">1378</span>    return systemList;<a name="line.1378"></a>
-<span class="sourceLineNo">1379</span>  }<a name="line.1379"></a>
-<span class="sourceLineNo">1380</span><a name="line.1380"></a>
-<span class="sourceLineNo">1381</span>  // ============================================================================================<a name="line.1381"></a>
-<span class="sourceLineNo">1382</span>  //  TODO: Region State In Transition<a name="line.1382"></a>
-<span class="sourceLineNo">1383</span>  // ============================================================================================<a name="line.1383"></a>
-<span class="sourceLineNo">1384</span>  protected boolean addRegionInTransition(final RegionStateNode regionNode,<a name="line.1384"></a>
-<span class="sourceLineNo">1385</span>      final RegionTransitionProcedure procedure) {<a name="line.1385"></a>
-<span class="sourceLineNo">1386</span>    return regionStates.addRegionInTransition(regionNode, procedure);<a name="line.1386"></a>
-<span class="sourceLineNo">1387</span>  }<a name="line.1387"></a>
-<span class="sourceLineNo">1388</span><a name="line.1388"></a>
-<span class="sourceLineNo">1389</span>  protected void removeRegionInTransition(final RegionStateNode regionNode,<a name="line.1389"></a>
-<span class="sourceLineNo">1390</span>      final RegionTransitionProcedure procedure) {<a name="line.1390"></a>
-<span class="sourceLineNo">1391</span>    regionStates.removeRegionInTransition(regionNode, procedure);<a name="line.1391"></a>
-<span class="sourceLineNo">1392</span>  }<a name="line.1392"></a>
-<span class="sourceLineNo">1393</span><a name="line.1393"></a>
-<span class="sourceLineNo">1394</span>  public boolean hasRegionsInTransition() {<a name="line.1394"></a>
-<span class="sourceLineNo">1395</span>    return regionStates.hasRegionsInTransition();<a name="line.1395"></a>
+<span class="sourceLineNo">1339</span>  public void onlineRegion(final RegionInfo regionInfo, final ServerName serverName) {<a name="line.1339"></a>
+<span class="sourceLineNo">1340</span>    // TODO used by TestSplitTransactionOnCluster.java<a name="line.1340"></a>
+<span class="sourceLineNo">1341</span>  }<a name="line.1341"></a>
+<span class="sourceLineNo">1342</span><a name="line.1342"></a>
+<span class="sourceLineNo">1343</span>  public Map&lt;ServerName, List&lt;RegionInfo&gt;&gt; getSnapShotOfAssignment(<a name="line.1343"></a>
+<span class="sourceLineNo">1344</span>      final Collection&lt;RegionInfo&gt; regions) {<a name="line.1344"></a>
+<span class="sourceLineNo">1345</span>    return regionStates.getSnapShotOfAssignment(regions);<a name="line.1345"></a>
+<span class="sourceLineNo">1346</span>  }<a name="line.1346"></a>
+<span class="sourceLineNo">1347</span><a name="line.1347"></a>
+<span class="sourceLineNo">1348</span>  // ============================================================================================<a name="line.1348"></a>
+<span class="sourceLineNo">1349</span>  //  TODO: UTILS/HELPERS?<a name="line.1349"></a>
+<span class="sourceLineNo">1350</span>  // ============================================================================================<a name="line.1350"></a>
+<span class="sourceLineNo">1351</span>  /**<a name="line.1351"></a>
+<span class="sourceLineNo">1352</span>   * Used by the client (via master) to identify if all regions have the schema updates<a name="line.1352"></a>
+<span class="sourceLineNo">1353</span>   *<a name="line.1353"></a>
+<span class="sourceLineNo">1354</span>   * @param tableName<a name="line.1354"></a>
+<span class="sourceLineNo">1355</span>   * @return Pair indicating the status of the alter command (pending/total)<a name="line.1355"></a>
+<span class="sourceLineNo">1356</span>   * @throws IOException<a name="line.1356"></a>
+<span class="sourceLineNo">1357</span>   */<a name="line.1357"></a>
+<span class="sourceLineNo">1358</span>  public Pair&lt;Integer, Integer&gt; getReopenStatus(TableName tableName) {<a name="line.1358"></a>
+<span class="sourceLineNo">1359</span>    if (isTableDisabled(tableName)) return new Pair&lt;Integer, Integer&gt;(0, 0);<a name="line.1359"></a>
+<span class="sourceLineNo">1360</span><a name="line.1360"></a>
+<span class="sourceLineNo">1361</span>    final List&lt;RegionState&gt; states = regionStates.getTableRegionStates(tableName);<a name="line.1361"></a>
+<span class="sourceLineNo">1362</span>    int ritCount = 0;<a name="line.1362"></a>
+<span class="sourceLineNo">1363</span>    for (RegionState regionState: states) {<a name="line.1363"></a>
+<span class="sourceLineNo">1364</span>      if (!regionState.isOpened()) ritCount++;<a name="line.1364"></a>
+<span class="sourceLineNo">1365</span>    }<a name="line.1365"></a>
+<span class="sourceLineNo">1366</span>    return new Pair&lt;Integer, Integer&gt;(ritCount, states.size());<a name="line.1366"></a>
+<span class="sourceLineNo">1367</span>  }<a name="line.1367"></a>
+<span class="sourceLineNo">1368</span><a name="line.1368"></a>
+<span class="sourceLineNo">1369</span>  /**<a name="line.1369"></a>
+<span class="sourceLineNo">1370</span>   * Used when assign regions, this method will put system regions in<a name="line.1370"></a>
+<span class="sourceLineNo">1371</span>   * front of user regions<a name="line.1371"></a>
+<span class="sourceLineNo">1372</span>   * @param regions<a name="line.1372"></a>
+<span class="sourceLineNo">1373</span>   * @return A list of regions with system regions at front<a name="line.1373"></a>
+<span class="sourceLineNo">1374</span>   */<a name="line.1374"></a>
+<span class="sourceLineNo">1375</span>  public List&lt;RegionInfo&gt; getOrderedRegions(<a name="line.1375"></a>
+<span class="sourceLineNo">1376</span>      final List&lt;RegionInfo&gt; regions) {<a name="line.1376"></a>
+<span class="sourceLineNo">1377</span>    if (regions == null) return Collections.emptyList();<a name="line.1377"></a>
+<span class="sourceLineNo">1378</span><a name="line.1378"></a>
+<span class="sourceLineNo">1379</span>    List&lt;RegionInfo&gt; systemList = new ArrayList&lt;&gt;();<a name="line.1379"></a>
+<span class="sourceLineNo">1380</span>    List&lt;RegionInfo&gt; userList = new ArrayList&lt;&gt;();<a name="line.1380"></a>
+<span class="sourceLineNo">1381</span>    for (RegionInfo hri : regions) {<a name="line.1381"></a>
+<span class="sourceLineNo">1382</span>      if (hri.getTable().isSystemTable()) systemList.add(hri);<a name="line.1382"></a>
+<span class="sourceLineNo">1383</span>      else userList.add(hri);<a name="line.1383"></a>
+<span class="sourceLineNo">1384</span>    }<a name="line.1384"></a>
+<span class="sourceLineNo">1385</span>    // Append userList to systemList<a name="line.1385"></a>
+<span class="sourceLineNo">1386</span>    systemList.addAll(userList);<a name="line.1386"></a>
+<span class="sourceLineNo">1387</span>    return systemList;<a name="line.1387"></a>
+<span class="sourceLineNo">1388</span>  }<a name="line.1388"></a>
+<span class="sourceLineNo">1389</span><a name="line.1389"></a>
+<span class="sourceLineNo">1390</span>  // ============================================================================================<a name="line.1390"></a>
+<span class="sourceLineNo">1391</span>  //  TODO: Region State In Transition<a name="line.1391"></a>
+<span class="sourceLineNo">1392</span>  // ============================================================================================<a name="line.1392"></a>
+<span class="sourceLineNo">1393</span>  protected boolean addRegionInTransition(final RegionStateNode regionNode,<a name="line.1393"></a>
+<span class="sourceLineNo">1394</span>      final RegionTransitionProcedure procedure) {<a name="line.1394"></a>
+<span class="sourceLineNo">1395</span>    return regionStates.addRegionInTransition(regionNode, procedure);<a name="line.1395"></a>
 <span class="sourceLineNo">1396</span>  }<a name="line.1396"></a>
 <span class="sourceLineNo">1397</span><a name="line.1397"></a>
-<span class="sourceLineNo">1398</span>  public List&lt;RegionStateNode&gt; getRegionsInTransition() {<a name="line.1398"></a>
-<span class="sourceLineNo">1399</span>    return regionStates.getRegionsInTransition();<a name="line.1399"></a>
-<span class="sourceLineNo">1400</span>  }<a name="line.1400"></a>
-<span class="sourceLineNo">1401</span><a name="line.1401"></a>
-<span class="sourceLineNo">1402</span>  public List&lt;RegionInfo&gt; getAssignedRegions() {<a name="line.1402"></a>
-<span class="sourceLineNo">1403</span>    return regionStates.getAssignedRegions();<a name="line.1403"></a>
-<span class="sourceLineNo">1404</span>  }<a name="line.1404"></a>
-<span class="sourceLineNo">1405</span><a name="line.1405"></a>
-<span class="sourceLineNo">1406</span>  public RegionInfo getRegionInfo(final byte[] regionName) {<a name="line.1406"></a>
-<span class="sourceLineNo">1407</span>    final RegionStateNode regionState = regionStates.getRegionNodeFromName(regionName);<a name="line.1407"></a>
-<span class="sourceLineNo">1408</span>    return regionState != null ? regionState.getRegionInfo() : null;<a name="line.1408"></a>
+<span class="sourceLineNo">1398</span>  protected void removeRegionInTransition(final RegionStateNode regionNode,<a name="line.1398"></a>
+<span class="sourceLineNo">1399</span>      final RegionTransitionProcedure procedure) {<a name="line.1399"></a>
+<span class="sourceLineNo">1400</span>    regionStates.removeRegionInTransition(regionNode, procedure);<a name="line.1400"></a>
+<span class="sourceLineNo">1401</span>  }<a name="line.1401"></a>
+<span class="sourceLineNo">1402</span><a name="line.1402"></a>
+<span class="sourceLineNo">1403</span>  public boolean hasRegionsInTransition() {<a name="line.1403"></a>
+<span class="sourceLineNo">1404</span>    return regionStates.hasRegionsInTransition();<a name="line.1404"></a>
+<span class="sourceLineNo">1405</span>  }<a name="line.1405"></a>
+<span class="sourceLineNo">1406</span><a name="line.1406"></a>
+<span class="sourceLineNo">1407</span>  public List&lt;RegionStateNode&gt; getRegionsInTransition() {<a name="line.1407"></a>
+<span class="sourceLineNo">1408</span>    return regionStates.getRegionsInTransition();<a name="line.1408"></a>
 <span class="sourceLineNo">1409</span>  }<a name="line.1409"></a>
 <span class="sourceLineNo">1410</span><a name="line.1410"></a>
-<span class="sourceLineNo">1411</span>  // ============================================================================================<a name="line.1411"></a>
-<span class="sourceLineNo">1412</span>  //  TODO: Region Status update<a name="line.1412"></a>
-<span class="sourceLineNo">1413</span>  // ============================================================================================<a name="line.1413"></a>
-<span class="sourceLineNo">1414</span>  private void sendRegionOpenedNotification(final RegionInfo regionInfo,<a name="line.1414"></a>
-<span class="sourceLineNo">1415</span>      final ServerName serverName) {<a name="line.1415"></a>
-<span class="sourceLineNo">1416</span>    getBalancer().regionOnline(regionInfo, serverName);<a name="line.1416"></a>
-<span class="sourceLineNo">1417</span>    if (!this.listeners.isEmpty()) {<a name="line.1417"></a>
-<span class="sourceLineNo">1418</span>      for (AssignmentListener listener : this.listeners) {<a name="line.1418"></a>
-<span class="sourceLineNo">1419</span>        listener.regionOpened(regionInfo, serverName);<a name="line.1419"></a>
-<span class="sourceLineNo">1420</span>      }<a name="line.1420"></a>
-<span class="sourceLineNo">1421</span>    }<a name="line.1421"></a>
-<span class="sourceLineNo">1422</span>  }<a name="line.1422"></a>
-<span class="sourceLineNo">1423</span><a name="line.1423"></a>
-<span class="sourceLineNo">1424</span>  private void sendRegionClosedNotification(final RegionInfo regionInfo) {<a name="line.1424"></a>
-<span class="sourceLineNo">1425</span>    getBalancer().regionOffline(regionInfo);<a name="line.1425"></a>
+<span class="sourceLineNo">1411</span>  public List&lt;RegionInfo&gt; getAssignedRegions() {<a name="line.1411"></a>
+<span class="sourceLineNo">1412</span>    return regionStates.getAssignedRegions();<a name="line.1412"></a>
+<span class="sourceLineNo">1413</span>  }<a name="line.1413"></a>
+<span class="sourceLineNo">1414</span><a name="line.1414"></a>
+<span class="sourceLineNo">1415</span>  public RegionInfo getRegionInfo(final byte[] regionName) {<a name="line.1415"></a>
+<span class="sourceLineNo">1416</span>    final RegionStateNode regionState = regionStates.getRegionNodeFromName(regionName);<a name="line.1416"></a>
+<span class="sourceLineNo">1417</span>    return regionState != null ? regionState.getRegionInfo() : null;<a name="line.1417"></a>
+<span class="sourceLineNo">1418</span>  }<a name="line.1418"></a>
+<span class="sourceLineNo">1419</span><a name="line.1419"></a>
+<span class="sourceLineNo">1420</span>  // ============================================================================================<a name="line.1420"></a>
+<span class="sourceLineNo">1421</span>  //  TODO: Region Status update<a name="line.1421"></a>
+<span class="sourceLineNo">1422</span>  // ============================================================================================<a name="line.1422"></a>
+<span class="sourceLineNo">1423</span>  private void sendRegionOpenedNotification(final RegionInfo regionInfo,<a name="line.1423"></a>
+<span class="sourceLineNo">1424</span>      final ServerName serverName) {<a name="line.1424"></a>
+<span class="sourceLineNo">1425</span>    getBalancer().regionOnline(regionInfo, serverName);<a name="line.1425"></a>
 <span class="sourceLineNo">1426</span>    if (!this.listeners.isEmpty()) {<a name="line.1426"></a>
 <span class="sourceLineNo">1427</span>      for (AssignmentListener listener : this.listeners) {<a name="line.1427"></a>
-<span class="sourceLineNo">1428</span>        listener.regionClosed(regionInfo);<a name="line.1428"></a>
+<span class="sourceLineNo">1428</span>        listener.regionOpened(regionInfo, serverName);<a name="line.1428"></a>
 <span class="sourceLineNo">1429</span>      }<a name="line.1429"></a>
 <span class="sourceLineNo">1430</span>    }<a name="line.1430"></a>
 <span class="sourceLineNo">1431</span>  }<a name="line.1431"></a>
 <span class="sourceLineNo">1432</span><a name="line.1432"></a>
-<span class="sourceLineNo">1433</span>  public void markRegionAsOpening(final RegionStateNode regionNode) throws IOException {<a name="line.1433"></a>
-<span class="sourceLineNo">1434</span>    synchronized (regionNode) {<a name="line.1434"></a>
-<span class="sourceLineNo">1435</span>      State state = regionNode.transitionState(State.OPENING, RegionStates.STATES_EXPECTED_ON_OPEN);<a name="line.1435"></a>
-<span class="sourceLineNo">1436</span>      regionStates.addRegionToServer(regionNode.getRegionLocation(), regionNode);<a name="line.1436"></a>
-<span class="sourceLineNo">1437</span>      regionStateStore.updateRegionLocation(regionNode.getRegionInfo(), state,<a name="line.1437"></a>
-<span class="sourceLineNo">1438</span>        regionNode.getRegionLocation(), regionNode.getLastHost(), HConstants.NO_SEQNUM,<a name="line.1438"></a>
-<span class="sourceLineNo">1439</span>        regionNode.getProcedure().getProcId());<a name="line.1439"></a>
-<span class="sourceLineNo">1440</span>    }<a name="line.1440"></a>
+<span class="sourceLineNo">1433</span>  private void sendRegionClosedNotification(final RegionInfo regionInfo) {<a name="line.1433"></a>
+<span class="sourceLineNo">1434</span>    getBalancer().regionOffline(regionInfo);<a name="line.1434"></a>
+<span class="sourceLineNo">1435</span>    if (!this.listeners.isEmpty()) {<a name="line.1435"></a>
+<span class="sourceLineNo">1436</span>      for (AssignmentListener listener : this.listeners) {<a name="line.1436"></a>
+<span class="sourceLineNo">1437</span>        listener.regionClosed(regionInfo);<a name="line.1437"></a>
+<span class="sourceLineNo">1438</span>      }<a name="line.1438"></a>
+<span class="sourceLineNo">1439</span>    }<a name="line.1439"></a>
+<span class="sourceLineNo">1440</span>  }<a name="line.1440"></a>
 <span class="sourceLineNo">1441</span><a name="line.1441"></a>
-<span class="sourceLineNo">1442</span>    // update the operation count metrics<a name="line.1442"></a>
-<span class="sourceLineNo">1443</span>    metrics.incrementOperationCounter();<a name="line.1443"></a>
-<span class="sourceLineNo">1444</span>  }<a name="line.1444"></a>
-<span class="sourceLineNo">1445</span><a name="line.1445"></a>
-<span class="sourceLineNo">1446</span>  public void undoRegionAsOpening(final RegionStateNode regionNode) {<a name="line.1446"></a>
-<span class="sourceLineNo">1447</span>    boolean opening = false;<a name="line.1447"></a>
-<span class="sourceLineNo">1448</span>    synchronized (regionNode) {<a name="line.1448"></a>
-<span class="sourceLineNo">1449</span>      if (regionNode.isInState(State.OPENING)) {<a name="line.1449"></a>
-<span class="sourceLineNo">1450</span>        opening = true;<a name="line.1450"></a>
-<span class="sourceLineNo">1451</span>        regionStates.removeRegionFromServer(regionNode.getRegionLocation(), regionNode);<a name="line.1451"></a>
-<span class="sourceLineNo">1452</span>      }<a name="line.1452"></a>
-<span class="sourceLineNo">1453</span>      // Should we update hbase:meta?<a name="line.1453"></a>
-<span class="sourceLineNo">1454</span>    }<a name="line.1454"></a>
-<span class="sourceLineNo">1455</span>    if (opening) {<a name="line.1455"></a>
-<span class="sourceLineNo">1456</span>      // TODO: Metrics. Do opposite of metrics.incrementOperationCounter();<a name="line.1456"></a>
-<span class="sourceLineNo">1457</span>    }<a name="line.1457"></a>
-<span class="sourceLineNo">1458</span>  }<a name="line.1458"></a>
-<span class="sourceLineNo">1459</span><a name="line.1459"></a>
-<span class="sourceLineNo">1460</span>  public void markRegionAsOpened(final RegionStateNode regionNode) throws IOException {<a name="line.1460"></a>
-<span class="sourceLineNo">1461</span>    final RegionInfo hri = regionNode.getRegionInfo();<a name="line.1461"></a>
-<span class="sourceLineNo">1462</span>    synchronized (regionNode) {<a name="line.1462"></a>
-<span class="sourceLineNo">1463</span>      State state = regionNode.transitionState(State.OPEN, RegionStates.STATES_EXPECTED_ON_OPEN);<a name="line.1463"></a>
-<span class="sourceLineNo">1464</span>      if (isMetaRegion(hri)) {<a name="line.1464"></a>
-<span class="sourceLineNo">1465</span>        master.getTableStateManager().setTableState(TableName.META_TABLE_NAME,<a name="line.1465"></a>
-<span class="sourceLineNo">1466</span>            TableState.State.ENABLED);<a name="line.1466"></a>
-<span class="sourceLineNo">1467</span>        setMetaInitialized(hri, true);<a name="line.1467"></a>
-<span class="sourceLineNo">1468</span>      }<a name="line.1468"></a>
-<span class="sourceLineNo">1469</span>      regionStates.addRegionToServer(regionNode.getRegionLocation(), regionNode);<a name="line.1469"></a>
-<span class="sourceLineNo">1470</span>      // TODO: OPENING Updates hbase:meta too... we need to do both here and there?<a name="line.1470"></a>
-<span class="sourceLineNo">1471</span>      // That is a lot of hbase:meta writing.<a name="line.1471"></a>
-<span class="sourceLineNo">1472</span>      regionStateStore.updateRegionLocation(regionNode.getRegionInfo(), state,<a name="line.1472"></a>
-<span class="sourceLineNo">1473</span>        regionNode.getRegionLocation(), regionNode.getLastHost(), regionNode.getOpenSeqNum(),<a name="line.1473"></a>
-<span class="sourceLineNo">1474</span>        regionNode.getProcedure().getProcId());<a name="line.1474"></a>
-<span class="sourceLineNo">1475</span>      sendRegionOpenedNotification(hri, regionNode.getRegionLocation());<a name="line.1475"></a>
-<span class="sourceLineNo">1476</span>    }<a name="line.1476"></a>
-<span class="sourceLineNo">1477</span>  }<a name="line.1477"></a>
-<span class="sourceLineNo">1478</span><a name="line.1478"></a>
-<span class="sourceLineNo">1479</span>  public void markRegionAsClosing(final RegionStateNode regionNode) throws IOException {<a name="line.1479"></a>
-<span class="sourceLineNo">1480</span>    final RegionInfo hri = regionNode.getRegionInfo();<a name="line.1480"></a>
-<span class="sourceLineNo">1481</span>    synchronized (regionNode) {<a name="line.1481"></a>
-<span class="sourceLineNo">1482</span>      State state = regionNode.transitionState(State.CLOSING, RegionStates.STATES_EXPECTED_ON_CLOSE);<a name="line.1482"></a>
-<span class="sourceLineNo">1483</span>      // Set meta has not initialized early. so people trying to create/edit tables will wait<a name="line.1483"></a>
-<span class="sourceLineNo">1484</span>      if (isMetaRegion(hri)) {<a name="line.1484"></a>
-<span class="sourceLineNo">1485</span>        setMetaInitialized(hri, false);<a name="line.1485"></a>
-<span class="sourceLineNo">1486</span>      }<a name="line.1486"></a>
-<span class="sourceLineNo">1487</span>      regionStates.addRegionToServer(regionNode.getRegionLocation(), regionNode);<a name="line.1487"></a>
-<span class="sourceLineNo">1488</span>      regionStateStore.updateRegionLocation(regionNode.getRegionInfo(), state,<a name="line.1488"></a>
-<span class="sourceLineNo">1489</span>        regionNode.getRegionLocation(), regionNode.getLastHost(), HConstants.NO_SEQNUM,<a name="line.1489"></a>
-<span class="sourceLineNo">1490</span>        regionNode.getProcedure().getProcId());<a name="line.1490"></a>
-<span class="sourceLineNo">1491</span>    }<a name="line.1491"></a>
-<span class="sourceLineNo">1492</span><a name="line.1492"></a>
-<span class="sourceLineNo">1493</span>    // update the operation count metrics<a name="line.1493"></a>
-<span class="sourceLineNo">1494</span>    metrics.incrementOperationCounter();<a name="line.1494"></a>
-<span class="sourceLineNo">1495</span>  }<a name="line.1495"></a>
-<span class="sourceLineNo">1496</span><a name="line.1496"></a>
-<span class="sourceLineNo">1497</span>  public void undoRegionAsClosing(final RegionStateNode regionNode) {<a name="line.1497"></a>
-<span class="sourceLineNo">1498</span>    // TODO: Metrics. Do opposite of metrics.incrementOperationCounter();<a name="line.1498"></a>
-<span class="sourceLineNo">1499</span>    // There is nothing to undo?<a name="line.1499"></a>
-<span class="sourceLineNo">1500</span>  }<a name="line.1500"></a>
+<span class="sourceLineNo">1442</span>  public void markRegionAsOpening(final RegionStateNode regionNode) throws IOException {<a name="line.1442"></a>
+<span class="sourceLineNo">1443</span>    synchronized (regionNode) {<a name="line.1443"></a>
+<span class="sourceLineNo">1444</span>      State state = regionNode.transitionState(State.OPENING, RegionStates.STATES_EXPECTED_ON_OPEN);<a name="line.1444"></a>
+<span class="sourceLineNo">1445</span>      regionStates.addRegionToServer(regionNode.getRegionLocation(), regionNode);<a name="line.1445"></a>
+<span class="sourceLineNo">1446</span>      regionStateStore.updateRegionLocation(regionNode.getRegionInfo(), state,<a name="line.1446"></a>
+<span class="sourceLineNo">1447</span>        regionNode.getRegionLocation(), regionNode.getLastHost(), HConstants.NO_SEQNUM,<a name="line.1447"></a>
+<span class="sourceLineNo">1448</span>        regionNode.getProcedure().getProcId());<a name="line.1448"></a>
+<span class="sourceLineNo">1449</span>    }<a name="line.1449"></a>
+<span class="sourceLineNo">1450</span><a name="line.1450"></a>
+<span class="sourceLineNo">1451</span>    // update the operation count metrics<a name="line.1451"></a>
+<span class="sourceLineNo">1452</span>    metrics.incrementOperationCounter();<a name="line.1452"></a>
+<span class="sourceLineNo">1453</span>  }<a name="line.1453"></a>
+<span class="sourceLineNo">1454</span><a name="line.1454"></a>
+<span class="sourceLineNo">1455</span>  public void undoRegionAsOpening(final RegionStateNode regionNode) {<a name="line.1455"></a>
+<span class="sourceLineNo">1456</span>    boolean opening = false;<a name="line.1456"></a>
+<span class="sourceLineNo">1457</span>    synchronized (regionNode) {<a name="line.1457"></a>
+<span class="sourceLineNo">1458</span>      if (regionNode.isInState(State.OPENING)) {<a name="line.1458"></a>
+<span class="sourceLineNo">1459</span>        opening = true;<a name="line.1459"></a>
+<span class="sourceLineNo">1460</span>        regionStates.removeRegionFromServer(regionNode.getRegionLocation(), regionNode);<a name="line.1460"></a>
+<span class="sourceLineNo">1461</span>      }<a name="line.1461"></a>
+<span class="sourceLineNo">1462</span>      // Should we update hbase:meta?<a name="line.1462"></a>
+<span class="sourceLineNo">1463</span>    }<a name="line.1463"></a>
+<span class="sourceLineNo">1464</span>    if (opening) {<a name="line.1464"></a>
+<span class="sourceLineNo">1465</span>      // TODO: Metrics. Do opposite of metrics.incrementOperationCounter();<a name="line.1465"></a>
+<span class="sourceLineNo">1466</span>    }<a name="line.1466"></a>
+<span class="sourceLineNo">1467</span>  }<a name="line.1467"></a>
+<span class="sourceLineNo">1468</span><a name="line.1468"></a>
+<span class="sourceLineNo">1469</span>  public void markRegionAsOpened(final RegionStateNode regionNode) throws IOException {<a name="line.1469"></a>
+<span class="sourceLineNo">1470</span>    final RegionInfo hri = regionNode.getRegionInfo();<a name="line.1470"></a>
+<span class="sourceLineNo">1471</span>    synchronized (regionNode) {<a name="line.1471"></a>
+<span class="sourceLineNo">1472</span>      State state = regionNode.transitionState(State.OPEN, RegionStates.STATES_EXPECTED_ON_OPEN);<a name="line.1472"></a>
+<span class="sourceLineNo">1473</span>      if (isMetaRegion(hri)) {<a name="line.1473"></a>
+<span class="sourceLineNo">1474</span>        master.getTableStateManager().setTableState(TableName.META_TABLE_NAME,<a name="line.1474"></a>
+<span class="sourceLineNo">1475</span>            TableState.State.ENABLED);<a name="line.1475"></a>
+<span class="sourceLineNo">1476</span>        setMetaInitialized(hri, true);<a name="line.1476"></a>
+<span class="sourceLineNo">1477</span>      }<a name="line.1477"></a>
+<span class="sourceLineNo">1478</span>      regionStates.addRegionToServer(regionNode.getRegionLocation(), regionNode);<a name="line.1478"></a>
+<span class="sourceLineNo">1479</span>      // TODO: OPENING Updates hbase:meta too... we need to do both here and there?<a name="line.1479"></a>
+<span class="sourceLineNo">1480</span>      // That is a lot of hbase:meta writing.<a name="line.1480"></a>
+<span class="sourceLineNo">1481</span>      regionStateStore.updateRegionLocation(regionNode.getRegionInfo(), state,<a name="line.1481"></a>
+<span class="sourceLineNo">1482</span>        regionNode.getRegionLocation(), regionNode.getLastHost(), regionNode.getOpenSeqNum(),<a name="line.1482"></a>
+<span class="sourceLineNo">1483</span>        regionNode.getProcedure().getProcId());<a name="line.1483"></a>
+<span class="sourceLineNo">1484</span>      sendRegionOpenedNotification(hri, regionNode.getRegionLocation());<a name="line.1484"></a>
+<span class="sourceLineNo">1485</span>    }<a name="line.1485"></a>
+<span class="sourceLineNo">1486</span>  }<a name="line.1486"></a>
+<span class="sourceLineNo">1487</span><a name="line.1487"></a>
+<span class="sourceLineNo">1488</span>  public void markRegionAsClosing(final RegionStateNode regionNode) throws IOException {<a name="line.1488"></a>
+<span class="sourceLineNo">1489</span>    final RegionInfo hri = regionNode.getRegionInfo();<a name="line.1489"></a>
+<span class="sourceLineNo">1490</span>    synchronized (regionNode) {<a name="line.1490"></a>
+<span class="sourceLineNo">1491</span>      State state = regionNode.transitionState(State.CLOSING, RegionStates.STATES_EXPECTED_ON_CLOSE);<a name="line.1491"></a>
+<span class="sourceLineNo">1492</span>      // Set meta has not initialized early. so people trying to create/edit tables will wait<a name="line.1492"></a>
+<span class="sourceLineNo">1493</span>      if (isMetaRegion(hri)) {<a name="line.1493"></a>
+<span class="sourceLineNo">1494</span>        setMetaInitialized(hri, false);<a name="line.1494"></a>
+<span class="sourceLineNo">1495</span>      }<a name="line.1495"></a>
+<span class="sourceLineNo">1496</span>      regionStates.addRegionToServer(regionNode.getRegionLocation(), regionNode);<a name="line.1496"></a>
+<span class="sourceLineNo">1497</span>      regionStateStore.updateRegionLocation(regionNode.getRegionInfo(), state,<a name="line.1497"></a>
+<span class="sourceLineNo">1498</span>        regionNode.getRegionLocation(), regionNode.getLastHost(), HConstants.NO_SEQNUM,<a name="line.1498"></a>
+<span class="sourceLineNo">1499</span>        regionNode.getProcedure().getProcId());<a name="line.1499"></a>
+<span class="sourceLineNo">1500</span>    }<a name="line.1500"></a>
 <span class="sourceLineNo">1501</span><a name="line.1501"></a>
-<span class="sourceLineNo">1502</span>  public void markRegionAsClosed(final RegionStateNode regionNode) throws IOException {<a name="line.1502"></a>
-<span class="sourceLineNo">1503</span>    final RegionInfo hri = regionNode.getRegionInfo();<a name="line.1503"></a>
-<span class="sourceLineNo">1504</span>    synchronized (regionNode) {<a name="line.1504"></a>
-<span class="sourceLineNo">1505</span>      State state = regionNode.transitionState(State.CLOSED, RegionStates.STATES_EXPECTED_ON_CLOSE);<a name="line.1505"></a>
-<span class="sourceLineNo">1506</span>      regionStates.removeRegionFromServer(regionNode.getRegionLocation(), regionNode);<a name="line.1506"></a>
-<span class="sourceLineNo">1507</span>      regionNode.setLastHost(regionNode.getRegionLocation());<a name="line.1507"></a>
-<span class="sourceLineNo">1508</span>      regionNode.setRegionLocation(null);<a name="line.1508"></a>
-<span class="sourceLineNo">1509</span>      regionStateStore.updateRegionLocation(regionNode.getRegionInfo(), state,<a name="line.1509"></a>
-<span class="sourceLineNo">1510</span>        regionNode.getRegionLocation()/*null*/, regionNode.getLastHost(),<a name="line.1510"></a>
-<span class="sourceLineNo">1511</span>        HConstants.NO_SEQNUM, regionNode.getProcedure().getProcId());<a name="line.1511"></a>
-<span class="sourceLineNo">1512</span>      sendRegionClosedNotification(hri);<a name="line.1512"></a>
-<span class="sourceLineNo">1513</span>    }<a name="line.1513"></a>
-<span class="sourceLineNo">1514</span>  }<a name="line.1514"></a>
-<span class="sourceLineNo">1515</span><a name="line.1515"></a>
-<span class="sourceLineNo">1516</span>  public void markRegionAsSplit(final RegionInfo parent, final ServerName serverName,<a name="line.1516"></a>
-<span class="sourceLineNo">1517</span>      final RegionInfo daughterA, final RegionInfo daughterB)<a name="line.1517"></a>
-<span class="sourceLineNo">1518</span>  throws IOException {<a name="line.1518"></a>
-<span class="sourceLineNo">1519</span>    // Update hbase:meta. Parent will be marked offline and split up in hbase:meta.<a name="line.1519"></a>
-<span class="sourceLineNo">1520</span>    // The parent stays in regionStates until cleared when removed by CatalogJanitor.<a name="line.1520"></a>
-<span class="sourceLineNo">1521</span>    // Update its state in regionStates to it shows as offline and split when read<a name="line.1521"></a>
-<span class="sourceLineNo">1522</span>    // later figuring what regions are in a table and what are not: see<a name="line.1522"></a>
-<span class="sourceLineNo">1523</span>    // regionStates#getRegionsOfTable<a name="line.1523"></a>
-<span class="sourceLineNo">1524</span>    final RegionStateNode node = regionStates.getOrCreateRegionNode(parent);<a name="line.1524"></a>
-<span class="sourceLineNo">1525</span>    node.setState(State.SPLIT);<a name="line.1525"></a>
-<span class="sourceLineNo">1526</span>    regionStateStore.splitRegion(parent, daughterA, daughterB, serverName);<a name="line.1526"></a>
-<span class="sourceLineNo">1527</span>    if (shouldAssignFavoredNodes(parent)) {<a name="line.1527"></a>
-<span class="sourceLineNo">1528</span>      List&lt;ServerName&gt; onlineServers = this.master.getServerManager().getOnlineServersList();<a name="line.1528"></a>
-<span class="sourceLineNo">1529</span>      ((FavoredNodesPromoter)getBalancer()).<a name="line.1529"></a>
-<span class="sourceLineNo">1530</span>          generateFavoredNodesForDaughter(onlineServers, parent, daughterA, daughterB);<a name="line.1530"></a>
-<span class="sourceLineNo">1531</span>    }<a name="line.1531"></a>
-<span class="sourceLineNo">1532</span>  }<a name="line.1532"></a>
-<span class="sourceLineNo">1533</span><a name="line.1533"></a>
-<span class="sourceLineNo">1534</span>  /**<a name="line.1534"></a>
-<span class="sourceLineNo">1535</span>   * When called here, the merge has happened. The two merged regions have been<a name="line.1535"></a>
-<span class="sourceLineNo">1536</span>   * unassigned and the above markRegionClosed has been called on each so they have been<a name="line.1536"></a>
-<span class="sourceLineNo">1537</span>   * disassociated from a hosting Server. The merged region will be open after this call. The<a name="line.1537"></a>
-<span class="sourceLineNo">1538</span>   * merged regions are removed from hbase:meta below&gt; Later they are deleted from the filesystem<a name="line.1538"></a>
-<span class="sourceLineNo">1539</span>   * by the catalog janitor running against hbase:meta. It notices when the merged region no<a name="line.1539"></a>
-<span class="sourceLineNo">1540</span>   * longer holds references to the old regions.<a name="line.1540"></a>
-<span class="sourceLineNo">1541</span>   */<a name="line.1541"></a>
-<span class="sourceLineNo">1542</span>  public void markRegionAsMerged(final RegionInfo child, final ServerName serverName,<a name="line.1542"></a>
-<span class="sourceLineNo">1543</span>      final RegionInfo mother, final RegionInfo father) throws IOException {<a name="line.1543"></a>
-<span class="sourceLineNo">1544</span>    final RegionStateNode node = regionStates.getOrCreateRegionNode(child);<a name="line.1544"></a>
-<span class="sourceLineNo">1545</span>    node.setState(State.MERGED);<a name="line.1545"></a>
-<span class="sourceLineNo">1546</span>    regionStates.deleteRegion(mother);<a name="line.1546"></a>
-<span class="sourceLineNo">1547</span>    regionStates.deleteRegion(father);<a name="line.1547"></a>
-<span class="sourceLineNo">1548</span>    regionStateStore.mergeRegions(child, mother, father, serverName);<a name="line.1548"></a>
-<span class="sourceLineNo">1549</span>    if (shouldAssignFavoredNodes(child)) {<a name="line.1549"></a>
-<span class="sourceLineNo">1550</span>      ((FavoredNodesPromoter)getBalancer()).<a name="line.1550"></a>
-<span class="sourceLineNo">1551</span>        generateFavoredNodesForMergedRegion(child, mother, father);<a name="line.1551"></a>
-<span class="sourceLineNo">1552</span>    }<a name="line.1552"></a>
-<span class="sourceLineNo">1553</span>  }<a name="line.1553"></a>
-<span class="sourceLineNo">1554</span><a name="line.1554"></a>
-<span class="sourceLineNo">1555</span>  /*<a name="line.1555"></a>
-<span class="sourceLineNo">1556</span>   * Favored nodes should be applied only when FavoredNodes balancer is configured and the region<a name="line.1556"></a>
-<span class="sourceLineNo">1557</span>   * belongs to a non-system table.<a name="line.1557"></a>
-<span class="sourceLineNo">1558</span>   */<a name="line.1558"></a>
-<span class="sourceLineNo">1559</span>  private boolean shouldAssignFavoredNodes(RegionInfo region) {<a name="line.1559"></a>
-<span class="sourceLineNo">1560</span>    return this.shouldAssignRegionsWithFavoredNodes &amp;&amp;<a name="line.1560"></a>
-<span class="sourceLineNo">1561</span>        FavoredNodesManager.isFavoredNodeApplicable(region);<a name="line.1561"></a>
-<span class="sourceLineNo">1562</span>  }<a name="line.1562"></a>
-<span class="sourceLineNo">1563</span><a name="line.1563"></a>
-<span class="sourceLineNo">1564</span>  // ============================================================================================<a name="line.1564"></a>
-<span class="sourceLineNo">1565</span>  //  Assign Queue (Assign/Balance)<a name="line.1565"></a>
-<span class="sourceLineNo">1566</span>  // ============================================================================================<a name="line.1566"></a>
-<span class="sourceLineNo">1567</span>  private final ArrayList&lt;RegionStateNode&gt; pendingAssignQueue = new ArrayList&lt;RegionStateNode&gt;();<a name="line.1567"></a>
-<span class="sourceLineNo">1568</span>  private final ReentrantLock assignQueueLock = new ReentrantLock();<a name="line.1568"></a>
-<span class="sourceLineNo">1569</span>  private final Condition assignQueueFullCond = assignQueueLock.newCondition();<a name="line.1569"></a>
-<span class="sourceLineNo">1570</span><a name="line.1570"></a>
-<span class="sourceLineNo">1571</span>  /**<a name="line.1571"></a>
-<span class="sourceLineNo">1572</span>   * Add the assign operation to the assignment queue.<a name="line.1572"></a>
-<span class="sourceLineNo">1573</span>   * The pending assignment operation will be processed,<a name="line.1573"></a>
-<span class="sourceLineNo">1574</span>   * and each region will be assigned by a server using the balancer.<a name="line.1574"></a>
-<span class="sourceLineNo">1575</span>   */<a name="line.1575"></a>
-<span class="sourceLineNo">1576</span>  protected void queueAssign(final RegionStateNode regionNode) {<a name="line.1576"></a>
-<span class="sourceLineNo">1577</span>    getProcedureScheduler().suspendEvent(regionNode.getProcedureEvent());<a name="line.1577"></a>
-<span class="sourceLineNo">1578</span><a name="line.1578"></a>
-<span class="sourceLineNo">1579</span>    // TODO: quick-start for meta and the other sys-tables?<a name="line.1579"></a>
-<span class="sourceLineNo">1580</span>    assignQueueLock.lock();<a name="line.1580"></a>
-<span class="sourceLineNo">1581</span>    try {<a name="line.1581"></a>
-<span class="sourceLineNo">1582</span>      pendingAssignQueue.add(regionNode);<a name="line.1582"></a>
-<span class="sourceLineNo">1583</span>      if (regionNode.isSystemTable() ||<a name="line.1583"></a>
-<span class="sourceLineNo">1584</span>          pendingAssignQueue.size() == 1 ||<a name="line.1584"></a>
-<span class="sourceLineNo">1585</span>          pendingAssignQueue.size() &gt;= assignDispatchWaitQueueMaxSize) {<a name="line.1585"></a>
-<span class="sourceLineNo">1586</span>        assignQueueFullCond.signal();<a name="line.1586"></a>
-<span class="sourceLineNo">1587</span>      }<a name="line.1587"></a>
-<span class="sourceLineNo">1588</span>    } finally {<a name="line.1588"></a>
-<span class="sourceLineNo">1589</span>      assignQueueLock.unlock();<a name="line.1589"></a>
-<span class="sourceLineNo">1590</span>    }<a name="line.1590"></a>
-<span class="sourceLineNo">1591</span>  }<a name="line.1591"></a>
+<span class="sourceLineNo">1502</span>    // update the operation count metrics<a name="line.1502"></a>
+<span class="sourceLineNo">1503</span>    metrics.incrementOperationCounter();<a name="line.1503"></a>
+<span class="sourceLineNo">1504</span>  }<a name="line.1504"></a>
+<span class="sourceLineNo">1505</span><a name="line.1505"></a>
+<span class="sourceLineNo">1506</span>  public void undoRegionAsClosing(final RegionStateNode regionNode) {<a name="line.1506"></a>
+<span class="sourceLineNo">1507</span>    // TODO: Metrics. Do opposite of metrics.incrementOperationCounter();<a name="line.1507"></a>
+<span class="sourceLineNo">1508</span>    // There is nothing to undo?<a name="line.1508"></a>
+<span class="sourceLineNo">1509</span>  }<a name="line.1509"></a>
+<span class="sourceLineNo">1510</span><a name="line.1510"></a>
+<span class="sourceLineNo">1511</span>  public void markRegionAsClosed(final RegionStateNode regionNode) throws IOException {<a name="line.1511"></a>
+<span class="sourceLineNo">1512</span>    final RegionInfo hri = regionNode.getRegionInfo();<a name="line.1512"></a>
+<span class="sourceLineNo">1513</span>    synchronized (regionNode) {<a name="line.1513"></a>
+<span class="sourceLineNo">1514</span>      State state = regionNode.transitionState(State.CLOSED, RegionStates.STATES_EXPECTED_ON_CLOSE);<a name="line.1514"></a>
+<span class="sourceLineNo">1515</span>      regionStates.removeRegionFromServer(regionNode.getRegionLocation(), regionNode);<a name="line.1515"></a>
+<span class="sourceLineNo">1516</span>      regionNode.setLastHost(regionNode.getRegionLocation());<a name="line.1516"></a>
+<span class="sourceLineNo">1517</span>      regionNode.setRegionLocation(null);<a name="line.1517"></a>
+<span class="sourceLineNo">1518</span>      regionStateStore.updateRegionLocation(regionNode.getRegionInfo(), state,<a name="line.1518"></a>
+<span class="sourceLineNo">1519</span>        regionNode.getRegionLocation()/*null*/, regionNode.getLastHost(),<a name="line.1519"></a>
+<span class="sourceLineNo">1520</span>        HConstants.NO_SEQNUM, regionNode.getProcedure().getProcId());<a name="line.1520"></a>
+<span class="sourceLineNo">1521</span>      sendRegionClosedNotification(hri);<a name="line.1521"></a>
+<span class="sourceLineNo">1522</span>    }<a name="line.1522"></a>
+<span class="sourceLineNo">1523</span>  }<a name="line.1523"></a>
+<span class="sourceLineNo">1524</span><a name="line.1524"></a>
+<span class="sourceLineNo">1525</span>  public void markRegionAsSplit(final RegionInfo parent, final ServerName serverName,<a name="line.1525"></a>
+<span class="sourceLineNo">1526</span>      final RegionInfo daughterA, final RegionInfo daughterB)<a name="line.1526"></a>
+<span class="sourceLineNo">1527</span>  throws IOException {<a name="line.1527"></a>
+<span class="sourceLineNo">1528</span>    // Update hbase:meta. Parent will be marked offline and split up in hbase:meta.<a name="line.1528"></a>
+<span class="sourceLineNo">1529</span>    // The parent stays in regionStates until cleared when removed by CatalogJanitor.<a name="line.1529"></a>
+<span class="sourceLineNo">1530</span>    // Update its state in regionStates to it shows as offline and split when read<a name="line.1530"></a>
+<span class="sourceLineNo">1531</span>    // later figuring what regions are in a table and what are not: see<a name="line.1531"></a>
+<span class="sourceLineNo">1532</span>    // regionStates#getRegionsOfTable<a name="line.1532"></a>
+<span class="sourceLineNo">1533</span>    final RegionStateNode node = regionStates.getOrCreateRegionNode(parent);<a name="line.1533"></a>
+<span class="sourceLineNo">1534</span>    node.setState(State.SPLIT);<a name="line.1534"></a>
+<span class="sourceLineNo">1535</span>    final RegionStateNode nodeA = regionStates.getOrCreateRegionNode(daughterA);<a name="line.1535"></a>
+<span class="sourceLineNo">1536</span>    nodeA.setState(State.SPLITTING_NEW);<a name="line.1536"></a>
+<span class="sourceLineNo">1537</span>    final RegionStateNode nodeB = regionStates.getOrCreateRegionNode(daughterB);<a name="line.1537"></a>
+<span class="sourceLineNo">1538</span>    nodeB.setState(State.SPLITTING_NEW);<a name="line.1538"></a>
+<span class="sourceLineNo">1539</span><a name="line.1539"></a>
+<span class="sourceLineNo">1540</span>    regionStateStore.splitRegion(parent, daughterA, daughterB, serverName);<a name="line.1540"></a>
+<span class="sourceLineNo">1541</span>    if (shouldAssignFavoredNodes(parent)) {<a name="line.1541"></a>
+<span class="sourceLineNo">1542</span>      List&lt;ServerName&gt; onlineServers = this.master.getServerManager().getOnlineServersList();<a name="line.1542"></a>
+<span class="sourceLineNo">1543</span>      ((FavoredNodesPromoter)getBalancer()).<a name="line.1543"></a>
+<span class="sourceLineNo">1544</span>          generateFavoredNodesForDaughter(onlineServers, parent, daughterA, daughterB);<a name="line.1544"></a>
+<span class="sourceLineNo">1545</span>    }<a name="line.1545"></a>
+<span class="sourceLineNo">1546</span>  }<a name="line.1546"></a>
+<span class="sourceLineNo">1547</span><a name="line.1547"></a>
+<span class="sourceLineNo">1548</span>  /**<a name="line.1548"></a>
+<span class="sourceLineNo">1549</span>   * When called here, the merge has happened. The two merged regions have been<a name="line.1549"></a>
+<span class="sourceLineNo">1550</span>   * unassigned and the above markRegionClosed has been called on each so they have been<a name="line.1550"></a>
+<span class="sourceLineNo">1551</span>   * disassociated from a hosting Server. The merged region will be open after this call. The<a name="line.1551"></a>
+<span class="sourceLineNo">1552</span>   * merged regions are removed from hbase:meta below&gt; Later they are deleted from the filesystem<a name="line.1552"></a>
+<span class="sourceLineNo">1553</span>   * by the catalog janitor running against hbase:meta. It notices when the merged region no<a name="line.1553"></a>
+<span class="sourceLineNo">1554</span>   * longer holds references to the old regions.<a name="line.1554"></a>
+<span class="sourceLineNo">1555</span>   */<a name="line.1555"></a>
+<span class="sourceLineNo">1556</span>  public void markRegionAsMerged(final RegionInfo child, final ServerName serverName,<a name="line.1556"></a>
+<span class="sourceLineNo">1557</span>      final RegionInfo mother, final RegionInfo father) throws IOException {<a name="line.1557"></a>
+<span class="sourceLineNo">1558</span>    final RegionStateNode node = regionStates.getOrCreateRegionNode(child);<a name="line.1558"></a>
+<span class="sourceLineNo">1559</span>    node.setState(State.MERGED);<a name="line.1559"></a>
+<span class="sourceLineNo">1560</span>    regionStates.deleteRegion(mother);<a name="line.1560"></a>
+<span class="sourceLineNo">1561</span>    regionStates.deleteRegion(father);<a name="line.1561"></a>
+<span class="sourceLineNo">1562</span>    regionStateStore.mergeRegions(child, mother, father, serverName);<a name="line.1562"></a>
+<span class="sourceLineNo">1563</span>    if (shouldAssignFavoredNodes(child)) {<a name="line.1563"></a>
+<span class="sourceLineNo">1564</span>      ((FavoredNodesPromoter)getBalancer()).<a name="line.1564"></a>
+<span class="sourceLineNo">1565</span>        generateFavoredNodesForMergedRegion(child, mother, father);<a name="line.1565"></a>
+<span class="sourceLineNo">1566</span>    }<a name="line.1566"></a>
+<span class="sourceLineNo">1567</span>  }<a name="line.1567"></a>
+<span class="sourceLineNo">1568</span><a name="line.1568"></a>
+<span class="sourceLineNo">1569</span>  /*<a name="line.1569"></a>
+<span class="sourceLineNo">1570</span>   * Favored nodes should be applied only when FavoredNodes balancer is configured and the region<a name="line.1570"></a>
+<span class="sourceLineNo">1571</span>   * belongs to a non-system table.<a name="line.1571"></a>
+<span class="sourceLineNo">1572</span>   */<a name="line.1572"></a>
+<span class="sourceLineNo">1573</span>  private boolean shouldAssignFavoredNodes(RegionInfo region) {<a name="line.1573"></a>
+<span class="sourceLineNo">1574</span>    return this.shouldAssignRegionsWithFavoredNodes &amp;&amp;<a name="line.1574"></a>
+<span class="sourceLineNo">1575</span>        FavoredNodesManager.isFavoredNodeApplicable(region);<a name="line.1575"></a>
+<span class="sourceLineNo">1576</span>  }<a name="line.1576"></a>
+<span class="sourceLineNo">1577</span><a name="line.1577"></a>
+<span class="sourceLineNo">1578</span>  // ============================================================================================<a name="line.1578"></a>
+<span class="sourceLineNo">1579</span>  //  Assign Queue (Assign/Balance)<a name="line.1579"></a>
+<span class="sourceLineNo">1580</span>  // ============================================================================================<a name="line.1580"></a>
+<span class="sourceLineNo">1581</span>  private final ArrayList&lt;RegionStateNode&gt; pendingAssignQueue = new ArrayList&lt;RegionStateNode&gt;();<a name="line.1581"></a>
+<span class="sourceLineNo">1582</span>  private final ReentrantLock assignQueueLock = new ReentrantLock();<a name="line.1582"></a>
+<span class="sourceLineNo">1583</span>  private final Condition assignQueueFullCond = assignQueueLock.newCondition();<a name="line.1583"></a>
+<span class="sourceLineNo">1584</span><a name="line.1584"></a>
+<span class="sourceLineNo">1585</span>  /**<a name="line.1585"></a>
+<span class="sourceLineNo">1586</span>   * Add the assign operation to the assignment queue.<a name="line.1586"></a>
+<span class="sourceLineNo">1587</span>   * The pending assignment operation will be processed,<a name="line.1587"></a>
+<span class="sourceLineNo">1588</span>   * and each region will be assigned by a server using the balancer.<a name="line.1588"></a>
+<span class="sourceLineNo">1589</span>   */<a name="line.1589"></a>
+<span class="sourceLineNo">1590</span>  protected void queueAssign(final RegionStateNode regionNode) {<a name="line.1590"></a>
+<span class="sourceLineNo">1591</span>    getProcedureScheduler().suspendEvent(regionNode.getProcedureEvent());<a name="line.1591"></a>
 <span class="sourceLineNo">1592</span><a name="line.1592"></a>
-<span class="sourceLineNo">1593</span>  private void startAssignmentThread() {<a name="line.1593"></a>
-<span class="sourceLineNo">1594</span>    assignThread = new Thread("AssignmentThread") {<a name="line.1594"></a>
-<span class="sourceLineNo">1595</span>      @Override<a name="line.1595"></a>
-<span class="sourceLineNo">1596</span>      public void run() {<a name="line.1596"></a>
-<span class="sourceLineNo">1597</span>        while (isRunning()) {<a name="line.1597"></a>
-<span class="sourceLineNo">1598</span>          processAssignQueue();<a name="line.1598"></a>
-<span class="sourceLineNo">1599</span>        }<a name="line.1599"></a>
-<span class="sourceLineNo">1600</span>        pendingAssignQueue.clear();<a name="line.1600"></a>
+<span class="sourceLineNo">1593</span>    // TODO: quick-start for meta and the other sys-tables?<a name="line.1593"></a>
+<span class="sourceLineNo">1594</span>    assignQueueLock.lock();<a name="line.1594"></a>
+<span class="sourceLineNo">1595</span>    try {<a name="line.1595"></a>
+<span class="sourceLineNo">1596</span>      pendingAssignQueue.add(regionNode);<a name="line.1596"></a>
+<span class="sourceLineNo">1597</span>      if (regionNode.isSystemTable() ||<a name="line.1597"></a>
+<span class="sourceLineNo">1598</span>          pendingAssignQueue.size() == 1 ||<a name="line.1598"></a>
+<span class="sourceLineNo">1599</span>          pendingAssignQueue.size() &gt;= assignDispatchWaitQueueMaxSize) {<a name="line.1599"></a>
+<span class="sourceLineNo">1600</span>        assignQueueFullCond.signal();<a name="line.1600"></a>
 <span class="sourceLineNo">1601</span>      }<a name="line.1601"></a>
-<span class="sourceLineNo">1602</span>    };<a name="line.1602"></a>
-<span class="sourceLineNo">1603</span>    assignThrea

<TRUNCATED>

Mime
View raw message