hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mi...@apache.org
Subject [39/51] [partial] hbase-site git commit: Published site at f6945c4631e7697976fd8c2272f8152905c6f875.
Date Thu, 10 Mar 2016 17:23:22 GMT
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/5eb82203/devapidocs/src-html/org/apache/hadoop/hbase/master/procedure/CreateNamespaceProcedure.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/master/procedure/CreateNamespaceProcedure.html
b/devapidocs/src-html/org/apache/hadoop/hbase/master/procedure/CreateNamespaceProcedure.html
index 6b5a8a4..30f2748 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/master/procedure/CreateNamespaceProcedure.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/master/procedure/CreateNamespaceProcedure.html
@@ -202,177 +202,186 @@
 <span class="sourceLineNo">194</span>    sb.append(")");<a name="line.194"></a>
 <span class="sourceLineNo">195</span>  }<a name="line.195"></a>
 <span class="sourceLineNo">196</span><a name="line.196"></a>
-<span class="sourceLineNo">197</span>  @Override<a name="line.197"></a>
-<span class="sourceLineNo">198</span>  protected boolean acquireLock(final MasterProcedureEnv
env) {<a name="line.198"></a>
-<span class="sourceLineNo">199</span>    if (!env.getMasterServices().isInitialized())
{<a name="line.199"></a>
-<span class="sourceLineNo">200</span>      // Namespace manager might not be
ready if master is not fully initialized,<a name="line.200"></a>
-<span class="sourceLineNo">201</span>      // return false to reject user namespace
creation; return true for default<a name="line.201"></a>
-<span class="sourceLineNo">202</span>      // and system namespace creation (this
is part of master initialization).<a name="line.202"></a>
-<span class="sourceLineNo">203</span>      boolean isBootstrapNs = nsDescriptor.equals(NamespaceDescriptor.DEFAULT_NAMESPACE)
||<a name="line.203"></a>
-<span class="sourceLineNo">204</span>        nsDescriptor.equals(NamespaceDescriptor.SYSTEM_NAMESPACE);<a
name="line.204"></a>
-<span class="sourceLineNo">205</span><a name="line.205"></a>
-<span class="sourceLineNo">206</span>      if (!isBootstrapNs &amp;&amp;
env.waitInitialized(this)) {<a name="line.206"></a>
-<span class="sourceLineNo">207</span>        return false;<a name="line.207"></a>
-<span class="sourceLineNo">208</span>      }<a name="line.208"></a>
-<span class="sourceLineNo">209</span>    }<a name="line.209"></a>
-<span class="sourceLineNo">210</span>    return env.getProcedureQueue().tryAcquireNamespaceExclusiveLock(this,
getNamespaceName());<a name="line.210"></a>
-<span class="sourceLineNo">211</span>  }<a name="line.211"></a>
-<span class="sourceLineNo">212</span><a name="line.212"></a>
-<span class="sourceLineNo">213</span>  @Override<a name="line.213"></a>
-<span class="sourceLineNo">214</span>  protected void releaseLock(final MasterProcedureEnv
env) {<a name="line.214"></a>
-<span class="sourceLineNo">215</span>    env.getProcedureQueue().releaseNamespaceExclusiveLock(this,
getNamespaceName());<a name="line.215"></a>
-<span class="sourceLineNo">216</span>  }<a name="line.216"></a>
-<span class="sourceLineNo">217</span><a name="line.217"></a>
-<span class="sourceLineNo">218</span>  @Override<a name="line.218"></a>
-<span class="sourceLineNo">219</span>  public TableName getTableName() {<a
name="line.219"></a>
-<span class="sourceLineNo">220</span>    return TableName.NAMESPACE_TABLE_NAME;<a
name="line.220"></a>
-<span class="sourceLineNo">221</span>  }<a name="line.221"></a>
-<span class="sourceLineNo">222</span><a name="line.222"></a>
-<span class="sourceLineNo">223</span>  @Override<a name="line.223"></a>
-<span class="sourceLineNo">224</span>  public TableOperationType getTableOperationType()
{<a name="line.224"></a>
-<span class="sourceLineNo">225</span>    return TableOperationType.EDIT;<a
name="line.225"></a>
-<span class="sourceLineNo">226</span>  }<a name="line.226"></a>
-<span class="sourceLineNo">227</span><a name="line.227"></a>
-<span class="sourceLineNo">228</span>  private String getNamespaceName() {<a
name="line.228"></a>
-<span class="sourceLineNo">229</span>    return nsDescriptor.getName();<a
name="line.229"></a>
-<span class="sourceLineNo">230</span>  }<a name="line.230"></a>
-<span class="sourceLineNo">231</span><a name="line.231"></a>
-<span class="sourceLineNo">232</span>  /**<a name="line.232"></a>
-<span class="sourceLineNo">233</span>   * Action before any real action of creating
namespace.<a name="line.233"></a>
-<span class="sourceLineNo">234</span>   * @param env MasterProcedureEnv<a
name="line.234"></a>
-<span class="sourceLineNo">235</span>   * @throws IOException<a name="line.235"></a>
-<span class="sourceLineNo">236</span>   */<a name="line.236"></a>
-<span class="sourceLineNo">237</span>  private void prepareCreate(final MasterProcedureEnv
env) throws IOException {<a name="line.237"></a>
-<span class="sourceLineNo">238</span>    if (getTableNamespaceManager(env).doesNamespaceExist(nsDescriptor.getName()))
{<a name="line.238"></a>
-<span class="sourceLineNo">239</span>      throw new NamespaceExistException(nsDescriptor.getName());<a
name="line.239"></a>
-<span class="sourceLineNo">240</span>    }<a name="line.240"></a>
-<span class="sourceLineNo">241</span>    getTableNamespaceManager(env).validateTableAndRegionCount(nsDescriptor);<a
name="line.241"></a>
-<span class="sourceLineNo">242</span>  }<a name="line.242"></a>
-<span class="sourceLineNo">243</span><a name="line.243"></a>
-<span class="sourceLineNo">244</span>  /**<a name="line.244"></a>
-<span class="sourceLineNo">245</span>   * Create the namespace directory<a
name="line.245"></a>
-<span class="sourceLineNo">246</span>   * @param env MasterProcedureEnv<a
name="line.246"></a>
-<span class="sourceLineNo">247</span>   * @param nsDescriptor NamespaceDescriptor<a
name="line.247"></a>
-<span class="sourceLineNo">248</span>   * @throws IOException<a name="line.248"></a>
-<span class="sourceLineNo">249</span>   */<a name="line.249"></a>
-<span class="sourceLineNo">250</span>  protected static void createDirectory(<a
name="line.250"></a>
-<span class="sourceLineNo">251</span>      final MasterProcedureEnv env,<a
name="line.251"></a>
-<span class="sourceLineNo">252</span>      final NamespaceDescriptor nsDescriptor)
throws IOException {<a name="line.252"></a>
-<span class="sourceLineNo">253</span>    MasterFileSystem mfs = env.getMasterServices().getMasterFileSystem();<a
name="line.253"></a>
-<span class="sourceLineNo">254</span>    mfs.getFileSystem().mkdirs(<a name="line.254"></a>
-<span class="sourceLineNo">255</span>      FSUtils.getNamespaceDir(mfs.getRootDir(),
nsDescriptor.getName()));<a name="line.255"></a>
-<span class="sourceLineNo">256</span>  }<a name="line.256"></a>
-<span class="sourceLineNo">257</span><a name="line.257"></a>
-<span class="sourceLineNo">258</span>  /**<a name="line.258"></a>
-<span class="sourceLineNo">259</span>   * undo create directory<a name="line.259"></a>
-<span class="sourceLineNo">260</span>   * @param env MasterProcedureEnv<a
name="line.260"></a>
-<span class="sourceLineNo">261</span>   * @throws IOException<a name="line.261"></a>
-<span class="sourceLineNo">262</span>   */<a name="line.262"></a>
-<span class="sourceLineNo">263</span>  private void rollbackCreateDirectory(final
MasterProcedureEnv env) throws IOException {<a name="line.263"></a>
-<span class="sourceLineNo">264</span>    try {<a name="line.264"></a>
-<span class="sourceLineNo">265</span>      DeleteNamespaceProcedure.deleteDirectory(env,
nsDescriptor.getName());<a name="line.265"></a>
-<span class="sourceLineNo">266</span>    } catch (Exception e) {<a name="line.266"></a>
-<span class="sourceLineNo">267</span>      // Ignore exception<a name="line.267"></a>
-<span class="sourceLineNo">268</span>      LOG.debug("Rollback of createDirectory
throws exception: " + e);<a name="line.268"></a>
-<span class="sourceLineNo">269</span>    }<a name="line.269"></a>
-<span class="sourceLineNo">270</span>  }<a name="line.270"></a>
-<span class="sourceLineNo">271</span><a name="line.271"></a>
-<span class="sourceLineNo">272</span>  /**<a name="line.272"></a>
-<span class="sourceLineNo">273</span>   * Insert the row into ns table<a name="line.273"></a>
-<span class="sourceLineNo">274</span>   * @param env MasterProcedureEnv<a
name="line.274"></a>
-<span class="sourceLineNo">275</span>   * @param nsDescriptor NamespaceDescriptor<a
name="line.275"></a>
-<span class="sourceLineNo">276</span>   * @throws IOException<a name="line.276"></a>
-<span class="sourceLineNo">277</span>   */<a name="line.277"></a>
-<span class="sourceLineNo">278</span>  protected static void insertIntoNSTable(<a
name="line.278"></a>
-<span class="sourceLineNo">279</span>      final MasterProcedureEnv env,<a
name="line.279"></a>
-<span class="sourceLineNo">280</span>      final NamespaceDescriptor nsDescriptor)
throws IOException {<a name="line.280"></a>
-<span class="sourceLineNo">281</span>    getTableNamespaceManager(env).insertIntoNSTable(nsDescriptor);<a
name="line.281"></a>
-<span class="sourceLineNo">282</span>  }<a name="line.282"></a>
-<span class="sourceLineNo">283</span><a name="line.283"></a>
-<span class="sourceLineNo">284</span>  /**<a name="line.284"></a>
-<span class="sourceLineNo">285</span>   * Undo the insert.<a name="line.285"></a>
-<span class="sourceLineNo">286</span>   * @param env MasterProcedureEnv<a
name="line.286"></a>
-<span class="sourceLineNo">287</span>   * @throws IOException<a name="line.287"></a>
-<span class="sourceLineNo">288</span>   */<a name="line.288"></a>
-<span class="sourceLineNo">289</span>  private void rollbackInsertIntoNSTable(final
MasterProcedureEnv env) throws IOException {<a name="line.289"></a>
-<span class="sourceLineNo">290</span>    try {<a name="line.290"></a>
-<span class="sourceLineNo">291</span>      DeleteNamespaceProcedure.deleteFromNSTable(env,
nsDescriptor.getName());<a name="line.291"></a>
-<span class="sourceLineNo">292</span>    } catch (Exception e) {<a name="line.292"></a>
-<span class="sourceLineNo">293</span>      // Ignore exception<a name="line.293"></a>
-<span class="sourceLineNo">294</span>      LOG.debug("Rollback of insertIntoNSTable
throws exception: " + e);<a name="line.294"></a>
-<span class="sourceLineNo">295</span>    }<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>   * Update Zookeeper.<a name="line.299"></a>
-<span class="sourceLineNo">300</span>   * @param env MasterProcedureEnv<a
name="line.300"></a>
-<span class="sourceLineNo">301</span>   * @param nsDescriptor NamespaceDescriptor<a
name="line.301"></a>
-<span class="sourceLineNo">302</span>   * @throws IOException<a name="line.302"></a>
-<span class="sourceLineNo">303</span>   */<a name="line.303"></a>
-<span class="sourceLineNo">304</span>  protected static void updateZKNamespaceManager(<a
name="line.304"></a>
-<span class="sourceLineNo">305</span>      final MasterProcedureEnv env,<a
name="line.305"></a>
-<span class="sourceLineNo">306</span>      final NamespaceDescriptor nsDescriptor)
throws IOException {<a name="line.306"></a>
-<span class="sourceLineNo">307</span>    getTableNamespaceManager(env).updateZKNamespaceManager(nsDescriptor);<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>   * rollback Zookeeper update.<a name="line.311"></a>
-<span class="sourceLineNo">312</span>   * @param env MasterProcedureEnv<a
name="line.312"></a>
-<span class="sourceLineNo">313</span>   * @throws IOException<a name="line.313"></a>
-<span class="sourceLineNo">314</span>   */<a name="line.314"></a>
-<span class="sourceLineNo">315</span>  private void rollbackZKNamespaceManagerChange(final
MasterProcedureEnv env) throws IOException {<a name="line.315"></a>
-<span class="sourceLineNo">316</span>    try {<a name="line.316"></a>
-<span class="sourceLineNo">317</span>      DeleteNamespaceProcedure.removeFromZKNamespaceManager(env,
nsDescriptor.getName());<a name="line.317"></a>
-<span class="sourceLineNo">318</span>    } catch (Exception e) {<a name="line.318"></a>
-<span class="sourceLineNo">319</span>      // Ignore exception<a name="line.319"></a>
-<span class="sourceLineNo">320</span>      LOG.debug("Rollback of updateZKNamespaceManager
throws exception: " + e);<a name="line.320"></a>
-<span class="sourceLineNo">321</span>    }<a name="line.321"></a>
-<span class="sourceLineNo">322</span>  }<a name="line.322"></a>
-<span class="sourceLineNo">323</span><a name="line.323"></a>
-<span class="sourceLineNo">324</span>  /**<a name="line.324"></a>
-<span class="sourceLineNo">325</span>   * Set quota for the namespace<a name="line.325"></a>
-<span class="sourceLineNo">326</span>   * @param env MasterProcedureEnv<a
name="line.326"></a>
-<span class="sourceLineNo">327</span>   * @param nsDescriptor NamespaceDescriptor<a
name="line.327"></a>
-<span class="sourceLineNo">328</span>   * @throws IOException<a name="line.328"></a>
-<span class="sourceLineNo">329</span>   **/<a name="line.329"></a>
-<span class="sourceLineNo">330</span>  protected static void setNamespaceQuota(<a
name="line.330"></a>
-<span class="sourceLineNo">331</span>      final MasterProcedureEnv env,<a
name="line.331"></a>
-<span class="sourceLineNo">332</span>      final NamespaceDescriptor nsDescriptor)
throws IOException {<a name="line.332"></a>
-<span class="sourceLineNo">333</span>    if (env.getMasterServices().isInitialized())
{<a name="line.333"></a>
-<span class="sourceLineNo">334</span>      env.getMasterServices().getMasterQuotaManager().setNamespaceQuota(nsDescriptor);<a
name="line.334"></a>
-<span class="sourceLineNo">335</span>    }<a name="line.335"></a>
-<span class="sourceLineNo">336</span>  }<a name="line.336"></a>
-<span class="sourceLineNo">337</span><a name="line.337"></a>
-<span class="sourceLineNo">338</span>  /**<a name="line.338"></a>
-<span class="sourceLineNo">339</span>   * remove quota for the namespace if exists<a
name="line.339"></a>
-<span class="sourceLineNo">340</span>   * @param env MasterProcedureEnv<a
name="line.340"></a>
-<span class="sourceLineNo">341</span>   * @throws IOException<a name="line.341"></a>
-<span class="sourceLineNo">342</span>   **/<a name="line.342"></a>
-<span class="sourceLineNo">343</span>  private void rollbackSetNamespaceQuota(final
MasterProcedureEnv env) throws IOException {<a name="line.343"></a>
-<span class="sourceLineNo">344</span>    try {<a name="line.344"></a>
-<span class="sourceLineNo">345</span>      DeleteNamespaceProcedure.removeNamespaceQuota(env,
nsDescriptor.getName());<a name="line.345"></a>
-<span class="sourceLineNo">346</span>    } catch (Exception e) {<a name="line.346"></a>
-<span class="sourceLineNo">347</span>      // Ignore exception<a name="line.347"></a>
-<span class="sourceLineNo">348</span>      LOG.debug("Rollback of setNamespaceQuota
throws exception: " + e);<a name="line.348"></a>
-<span class="sourceLineNo">349</span>    }<a name="line.349"></a>
-<span class="sourceLineNo">350</span>  }<a name="line.350"></a>
-<span class="sourceLineNo">351</span><a name="line.351"></a>
-<span class="sourceLineNo">352</span>  private static TableNamespaceManager getTableNamespaceManager(final
MasterProcedureEnv env) {<a name="line.352"></a>
-<span class="sourceLineNo">353</span>    return env.getMasterServices().getClusterSchema().getTableNamespaceManager();<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>  /**<a name="line.356"></a>
-<span class="sourceLineNo">357</span>   * The procedure could be restarted from
a different machine. If the variable is null, we need to<a name="line.357"></a>
-<span class="sourceLineNo">358</span>   * retrieve it.<a name="line.358"></a>
-<span class="sourceLineNo">359</span>   * @return traceEnabled<a name="line.359"></a>
-<span class="sourceLineNo">360</span>   */<a name="line.360"></a>
-<span class="sourceLineNo">361</span>  private Boolean isTraceEnabled() {<a
name="line.361"></a>
-<span class="sourceLineNo">362</span>    if (traceEnabled == null) {<a name="line.362"></a>
-<span class="sourceLineNo">363</span>      traceEnabled = LOG.isTraceEnabled();<a
name="line.363"></a>
-<span class="sourceLineNo">364</span>    }<a name="line.364"></a>
-<span class="sourceLineNo">365</span>    return traceEnabled;<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">197</span>  private boolean isBootstrapNamespace()
{<a name="line.197"></a>
+<span class="sourceLineNo">198</span>    return nsDescriptor.equals(NamespaceDescriptor.DEFAULT_NAMESPACE)
||<a name="line.198"></a>
+<span class="sourceLineNo">199</span>        nsDescriptor.equals(NamespaceDescriptor.SYSTEM_NAMESPACE);<a
name="line.199"></a>
+<span class="sourceLineNo">200</span>  }<a name="line.200"></a>
+<span class="sourceLineNo">201</span><a name="line.201"></a>
+<span class="sourceLineNo">202</span>  @Override<a name="line.202"></a>
+<span class="sourceLineNo">203</span>  protected boolean acquireLock(final MasterProcedureEnv
env) {<a name="line.203"></a>
+<span class="sourceLineNo">204</span>    if (!env.getMasterServices().isInitialized())
{<a name="line.204"></a>
+<span class="sourceLineNo">205</span>      // Namespace manager might not be
ready if master is not fully initialized,<a name="line.205"></a>
+<span class="sourceLineNo">206</span>      // return false to reject user namespace
creation; return true for default<a name="line.206"></a>
+<span class="sourceLineNo">207</span>      // and system namespace creation (this
is part of master initialization).<a name="line.207"></a>
+<span class="sourceLineNo">208</span>      if (!isBootstrapNamespace() &amp;&amp;
env.waitInitialized(this)) {<a name="line.208"></a>
+<span class="sourceLineNo">209</span>        return false;<a name="line.209"></a>
+<span class="sourceLineNo">210</span>      }<a name="line.210"></a>
+<span class="sourceLineNo">211</span>    }<a name="line.211"></a>
+<span class="sourceLineNo">212</span>    return env.getProcedureQueue().tryAcquireNamespaceExclusiveLock(this,
getNamespaceName());<a name="line.212"></a>
+<span class="sourceLineNo">213</span>  }<a name="line.213"></a>
+<span class="sourceLineNo">214</span><a name="line.214"></a>
+<span class="sourceLineNo">215</span>  @Override<a name="line.215"></a>
+<span class="sourceLineNo">216</span>  protected void releaseLock(final MasterProcedureEnv
env) {<a name="line.216"></a>
+<span class="sourceLineNo">217</span>    env.getProcedureQueue().releaseNamespaceExclusiveLock(this,
getNamespaceName());<a name="line.217"></a>
+<span class="sourceLineNo">218</span>  }<a name="line.218"></a>
+<span class="sourceLineNo">219</span><a name="line.219"></a>
+<span class="sourceLineNo">220</span>  @Override<a name="line.220"></a>
+<span class="sourceLineNo">221</span>  public TableName getTableName() {<a
name="line.221"></a>
+<span class="sourceLineNo">222</span>    return TableName.NAMESPACE_TABLE_NAME;<a
name="line.222"></a>
+<span class="sourceLineNo">223</span>  }<a name="line.223"></a>
+<span class="sourceLineNo">224</span><a name="line.224"></a>
+<span class="sourceLineNo">225</span>  @Override<a name="line.225"></a>
+<span class="sourceLineNo">226</span>  public TableOperationType getTableOperationType()
{<a name="line.226"></a>
+<span class="sourceLineNo">227</span>    return TableOperationType.EDIT;<a
name="line.227"></a>
+<span class="sourceLineNo">228</span>  }<a name="line.228"></a>
+<span class="sourceLineNo">229</span><a name="line.229"></a>
+<span class="sourceLineNo">230</span>  private String getNamespaceName() {<a
name="line.230"></a>
+<span class="sourceLineNo">231</span>    return nsDescriptor.getName();<a
name="line.231"></a>
+<span class="sourceLineNo">232</span>  }<a name="line.232"></a>
+<span class="sourceLineNo">233</span><a name="line.233"></a>
+<span class="sourceLineNo">234</span>  /**<a name="line.234"></a>
+<span class="sourceLineNo">235</span>   * Action before any real action of creating
namespace.<a name="line.235"></a>
+<span class="sourceLineNo">236</span>   * @param env MasterProcedureEnv<a
name="line.236"></a>
+<span class="sourceLineNo">237</span>   * @throws IOException<a name="line.237"></a>
+<span class="sourceLineNo">238</span>   */<a name="line.238"></a>
+<span class="sourceLineNo">239</span>  private void prepareCreate(final MasterProcedureEnv
env) throws IOException {<a name="line.239"></a>
+<span class="sourceLineNo">240</span>    if (getTableNamespaceManager(env).doesNamespaceExist(nsDescriptor.getName()))
{<a name="line.240"></a>
+<span class="sourceLineNo">241</span>      throw new NamespaceExistException(nsDescriptor.getName());<a
name="line.241"></a>
+<span class="sourceLineNo">242</span>    }<a name="line.242"></a>
+<span class="sourceLineNo">243</span>    getTableNamespaceManager(env).validateTableAndRegionCount(nsDescriptor);<a
name="line.243"></a>
+<span class="sourceLineNo">244</span>  }<a name="line.244"></a>
+<span class="sourceLineNo">245</span><a name="line.245"></a>
+<span class="sourceLineNo">246</span>  /**<a name="line.246"></a>
+<span class="sourceLineNo">247</span>   * Create the namespace directory<a
name="line.247"></a>
+<span class="sourceLineNo">248</span>   * @param env MasterProcedureEnv<a
name="line.248"></a>
+<span class="sourceLineNo">249</span>   * @param nsDescriptor NamespaceDescriptor<a
name="line.249"></a>
+<span class="sourceLineNo">250</span>   * @throws IOException<a name="line.250"></a>
+<span class="sourceLineNo">251</span>   */<a name="line.251"></a>
+<span class="sourceLineNo">252</span>  protected static void createDirectory(<a
name="line.252"></a>
+<span class="sourceLineNo">253</span>      final MasterProcedureEnv env,<a
name="line.253"></a>
+<span class="sourceLineNo">254</span>      final NamespaceDescriptor nsDescriptor)
throws IOException {<a name="line.254"></a>
+<span class="sourceLineNo">255</span>    MasterFileSystem mfs = env.getMasterServices().getMasterFileSystem();<a
name="line.255"></a>
+<span class="sourceLineNo">256</span>    mfs.getFileSystem().mkdirs(<a name="line.256"></a>
+<span class="sourceLineNo">257</span>      FSUtils.getNamespaceDir(mfs.getRootDir(),
nsDescriptor.getName()));<a name="line.257"></a>
+<span class="sourceLineNo">258</span>  }<a name="line.258"></a>
+<span class="sourceLineNo">259</span><a name="line.259"></a>
+<span class="sourceLineNo">260</span>  /**<a name="line.260"></a>
+<span class="sourceLineNo">261</span>   * undo create directory<a name="line.261"></a>
+<span class="sourceLineNo">262</span>   * @param env MasterProcedureEnv<a
name="line.262"></a>
+<span class="sourceLineNo">263</span>   * @throws IOException<a name="line.263"></a>
+<span class="sourceLineNo">264</span>   */<a name="line.264"></a>
+<span class="sourceLineNo">265</span>  private void rollbackCreateDirectory(final
MasterProcedureEnv env) throws IOException {<a name="line.265"></a>
+<span class="sourceLineNo">266</span>    try {<a name="line.266"></a>
+<span class="sourceLineNo">267</span>      DeleteNamespaceProcedure.deleteDirectory(env,
nsDescriptor.getName());<a name="line.267"></a>
+<span class="sourceLineNo">268</span>    } catch (Exception e) {<a name="line.268"></a>
+<span class="sourceLineNo">269</span>      // Ignore exception<a name="line.269"></a>
+<span class="sourceLineNo">270</span>      LOG.debug("Rollback of createDirectory
throws exception: " + e);<a name="line.270"></a>
+<span class="sourceLineNo">271</span>    }<a name="line.271"></a>
+<span class="sourceLineNo">272</span>  }<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>   * Insert the row into ns table<a name="line.275"></a>
+<span class="sourceLineNo">276</span>   * @param env MasterProcedureEnv<a
name="line.276"></a>
+<span class="sourceLineNo">277</span>   * @param nsDescriptor NamespaceDescriptor<a
name="line.277"></a>
+<span class="sourceLineNo">278</span>   * @throws IOException<a name="line.278"></a>
+<span class="sourceLineNo">279</span>   */<a name="line.279"></a>
+<span class="sourceLineNo">280</span>  protected static void insertIntoNSTable(<a
name="line.280"></a>
+<span class="sourceLineNo">281</span>      final MasterProcedureEnv env,<a
name="line.281"></a>
+<span class="sourceLineNo">282</span>      final NamespaceDescriptor nsDescriptor)
throws IOException {<a name="line.282"></a>
+<span class="sourceLineNo">283</span>    getTableNamespaceManager(env).insertIntoNSTable(nsDescriptor);<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>  /**<a name="line.286"></a>
+<span class="sourceLineNo">287</span>   * Undo the insert.<a name="line.287"></a>
+<span class="sourceLineNo">288</span>   * @param env MasterProcedureEnv<a
name="line.288"></a>
+<span class="sourceLineNo">289</span>   * @throws IOException<a name="line.289"></a>
+<span class="sourceLineNo">290</span>   */<a name="line.290"></a>
+<span class="sourceLineNo">291</span>  private void rollbackInsertIntoNSTable(final
MasterProcedureEnv env) throws IOException {<a name="line.291"></a>
+<span class="sourceLineNo">292</span>    try {<a name="line.292"></a>
+<span class="sourceLineNo">293</span>      DeleteNamespaceProcedure.deleteFromNSTable(env,
nsDescriptor.getName());<a name="line.293"></a>
+<span class="sourceLineNo">294</span>    } catch (Exception e) {<a name="line.294"></a>
+<span class="sourceLineNo">295</span>      // Ignore exception<a name="line.295"></a>
+<span class="sourceLineNo">296</span>      LOG.debug("Rollback of insertIntoNSTable
throws exception: " + e);<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>  /**<a name="line.300"></a>
+<span class="sourceLineNo">301</span>   * Update Zookeeper.<a name="line.301"></a>
+<span class="sourceLineNo">302</span>   * @param env MasterProcedureEnv<a
name="line.302"></a>
+<span class="sourceLineNo">303</span>   * @param nsDescriptor NamespaceDescriptor<a
name="line.303"></a>
+<span class="sourceLineNo">304</span>   * @throws IOException<a name="line.304"></a>
+<span class="sourceLineNo">305</span>   */<a name="line.305"></a>
+<span class="sourceLineNo">306</span>  protected static void updateZKNamespaceManager(<a
name="line.306"></a>
+<span class="sourceLineNo">307</span>      final MasterProcedureEnv env,<a
name="line.307"></a>
+<span class="sourceLineNo">308</span>      final NamespaceDescriptor nsDescriptor)
throws IOException {<a name="line.308"></a>
+<span class="sourceLineNo">309</span>    getTableNamespaceManager(env).updateZKNamespaceManager(nsDescriptor);<a
name="line.309"></a>
+<span class="sourceLineNo">310</span>  }<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>   * rollback Zookeeper update.<a name="line.313"></a>
+<span class="sourceLineNo">314</span>   * @param env MasterProcedureEnv<a
name="line.314"></a>
+<span class="sourceLineNo">315</span>   * @throws IOException<a name="line.315"></a>
+<span class="sourceLineNo">316</span>   */<a name="line.316"></a>
+<span class="sourceLineNo">317</span>  private void rollbackZKNamespaceManagerChange(final
MasterProcedureEnv env) throws IOException {<a name="line.317"></a>
+<span class="sourceLineNo">318</span>    try {<a name="line.318"></a>
+<span class="sourceLineNo">319</span>      DeleteNamespaceProcedure.removeFromZKNamespaceManager(env,
nsDescriptor.getName());<a name="line.319"></a>
+<span class="sourceLineNo">320</span>    } catch (Exception e) {<a name="line.320"></a>
+<span class="sourceLineNo">321</span>      // Ignore exception<a name="line.321"></a>
+<span class="sourceLineNo">322</span>      LOG.debug("Rollback of updateZKNamespaceManager
throws exception: " + e);<a name="line.322"></a>
+<span class="sourceLineNo">323</span>    }<a name="line.323"></a>
+<span class="sourceLineNo">324</span>  }<a name="line.324"></a>
+<span class="sourceLineNo">325</span><a name="line.325"></a>
+<span class="sourceLineNo">326</span>  /**<a name="line.326"></a>
+<span class="sourceLineNo">327</span>   * Set quota for the namespace<a name="line.327"></a>
+<span class="sourceLineNo">328</span>   * @param env MasterProcedureEnv<a
name="line.328"></a>
+<span class="sourceLineNo">329</span>   * @param nsDescriptor NamespaceDescriptor<a
name="line.329"></a>
+<span class="sourceLineNo">330</span>   * @throws IOException<a name="line.330"></a>
+<span class="sourceLineNo">331</span>   **/<a name="line.331"></a>
+<span class="sourceLineNo">332</span>  protected static void setNamespaceQuota(<a
name="line.332"></a>
+<span class="sourceLineNo">333</span>      final MasterProcedureEnv env,<a
name="line.333"></a>
+<span class="sourceLineNo">334</span>      final NamespaceDescriptor nsDescriptor)
throws IOException {<a name="line.334"></a>
+<span class="sourceLineNo">335</span>    if (env.getMasterServices().isInitialized())
{<a name="line.335"></a>
+<span class="sourceLineNo">336</span>      env.getMasterServices().getMasterQuotaManager().setNamespaceQuota(nsDescriptor);<a
name="line.336"></a>
+<span class="sourceLineNo">337</span>    }<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>  /**<a name="line.340"></a>
+<span class="sourceLineNo">341</span>   * remove quota for the namespace if exists<a
name="line.341"></a>
+<span class="sourceLineNo">342</span>   * @param env MasterProcedureEnv<a
name="line.342"></a>
+<span class="sourceLineNo">343</span>   * @throws IOException<a name="line.343"></a>
+<span class="sourceLineNo">344</span>   **/<a name="line.344"></a>
+<span class="sourceLineNo">345</span>  private void rollbackSetNamespaceQuota(final
MasterProcedureEnv env) throws IOException {<a name="line.345"></a>
+<span class="sourceLineNo">346</span>    try {<a name="line.346"></a>
+<span class="sourceLineNo">347</span>      DeleteNamespaceProcedure.removeNamespaceQuota(env,
nsDescriptor.getName());<a name="line.347"></a>
+<span class="sourceLineNo">348</span>    } catch (Exception e) {<a name="line.348"></a>
+<span class="sourceLineNo">349</span>      // Ignore exception<a name="line.349"></a>
+<span class="sourceLineNo">350</span>      LOG.debug("Rollback of setNamespaceQuota
throws exception: " + e);<a name="line.350"></a>
+<span class="sourceLineNo">351</span>    }<a name="line.351"></a>
+<span class="sourceLineNo">352</span>  }<a name="line.352"></a>
+<span class="sourceLineNo">353</span><a name="line.353"></a>
+<span class="sourceLineNo">354</span>  private static TableNamespaceManager getTableNamespaceManager(final
MasterProcedureEnv env) {<a name="line.354"></a>
+<span class="sourceLineNo">355</span>    return env.getMasterServices().getClusterSchema().getTableNamespaceManager();<a
name="line.355"></a>
+<span class="sourceLineNo">356</span>  }<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>   * The procedure could be restarted from
a different machine. If the variable is null, we need to<a name="line.359"></a>
+<span class="sourceLineNo">360</span>   * retrieve it.<a name="line.360"></a>
+<span class="sourceLineNo">361</span>   * @return traceEnabled<a name="line.361"></a>
+<span class="sourceLineNo">362</span>   */<a name="line.362"></a>
+<span class="sourceLineNo">363</span>  private Boolean isTraceEnabled() {<a
name="line.363"></a>
+<span class="sourceLineNo">364</span>    if (traceEnabled == null) {<a name="line.364"></a>
+<span class="sourceLineNo">365</span>      traceEnabled = LOG.isTraceEnabled();<a
name="line.365"></a>
+<span class="sourceLineNo">366</span>    }<a name="line.366"></a>
+<span class="sourceLineNo">367</span>    return traceEnabled;<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>  @Override<a name="line.370"></a>
+<span class="sourceLineNo">371</span>  protected boolean shouldWaitClientAck(MasterProcedureEnv
env) {<a name="line.371"></a>
+<span class="sourceLineNo">372</span>    // hbase and default namespaces are
created on bootstrap internally by the system<a name="line.372"></a>
+<span class="sourceLineNo">373</span>    // the client does not know about this
procedures.<a name="line.373"></a>
+<span class="sourceLineNo">374</span>    return !isBootstrapNamespace();<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>
 
 
 

http://git-wip-us.apache.org/repos/asf/hbase-site/blob/5eb82203/devapidocs/src-html/org/apache/hadoop/hbase/master/procedure/CreateTableProcedure.CreateHdfsRegions.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/master/procedure/CreateTableProcedure.CreateHdfsRegions.html
b/devapidocs/src-html/org/apache/hadoop/hbase/master/procedure/CreateTableProcedure.CreateHdfsRegions.html
index 9a4831f..e4170bb 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/master/procedure/CreateTableProcedure.CreateHdfsRegions.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/master/procedure/CreateTableProcedure.CreateHdfsRegions.html
@@ -456,7 +456,14 @@
 <span class="sourceLineNo">448</span>      final TableName tableName) throws
IOException {<a name="line.448"></a>
 <span class="sourceLineNo">449</span>    env.getMasterServices().getTableDescriptors().get(tableName);<a
name="line.449"></a>
 <span class="sourceLineNo">450</span>  }<a name="line.450"></a>
-<span class="sourceLineNo">451</span>}<a name="line.451"></a>
+<span class="sourceLineNo">451</span><a name="line.451"></a>
+<span class="sourceLineNo">452</span>  @Override<a name="line.452"></a>
+<span class="sourceLineNo">453</span>  protected boolean shouldWaitClientAck(MasterProcedureEnv
env) {<a name="line.453"></a>
+<span class="sourceLineNo">454</span>    // system tables are created on bootstrap
internally by the system<a name="line.454"></a>
+<span class="sourceLineNo">455</span>    // the client does not know about this
procedures.<a name="line.455"></a>
+<span class="sourceLineNo">456</span>    return !getTableName().isSystemTable();<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>
 
 
 

http://git-wip-us.apache.org/repos/asf/hbase-site/blob/5eb82203/devapidocs/src-html/org/apache/hadoop/hbase/master/procedure/CreateTableProcedure.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/master/procedure/CreateTableProcedure.html
b/devapidocs/src-html/org/apache/hadoop/hbase/master/procedure/CreateTableProcedure.html
index 9a4831f..e4170bb 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/master/procedure/CreateTableProcedure.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/master/procedure/CreateTableProcedure.html
@@ -456,7 +456,14 @@
 <span class="sourceLineNo">448</span>      final TableName tableName) throws
IOException {<a name="line.448"></a>
 <span class="sourceLineNo">449</span>    env.getMasterServices().getTableDescriptors().get(tableName);<a
name="line.449"></a>
 <span class="sourceLineNo">450</span>  }<a name="line.450"></a>
-<span class="sourceLineNo">451</span>}<a name="line.451"></a>
+<span class="sourceLineNo">451</span><a name="line.451"></a>
+<span class="sourceLineNo">452</span>  @Override<a name="line.452"></a>
+<span class="sourceLineNo">453</span>  protected boolean shouldWaitClientAck(MasterProcedureEnv
env) {<a name="line.453"></a>
+<span class="sourceLineNo">454</span>    // system tables are created on bootstrap
internally by the system<a name="line.454"></a>
+<span class="sourceLineNo">455</span>    // the client does not know about this
procedures.<a name="line.455"></a>
+<span class="sourceLineNo">456</span>    return !getTableName().isSystemTable();<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>
 
 
 

http://git-wip-us.apache.org/repos/asf/hbase-site/blob/5eb82203/devapidocs/src-html/org/apache/hadoop/hbase/master/procedure/ServerCrashProcedure.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/master/procedure/ServerCrashProcedure.html
b/devapidocs/src-html/org/apache/hadoop/hbase/master/procedure/ServerCrashProcedure.html
index 75a0e93..11371e4 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/master/procedure/ServerCrashProcedure.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/master/procedure/ServerCrashProcedure.html
@@ -775,7 +775,14 @@
 <span class="sourceLineNo">767</span>  protected boolean isYieldBeforeExecuteFromState(MasterProcedureEnv
env, ServerCrashState state) {<a name="line.767"></a>
 <span class="sourceLineNo">768</span>    return true;<a name="line.768"></a>
 <span class="sourceLineNo">769</span>  }<a name="line.769"></a>
-<span class="sourceLineNo">770</span>}<a name="line.770"></a>
+<span class="sourceLineNo">770</span><a name="line.770"></a>
+<span class="sourceLineNo">771</span>  @Override<a name="line.771"></a>
+<span class="sourceLineNo">772</span>  protected boolean shouldWaitClientAck(MasterProcedureEnv
env) {<a name="line.772"></a>
+<span class="sourceLineNo">773</span>    // The operation is triggered internally
on the server<a name="line.773"></a>
+<span class="sourceLineNo">774</span>    // the client does not know about this
procedure.<a name="line.774"></a>
+<span class="sourceLineNo">775</span>    return false;<a name="line.775"></a>
+<span class="sourceLineNo">776</span>  }<a name="line.776"></a>
+<span class="sourceLineNo">777</span>}<a name="line.777"></a>
 
 
 


Mime
View raw message