hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From git-site-r...@apache.org
Subject [07/51] [partial] hbase-site git commit: Published site at b7b86839250bf9b295ebc1948826f43a88736d6c.
Date Mon, 05 Mar 2018 14:53:40 GMT
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/6b94a2f2/devapidocs/src-html/org/apache/hadoop/hbase/master/MasterFileSystem.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/master/MasterFileSystem.html b/devapidocs/src-html/org/apache/hadoop/hbase/master/MasterFileSystem.html
index c8098b1..019ceeb 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/master/MasterFileSystem.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/master/MasterFileSystem.html
@@ -216,245 +216,254 @@
 <span class="sourceLineNo">208</span>  /**<a name="line.208"></a>
 <span class="sourceLineNo">209</span>   * @return HBase root log dir.<a name="line.209"></a>
 <span class="sourceLineNo">210</span>   */<a name="line.210"></a>
-<span class="sourceLineNo">211</span>  public Path getWALRootDir() { return this.walRootDir; }<a name="line.211"></a>
-<span class="sourceLineNo">212</span><a name="line.212"></a>
-<span class="sourceLineNo">213</span>  /**<a name="line.213"></a>
-<span class="sourceLineNo">214</span>   * @return HBase temp dir.<a name="line.214"></a>
-<span class="sourceLineNo">215</span>   */<a name="line.215"></a>
-<span class="sourceLineNo">216</span>  public Path getTempDir() {<a name="line.216"></a>
-<span class="sourceLineNo">217</span>    return this.tempdir;<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>  /**<a name="line.220"></a>
-<span class="sourceLineNo">221</span>   * @return The unique identifier generated for this cluster<a name="line.221"></a>
-<span class="sourceLineNo">222</span>   */<a name="line.222"></a>
-<span class="sourceLineNo">223</span>  public ClusterId getClusterId() {<a name="line.223"></a>
-<span class="sourceLineNo">224</span>    return clusterId;<a name="line.224"></a>
-<span class="sourceLineNo">225</span>  }<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>   * Get the rootdir.  Make sure its wholesome and exists before returning.<a name="line.228"></a>
-<span class="sourceLineNo">229</span>   * @param rd<a name="line.229"></a>
-<span class="sourceLineNo">230</span>   * @param c<a name="line.230"></a>
-<span class="sourceLineNo">231</span>   * @param fs<a name="line.231"></a>
-<span class="sourceLineNo">232</span>   * @return hbase.rootdir (after checks for existence and bootstrapping if<a name="line.232"></a>
-<span class="sourceLineNo">233</span>   * needed populating the directory with necessary bootup files).<a name="line.233"></a>
-<span class="sourceLineNo">234</span>   * @throws IOException<a name="line.234"></a>
-<span class="sourceLineNo">235</span>   */<a name="line.235"></a>
-<span class="sourceLineNo">236</span>  private Path checkRootDir(final Path rd, final Configuration c, final FileSystem fs)<a name="line.236"></a>
-<span class="sourceLineNo">237</span>      throws IOException {<a name="line.237"></a>
-<span class="sourceLineNo">238</span>    // If FS is in safe mode wait till out of it.<a name="line.238"></a>
-<span class="sourceLineNo">239</span>    FSUtils.waitOnSafeMode(c, c.getInt(HConstants.THREAD_WAKE_FREQUENCY, 10 * 1000));<a name="line.239"></a>
-<span class="sourceLineNo">240</span><a name="line.240"></a>
-<span class="sourceLineNo">241</span>    // Filesystem is good. Go ahead and check for hbase.rootdir.<a name="line.241"></a>
-<span class="sourceLineNo">242</span>    try {<a name="line.242"></a>
-<span class="sourceLineNo">243</span>      if (!fs.exists(rd)) {<a name="line.243"></a>
-<span class="sourceLineNo">244</span>        fs.mkdirs(rd);<a name="line.244"></a>
-<span class="sourceLineNo">245</span>        // DFS leaves safe mode with 0 DNs when there are 0 blocks.<a name="line.245"></a>
-<span class="sourceLineNo">246</span>        // We used to handle this by checking the current DN count and waiting until<a name="line.246"></a>
-<span class="sourceLineNo">247</span>        // it is nonzero. With security, the check for datanode count doesn't work --<a name="line.247"></a>
-<span class="sourceLineNo">248</span>        // it is a privileged op. So instead we adopt the strategy of the jobtracker<a name="line.248"></a>
-<span class="sourceLineNo">249</span>        // and simply retry file creation during bootstrap indefinitely. As soon as<a name="line.249"></a>
-<span class="sourceLineNo">250</span>        // there is one datanode it will succeed. Permission problems should have<a name="line.250"></a>
-<span class="sourceLineNo">251</span>        // already been caught by mkdirs above.<a name="line.251"></a>
-<span class="sourceLineNo">252</span>        FSUtils.setVersion(fs, rd, c.getInt(HConstants.THREAD_WAKE_FREQUENCY,<a name="line.252"></a>
-<span class="sourceLineNo">253</span>          10 * 1000), c.getInt(HConstants.VERSION_FILE_WRITE_ATTEMPTS,<a name="line.253"></a>
-<span class="sourceLineNo">254</span>            HConstants.DEFAULT_VERSION_FILE_WRITE_ATTEMPTS));<a name="line.254"></a>
-<span class="sourceLineNo">255</span>      } else {<a name="line.255"></a>
-<span class="sourceLineNo">256</span>        if (!fs.isDirectory(rd)) {<a name="line.256"></a>
-<span class="sourceLineNo">257</span>          throw new IllegalArgumentException(rd.toString() + " is not a directory");<a name="line.257"></a>
-<span class="sourceLineNo">258</span>        }<a name="line.258"></a>
-<span class="sourceLineNo">259</span>        // as above<a name="line.259"></a>
-<span class="sourceLineNo">260</span>        FSUtils.checkVersion(fs, rd, true, c.getInt(HConstants.THREAD_WAKE_FREQUENCY,<a name="line.260"></a>
-<span class="sourceLineNo">261</span>          10 * 1000), c.getInt(HConstants.VERSION_FILE_WRITE_ATTEMPTS,<a name="line.261"></a>
-<span class="sourceLineNo">262</span>            HConstants.DEFAULT_VERSION_FILE_WRITE_ATTEMPTS));<a name="line.262"></a>
-<span class="sourceLineNo">263</span>      }<a name="line.263"></a>
-<span class="sourceLineNo">264</span>    } catch (DeserializationException de) {<a name="line.264"></a>
-<span class="sourceLineNo">265</span>      LOG.error(HBaseMarkers.FATAL, "Please fix invalid configuration for "<a name="line.265"></a>
-<span class="sourceLineNo">266</span>        + HConstants.HBASE_DIR, de);<a name="line.266"></a>
-<span class="sourceLineNo">267</span>      IOException ioe = new IOException();<a name="line.267"></a>
-<span class="sourceLineNo">268</span>      ioe.initCause(de);<a name="line.268"></a>
-<span class="sourceLineNo">269</span>      throw ioe;<a name="line.269"></a>
-<span class="sourceLineNo">270</span>    } catch (IllegalArgumentException iae) {<a name="line.270"></a>
-<span class="sourceLineNo">271</span>      LOG.error(HBaseMarkers.FATAL, "Please fix invalid configuration for "<a name="line.271"></a>
-<span class="sourceLineNo">272</span>        + HConstants.HBASE_DIR + " " + rd.toString(), iae);<a name="line.272"></a>
-<span class="sourceLineNo">273</span>      throw iae;<a name="line.273"></a>
-<span class="sourceLineNo">274</span>    }<a name="line.274"></a>
-<span class="sourceLineNo">275</span>    // Make sure cluster ID exists<a name="line.275"></a>
-<span class="sourceLineNo">276</span>    if (!FSUtils.checkClusterIdExists(fs, rd, c.getInt(<a name="line.276"></a>
-<span class="sourceLineNo">277</span>        HConstants.THREAD_WAKE_FREQUENCY, 10 * 1000))) {<a name="line.277"></a>
-<span class="sourceLineNo">278</span>      FSUtils.setClusterId(fs, rd, new ClusterId(), c.getInt(HConstants.THREAD_WAKE_FREQUENCY, 10 * 1000));<a name="line.278"></a>
-<span class="sourceLineNo">279</span>    }<a name="line.279"></a>
-<span class="sourceLineNo">280</span>    clusterId = FSUtils.getClusterId(fs, rd);<a name="line.280"></a>
-<span class="sourceLineNo">281</span><a name="line.281"></a>
-<span class="sourceLineNo">282</span>    // Make sure the meta region directory exists!<a name="line.282"></a>
-<span class="sourceLineNo">283</span>    if (!FSUtils.metaRegionExists(fs, rd)) {<a name="line.283"></a>
-<span class="sourceLineNo">284</span>      bootstrap(rd, c);<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>    // Create tableinfo-s for hbase:meta if not already there.<a name="line.287"></a>
-<span class="sourceLineNo">288</span>    // assume, created table descriptor is for enabling table<a name="line.288"></a>
-<span class="sourceLineNo">289</span>    // meta table is a system table, so descriptors are predefined,<a name="line.289"></a>
-<span class="sourceLineNo">290</span>    // we should get them from registry.<a name="line.290"></a>
-<span class="sourceLineNo">291</span>    FSTableDescriptors fsd = new FSTableDescriptors(c, fs, rd);<a name="line.291"></a>
-<span class="sourceLineNo">292</span>    fsd.createTableDescriptor(fsd.get(TableName.META_TABLE_NAME));<a name="line.292"></a>
-<span class="sourceLineNo">293</span><a name="line.293"></a>
-<span class="sourceLineNo">294</span>    return rd;<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>   * Make sure the hbase temp directory exists and is empty.<a name="line.298"></a>
-<span class="sourceLineNo">299</span>   * NOTE that this method is only executed once just after the master becomes the active one.<a name="line.299"></a>
-<span class="sourceLineNo">300</span>   */<a name="line.300"></a>
-<span class="sourceLineNo">301</span>  private void checkTempDir(final Path tmpdir, final Configuration c, final FileSystem fs)<a name="line.301"></a>
-<span class="sourceLineNo">302</span>      throws IOException {<a name="line.302"></a>
-<span class="sourceLineNo">303</span>    // If the temp directory exists, clear the content (left over, from the previous run)<a name="line.303"></a>
-<span class="sourceLineNo">304</span>    if (fs.exists(tmpdir)) {<a name="line.304"></a>
-<span class="sourceLineNo">305</span>      // Archive table in temp, maybe left over from failed deletion,<a name="line.305"></a>
-<span class="sourceLineNo">306</span>      // if not the cleaner will take care of them.<a name="line.306"></a>
-<span class="sourceLineNo">307</span>      for (Path tabledir: FSUtils.getTableDirs(fs, tmpdir)) {<a name="line.307"></a>
-<span class="sourceLineNo">308</span>        for (Path regiondir: FSUtils.getRegionDirs(fs, tabledir)) {<a name="line.308"></a>
-<span class="sourceLineNo">309</span>          HFileArchiver.archiveRegion(fs, this.rootdir, tabledir, regiondir);<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>      if (!fs.delete(tmpdir, true)) {<a name="line.312"></a>
-<span class="sourceLineNo">313</span>        throw new IOException("Unable to clean the temp directory: " + tmpdir);<a name="line.313"></a>
-<span class="sourceLineNo">314</span>      }<a name="line.314"></a>
-<span class="sourceLineNo">315</span>    }<a name="line.315"></a>
-<span class="sourceLineNo">316</span><a name="line.316"></a>
-<span class="sourceLineNo">317</span>    // Create the temp directory<a name="line.317"></a>
-<span class="sourceLineNo">318</span>    if (isSecurityEnabled) {<a name="line.318"></a>
-<span class="sourceLineNo">319</span>      if (!fs.mkdirs(tmpdir, secureRootSubDirPerms)) {<a name="line.319"></a>
-<span class="sourceLineNo">320</span>        throw new IOException("HBase temp directory '" + tmpdir + "' creation failure.");<a name="line.320"></a>
-<span class="sourceLineNo">321</span>      }<a name="line.321"></a>
-<span class="sourceLineNo">322</span>    } else {<a name="line.322"></a>
-<span class="sourceLineNo">323</span>      if (!fs.mkdirs(tmpdir)) {<a name="line.323"></a>
-<span class="sourceLineNo">324</span>        throw new IOException("HBase temp directory '" + tmpdir + "' creation failure.");<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>  }<a name="line.327"></a>
-<span class="sourceLineNo">328</span><a name="line.328"></a>
-<span class="sourceLineNo">329</span>  /**<a name="line.329"></a>
-<span class="sourceLineNo">330</span>   * Make sure the directories under rootDir have good permissions. Create if necessary.<a name="line.330"></a>
-<span class="sourceLineNo">331</span>   * @param p<a name="line.331"></a>
-<span class="sourceLineNo">332</span>   * @throws IOException<a name="line.332"></a>
-<span class="sourceLineNo">333</span>   */<a name="line.333"></a>
-<span class="sourceLineNo">334</span>  private void checkSubDir(final Path p, final String dirPermsConfName) throws IOException {<a name="line.334"></a>
-<span class="sourceLineNo">335</span>    FileSystem fs = p.getFileSystem(conf);<a name="line.335"></a>
-<span class="sourceLineNo">336</span>    FsPermission dirPerms = new FsPermission(conf.get(dirPermsConfName, "700"));<a name="line.336"></a>
-<span class="sourceLineNo">337</span>    if (!fs.exists(p)) {<a name="line.337"></a>
-<span class="sourceLineNo">338</span>      if (isSecurityEnabled) {<a name="line.338"></a>
-<span class="sourceLineNo">339</span>        if (!fs.mkdirs(p, secureRootSubDirPerms)) {<a name="line.339"></a>
-<span class="sourceLineNo">340</span>          throw new IOException("HBase directory '" + p + "' creation failure.");<a name="line.340"></a>
-<span class="sourceLineNo">341</span>        }<a name="line.341"></a>
-<span class="sourceLineNo">342</span>      } else {<a name="line.342"></a>
-<span class="sourceLineNo">343</span>        if (!fs.mkdirs(p)) {<a name="line.343"></a>
-<span class="sourceLineNo">344</span>          throw new IOException("HBase directory '" + p + "' creation failure.");<a name="line.344"></a>
-<span class="sourceLineNo">345</span>        }<a name="line.345"></a>
-<span class="sourceLineNo">346</span>      }<a name="line.346"></a>
-<span class="sourceLineNo">347</span>    }<a name="line.347"></a>
-<span class="sourceLineNo">348</span>    else {<a name="line.348"></a>
-<span class="sourceLineNo">349</span>      if (isSecurityEnabled &amp;&amp; !dirPerms.equals(fs.getFileStatus(p).getPermission())) {<a name="line.349"></a>
-<span class="sourceLineNo">350</span>        // check whether the permission match<a name="line.350"></a>
-<span class="sourceLineNo">351</span>        LOG.warn("Found HBase directory permissions NOT matching expected permissions for "<a name="line.351"></a>
-<span class="sourceLineNo">352</span>            + p.toString() + " permissions=" + fs.getFileStatus(p).getPermission()<a name="line.352"></a>
-<span class="sourceLineNo">353</span>            + ", expecting " + dirPerms + ". Automatically setting the permissions. "<a name="line.353"></a>
-<span class="sourceLineNo">354</span>            + "You can change the permissions by setting \"" + dirPermsConfName + "\" in hbase-site.xml "<a name="line.354"></a>
-<span class="sourceLineNo">355</span>            + "and restarting the master");<a name="line.355"></a>
-<span class="sourceLineNo">356</span>        fs.setPermission(p, dirPerms);<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>  }<a name="line.359"></a>
-<span class="sourceLineNo">360</span><a name="line.360"></a>
-<span class="sourceLineNo">361</span>  /**<a name="line.361"></a>
-<span class="sourceLineNo">362</span>   * Check permissions for bulk load staging directory. This directory has special hidden<a name="line.362"></a>
-<span class="sourceLineNo">363</span>   * permissions. Create it if necessary.<a name="line.363"></a>
-<span class="sourceLineNo">364</span>   * @throws IOException<a name="line.364"></a>
-<span class="sourceLineNo">365</span>   */<a name="line.365"></a>
-<span class="sourceLineNo">366</span>  private void checkStagingDir() throws IOException {<a name="line.366"></a>
-<span class="sourceLineNo">367</span>    Path p = new Path(this.rootdir, HConstants.BULKLOAD_STAGING_DIR_NAME);<a name="line.367"></a>
-<span class="sourceLineNo">368</span>    try {<a name="line.368"></a>
-<span class="sourceLineNo">369</span>      if (!this.fs.exists(p)) {<a name="line.369"></a>
-<span class="sourceLineNo">370</span>        if (!this.fs.mkdirs(p, HiddenDirPerms)) {<a name="line.370"></a>
-<span class="sourceLineNo">371</span>          throw new IOException("Failed to create staging directory " + p.toString());<a name="line.371"></a>
-<span class="sourceLineNo">372</span>        }<a name="line.372"></a>
-<span class="sourceLineNo">373</span>      } else {<a name="line.373"></a>
-<span class="sourceLineNo">374</span>        this.fs.setPermission(p, HiddenDirPerms);<a name="line.374"></a>
-<span class="sourceLineNo">375</span>      }<a name="line.375"></a>
-<span class="sourceLineNo">376</span>    } catch (IOException e) {<a name="line.376"></a>
-<span class="sourceLineNo">377</span>      LOG.error("Failed to create or set permission on staging directory " + p.toString());<a name="line.377"></a>
-<span class="sourceLineNo">378</span>      throw new IOException("Failed to create or set permission on staging directory "<a name="line.378"></a>
-<span class="sourceLineNo">379</span>          + p.toString(), e);<a name="line.379"></a>
-<span class="sourceLineNo">380</span>    }<a name="line.380"></a>
-<span class="sourceLineNo">381</span>  }<a name="line.381"></a>
-<span class="sourceLineNo">382</span><a name="line.382"></a>
-<span class="sourceLineNo">383</span>  private static void bootstrap(final Path rd, final Configuration c)<a name="line.383"></a>
-<span class="sourceLineNo">384</span>  throws IOException {<a name="line.384"></a>
-<span class="sourceLineNo">385</span>    LOG.info("BOOTSTRAP: creating hbase:meta region");<a name="line.385"></a>
-<span class="sourceLineNo">386</span>    try {<a name="line.386"></a>
-<span class="sourceLineNo">387</span>      // Bootstrapping, make sure blockcache is off.  Else, one will be<a name="line.387"></a>
-<span class="sourceLineNo">388</span>      // created here in bootstrap and it'll need to be cleaned up.  Better to<a name="line.388"></a>
-<span class="sourceLineNo">389</span>      // not make it in first place.  Turn off block caching for bootstrap.<a name="line.389"></a>
-<span class="sourceLineNo">390</span>      // Enable after.<a name="line.390"></a>
-<span class="sourceLineNo">391</span>      TableDescriptor metaDescriptor = new FSTableDescriptors(c).get(TableName.META_TABLE_NAME);<a name="line.391"></a>
-<span class="sourceLineNo">392</span>      HRegion meta = HRegion.createHRegion(RegionInfoBuilder.FIRST_META_REGIONINFO, rd,<a name="line.392"></a>
-<span class="sourceLineNo">393</span>          c, setInfoFamilyCachingForMeta(metaDescriptor, false), null);<a name="line.393"></a>
-<span class="sourceLineNo">394</span>      meta.close();<a name="line.394"></a>
-<span class="sourceLineNo">395</span>    } catch (IOException e) {<a name="line.395"></a>
-<span class="sourceLineNo">396</span>        e = e instanceof RemoteException ?<a name="line.396"></a>
-<span class="sourceLineNo">397</span>                ((RemoteException)e).unwrapRemoteException() : e;<a name="line.397"></a>
-<span class="sourceLineNo">398</span>      LOG.error("bootstrap", e);<a name="line.398"></a>
-<span class="sourceLineNo">399</span>      throw e;<a name="line.399"></a>
-<span class="sourceLineNo">400</span>    }<a name="line.400"></a>
-<span class="sourceLineNo">401</span>  }<a name="line.401"></a>
-<span class="sourceLineNo">402</span><a name="line.402"></a>
-<span class="sourceLineNo">403</span>  /**<a name="line.403"></a>
-<span class="sourceLineNo">404</span>   * Enable in memory caching for hbase:meta<a name="line.404"></a>
-<span class="sourceLineNo">405</span>   */<a name="line.405"></a>
-<span class="sourceLineNo">406</span>  public static TableDescriptor setInfoFamilyCachingForMeta(TableDescriptor metaDescriptor, final boolean b) {<a name="line.406"></a>
-<span class="sourceLineNo">407</span>    TableDescriptorBuilder builder = TableDescriptorBuilder.newBuilder(metaDescriptor);<a name="line.407"></a>
-<span class="sourceLineNo">408</span>    for (ColumnFamilyDescriptor hcd: metaDescriptor.getColumnFamilies()) {<a name="line.408"></a>
-<span class="sourceLineNo">409</span>      if (Bytes.equals(hcd.getName(), HConstants.CATALOG_FAMILY)) {<a name="line.409"></a>
-<span class="sourceLineNo">410</span>        builder.modifyColumnFamily(ColumnFamilyDescriptorBuilder.newBuilder(hcd)<a name="line.410"></a>
-<span class="sourceLineNo">411</span>                .setBlockCacheEnabled(b)<a name="line.411"></a>
-<span class="sourceLineNo">412</span>                .setInMemory(b)<a name="line.412"></a>
-<span class="sourceLineNo">413</span>                .build());<a name="line.413"></a>
-<span class="sourceLineNo">414</span>      }<a name="line.414"></a>
-<span class="sourceLineNo">415</span>    }<a name="line.415"></a>
-<span class="sourceLineNo">416</span>    return builder.build();<a name="line.416"></a>
-<span class="sourceLineNo">417</span>  }<a name="line.417"></a>
-<span class="sourceLineNo">418</span><a name="line.418"></a>
-<span class="sourceLineNo">419</span>  public void deleteFamilyFromFS(RegionInfo region, byte[] familyName)<a name="line.419"></a>
-<span class="sourceLineNo">420</span>      throws IOException {<a name="line.420"></a>
-<span class="sourceLineNo">421</span>    deleteFamilyFromFS(rootdir, region, familyName);<a name="line.421"></a>
-<span class="sourceLineNo">422</span>  }<a name="line.422"></a>
-<span class="sourceLineNo">423</span><a name="line.423"></a>
-<span class="sourceLineNo">424</span>  public void deleteFamilyFromFS(Path rootDir, RegionInfo region, byte[] familyName)<a name="line.424"></a>
-<span class="sourceLineNo">425</span>      throws IOException {<a name="line.425"></a>
-<span class="sourceLineNo">426</span>    // archive family store files<a name="line.426"></a>
-<span class="sourceLineNo">427</span>    Path tableDir = FSUtils.getTableDir(rootDir, region.getTable());<a name="line.427"></a>
-<span class="sourceLineNo">428</span>    HFileArchiver.archiveFamily(fs, conf, region, tableDir, familyName);<a name="line.428"></a>
-<span class="sourceLineNo">429</span><a name="line.429"></a>
-<span class="sourceLineNo">430</span>    // delete the family folder<a name="line.430"></a>
-<span class="sourceLineNo">431</span>    Path familyDir = new Path(tableDir,<a name="line.431"></a>
-<span class="sourceLineNo">432</span>      new Path(region.getEncodedName(), Bytes.toString(familyName)));<a name="line.432"></a>
-<span class="sourceLineNo">433</span>    if (fs.delete(familyDir, true) == false) {<a name="line.433"></a>
-<span class="sourceLineNo">434</span>      if (fs.exists(familyDir)) {<a name="line.434"></a>
-<span class="sourceLineNo">435</span>        throw new IOException("Could not delete family "<a name="line.435"></a>
-<span class="sourceLineNo">436</span>            + Bytes.toString(familyName) + " from FileSystem for region "<a name="line.436"></a>
-<span class="sourceLineNo">437</span>            + region.getRegionNameAsString() + "(" + region.getEncodedName()<a name="line.437"></a>
-<span class="sourceLineNo">438</span>            + ")");<a name="line.438"></a>
-<span class="sourceLineNo">439</span>      }<a name="line.439"></a>
-<span class="sourceLineNo">440</span>    }<a name="line.440"></a>
-<span class="sourceLineNo">441</span>  }<a name="line.441"></a>
-<span class="sourceLineNo">442</span><a name="line.442"></a>
-<span class="sourceLineNo">443</span>  public void stop() {<a name="line.443"></a>
-<span class="sourceLineNo">444</span>  }<a name="line.444"></a>
-<span class="sourceLineNo">445</span><a name="line.445"></a>
-<span class="sourceLineNo">446</span>  public void logFileSystemState(Logger log) throws IOException {<a name="line.446"></a>
-<span class="sourceLineNo">447</span>    FSUtils.logFileSystemState(fs, rootdir, log);<a name="line.447"></a>
-<span class="sourceLineNo">448</span>  }<a name="line.448"></a>
-<span class="sourceLineNo">449</span>}<a name="line.449"></a>
+<span class="sourceLineNo">211</span>  public Path getWALRootDir() {<a name="line.211"></a>
+<span class="sourceLineNo">212</span>    return this.walRootDir;<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>  /**<a name="line.215"></a>
+<span class="sourceLineNo">216</span>   * @return the directory for a give {@code region}.<a name="line.216"></a>
+<span class="sourceLineNo">217</span>   */<a name="line.217"></a>
+<span class="sourceLineNo">218</span>  public Path getRegionDir(RegionInfo region) {<a name="line.218"></a>
+<span class="sourceLineNo">219</span>    return FSUtils.getRegionDir(FSUtils.getTableDir(getRootDir(), region.getTable()), region);<a name="line.219"></a>
+<span class="sourceLineNo">220</span>  }<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>   * @return HBase temp dir.<a name="line.223"></a>
+<span class="sourceLineNo">224</span>   */<a name="line.224"></a>
+<span class="sourceLineNo">225</span>  public Path getTempDir() {<a name="line.225"></a>
+<span class="sourceLineNo">226</span>    return this.tempdir;<a name="line.226"></a>
+<span class="sourceLineNo">227</span>  }<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>   * @return The unique identifier generated for this cluster<a name="line.230"></a>
+<span class="sourceLineNo">231</span>   */<a name="line.231"></a>
+<span class="sourceLineNo">232</span>  public ClusterId getClusterId() {<a name="line.232"></a>
+<span class="sourceLineNo">233</span>    return clusterId;<a name="line.233"></a>
+<span class="sourceLineNo">234</span>  }<a name="line.234"></a>
+<span class="sourceLineNo">235</span><a name="line.235"></a>
+<span class="sourceLineNo">236</span>  /**<a name="line.236"></a>
+<span class="sourceLineNo">237</span>   * Get the rootdir.  Make sure its wholesome and exists before returning.<a name="line.237"></a>
+<span class="sourceLineNo">238</span>   * @param rd<a name="line.238"></a>
+<span class="sourceLineNo">239</span>   * @param c<a name="line.239"></a>
+<span class="sourceLineNo">240</span>   * @param fs<a name="line.240"></a>
+<span class="sourceLineNo">241</span>   * @return hbase.rootdir (after checks for existence and bootstrapping if<a name="line.241"></a>
+<span class="sourceLineNo">242</span>   * needed populating the directory with necessary bootup files).<a name="line.242"></a>
+<span class="sourceLineNo">243</span>   * @throws IOException<a name="line.243"></a>
+<span class="sourceLineNo">244</span>   */<a name="line.244"></a>
+<span class="sourceLineNo">245</span>  private Path checkRootDir(final Path rd, final Configuration c, final FileSystem fs)<a name="line.245"></a>
+<span class="sourceLineNo">246</span>      throws IOException {<a name="line.246"></a>
+<span class="sourceLineNo">247</span>    // If FS is in safe mode wait till out of it.<a name="line.247"></a>
+<span class="sourceLineNo">248</span>    FSUtils.waitOnSafeMode(c, c.getInt(HConstants.THREAD_WAKE_FREQUENCY, 10 * 1000));<a name="line.248"></a>
+<span class="sourceLineNo">249</span><a name="line.249"></a>
+<span class="sourceLineNo">250</span>    // Filesystem is good. Go ahead and check for hbase.rootdir.<a name="line.250"></a>
+<span class="sourceLineNo">251</span>    try {<a name="line.251"></a>
+<span class="sourceLineNo">252</span>      if (!fs.exists(rd)) {<a name="line.252"></a>
+<span class="sourceLineNo">253</span>        fs.mkdirs(rd);<a name="line.253"></a>
+<span class="sourceLineNo">254</span>        // DFS leaves safe mode with 0 DNs when there are 0 blocks.<a name="line.254"></a>
+<span class="sourceLineNo">255</span>        // We used to handle this by checking the current DN count and waiting until<a name="line.255"></a>
+<span class="sourceLineNo">256</span>        // it is nonzero. With security, the check for datanode count doesn't work --<a name="line.256"></a>
+<span class="sourceLineNo">257</span>        // it is a privileged op. So instead we adopt the strategy of the jobtracker<a name="line.257"></a>
+<span class="sourceLineNo">258</span>        // and simply retry file creation during bootstrap indefinitely. As soon as<a name="line.258"></a>
+<span class="sourceLineNo">259</span>        // there is one datanode it will succeed. Permission problems should have<a name="line.259"></a>
+<span class="sourceLineNo">260</span>        // already been caught by mkdirs above.<a name="line.260"></a>
+<span class="sourceLineNo">261</span>        FSUtils.setVersion(fs, rd, c.getInt(HConstants.THREAD_WAKE_FREQUENCY,<a name="line.261"></a>
+<span class="sourceLineNo">262</span>          10 * 1000), c.getInt(HConstants.VERSION_FILE_WRITE_ATTEMPTS,<a name="line.262"></a>
+<span class="sourceLineNo">263</span>            HConstants.DEFAULT_VERSION_FILE_WRITE_ATTEMPTS));<a name="line.263"></a>
+<span class="sourceLineNo">264</span>      } else {<a name="line.264"></a>
+<span class="sourceLineNo">265</span>        if (!fs.isDirectory(rd)) {<a name="line.265"></a>
+<span class="sourceLineNo">266</span>          throw new IllegalArgumentException(rd.toString() + " is not a directory");<a name="line.266"></a>
+<span class="sourceLineNo">267</span>        }<a name="line.267"></a>
+<span class="sourceLineNo">268</span>        // as above<a name="line.268"></a>
+<span class="sourceLineNo">269</span>        FSUtils.checkVersion(fs, rd, true, c.getInt(HConstants.THREAD_WAKE_FREQUENCY,<a name="line.269"></a>
+<span class="sourceLineNo">270</span>          10 * 1000), c.getInt(HConstants.VERSION_FILE_WRITE_ATTEMPTS,<a name="line.270"></a>
+<span class="sourceLineNo">271</span>            HConstants.DEFAULT_VERSION_FILE_WRITE_ATTEMPTS));<a name="line.271"></a>
+<span class="sourceLineNo">272</span>      }<a name="line.272"></a>
+<span class="sourceLineNo">273</span>    } catch (DeserializationException de) {<a name="line.273"></a>
+<span class="sourceLineNo">274</span>      LOG.error(HBaseMarkers.FATAL, "Please fix invalid configuration for "<a name="line.274"></a>
+<span class="sourceLineNo">275</span>        + HConstants.HBASE_DIR, de);<a name="line.275"></a>
+<span class="sourceLineNo">276</span>      IOException ioe = new IOException();<a name="line.276"></a>
+<span class="sourceLineNo">277</span>      ioe.initCause(de);<a name="line.277"></a>
+<span class="sourceLineNo">278</span>      throw ioe;<a name="line.278"></a>
+<span class="sourceLineNo">279</span>    } catch (IllegalArgumentException iae) {<a name="line.279"></a>
+<span class="sourceLineNo">280</span>      LOG.error(HBaseMarkers.FATAL, "Please fix invalid configuration for "<a name="line.280"></a>
+<span class="sourceLineNo">281</span>        + HConstants.HBASE_DIR + " " + rd.toString(), iae);<a name="line.281"></a>
+<span class="sourceLineNo">282</span>      throw iae;<a name="line.282"></a>
+<span class="sourceLineNo">283</span>    }<a name="line.283"></a>
+<span class="sourceLineNo">284</span>    // Make sure cluster ID exists<a name="line.284"></a>
+<span class="sourceLineNo">285</span>    if (!FSUtils.checkClusterIdExists(fs, rd, c.getInt(<a name="line.285"></a>
+<span class="sourceLineNo">286</span>        HConstants.THREAD_WAKE_FREQUENCY, 10 * 1000))) {<a name="line.286"></a>
+<span class="sourceLineNo">287</span>      FSUtils.setClusterId(fs, rd, new ClusterId(), c.getInt(HConstants.THREAD_WAKE_FREQUENCY, 10 * 1000));<a name="line.287"></a>
+<span class="sourceLineNo">288</span>    }<a name="line.288"></a>
+<span class="sourceLineNo">289</span>    clusterId = FSUtils.getClusterId(fs, rd);<a name="line.289"></a>
+<span class="sourceLineNo">290</span><a name="line.290"></a>
+<span class="sourceLineNo">291</span>    // Make sure the meta region directory exists!<a name="line.291"></a>
+<span class="sourceLineNo">292</span>    if (!FSUtils.metaRegionExists(fs, rd)) {<a name="line.292"></a>
+<span class="sourceLineNo">293</span>      bootstrap(rd, c);<a name="line.293"></a>
+<span class="sourceLineNo">294</span>    }<a name="line.294"></a>
+<span class="sourceLineNo">295</span><a name="line.295"></a>
+<span class="sourceLineNo">296</span>    // Create tableinfo-s for hbase:meta if not already there.<a name="line.296"></a>
+<span class="sourceLineNo">297</span>    // assume, created table descriptor is for enabling table<a name="line.297"></a>
+<span class="sourceLineNo">298</span>    // meta table is a system table, so descriptors are predefined,<a name="line.298"></a>
+<span class="sourceLineNo">299</span>    // we should get them from registry.<a name="line.299"></a>
+<span class="sourceLineNo">300</span>    FSTableDescriptors fsd = new FSTableDescriptors(c, fs, rd);<a name="line.300"></a>
+<span class="sourceLineNo">301</span>    fsd.createTableDescriptor(fsd.get(TableName.META_TABLE_NAME));<a name="line.301"></a>
+<span class="sourceLineNo">302</span><a name="line.302"></a>
+<span class="sourceLineNo">303</span>    return rd;<a name="line.303"></a>
+<span class="sourceLineNo">304</span>  }<a name="line.304"></a>
+<span class="sourceLineNo">305</span><a name="line.305"></a>
+<span class="sourceLineNo">306</span>  /**<a name="line.306"></a>
+<span class="sourceLineNo">307</span>   * Make sure the hbase temp directory exists and is empty.<a name="line.307"></a>
+<span class="sourceLineNo">308</span>   * NOTE that this method is only executed once just after the master becomes the active one.<a name="line.308"></a>
+<span class="sourceLineNo">309</span>   */<a name="line.309"></a>
+<span class="sourceLineNo">310</span>  private void checkTempDir(final Path tmpdir, final Configuration c, final FileSystem fs)<a name="line.310"></a>
+<span class="sourceLineNo">311</span>      throws IOException {<a name="line.311"></a>
+<span class="sourceLineNo">312</span>    // If the temp directory exists, clear the content (left over, from the previous run)<a name="line.312"></a>
+<span class="sourceLineNo">313</span>    if (fs.exists(tmpdir)) {<a name="line.313"></a>
+<span class="sourceLineNo">314</span>      // Archive table in temp, maybe left over from failed deletion,<a name="line.314"></a>
+<span class="sourceLineNo">315</span>      // if not the cleaner will take care of them.<a name="line.315"></a>
+<span class="sourceLineNo">316</span>      for (Path tabledir: FSUtils.getTableDirs(fs, tmpdir)) {<a name="line.316"></a>
+<span class="sourceLineNo">317</span>        for (Path regiondir: FSUtils.getRegionDirs(fs, tabledir)) {<a name="line.317"></a>
+<span class="sourceLineNo">318</span>          HFileArchiver.archiveRegion(fs, this.rootdir, tabledir, regiondir);<a name="line.318"></a>
+<span class="sourceLineNo">319</span>        }<a name="line.319"></a>
+<span class="sourceLineNo">320</span>      }<a name="line.320"></a>
+<span class="sourceLineNo">321</span>      if (!fs.delete(tmpdir, true)) {<a name="line.321"></a>
+<span class="sourceLineNo">322</span>        throw new IOException("Unable to clean the temp directory: " + tmpdir);<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>    // Create the temp directory<a name="line.326"></a>
+<span class="sourceLineNo">327</span>    if (isSecurityEnabled) {<a name="line.327"></a>
+<span class="sourceLineNo">328</span>      if (!fs.mkdirs(tmpdir, secureRootSubDirPerms)) {<a name="line.328"></a>
+<span class="sourceLineNo">329</span>        throw new IOException("HBase temp directory '" + tmpdir + "' creation failure.");<a name="line.329"></a>
+<span class="sourceLineNo">330</span>      }<a name="line.330"></a>
+<span class="sourceLineNo">331</span>    } else {<a name="line.331"></a>
+<span class="sourceLineNo">332</span>      if (!fs.mkdirs(tmpdir)) {<a name="line.332"></a>
+<span class="sourceLineNo">333</span>        throw new IOException("HBase temp directory '" + tmpdir + "' creation failure.");<a name="line.333"></a>
+<span class="sourceLineNo">334</span>      }<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>   * Make sure the directories under rootDir have good permissions. Create if necessary.<a name="line.339"></a>
+<span class="sourceLineNo">340</span>   * @param p<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 checkSubDir(final Path p, final String dirPermsConfName) throws IOException {<a name="line.343"></a>
+<span class="sourceLineNo">344</span>    FileSystem fs = p.getFileSystem(conf);<a name="line.344"></a>
+<span class="sourceLineNo">345</span>    FsPermission dirPerms = new FsPermission(conf.get(dirPermsConfName, "700"));<a name="line.345"></a>
+<span class="sourceLineNo">346</span>    if (!fs.exists(p)) {<a name="line.346"></a>
+<span class="sourceLineNo">347</span>      if (isSecurityEnabled) {<a name="line.347"></a>
+<span class="sourceLineNo">348</span>        if (!fs.mkdirs(p, secureRootSubDirPerms)) {<a name="line.348"></a>
+<span class="sourceLineNo">349</span>          throw new IOException("HBase directory '" + p + "' creation failure.");<a name="line.349"></a>
+<span class="sourceLineNo">350</span>        }<a name="line.350"></a>
+<span class="sourceLineNo">351</span>      } else {<a name="line.351"></a>
+<span class="sourceLineNo">352</span>        if (!fs.mkdirs(p)) {<a name="line.352"></a>
+<span class="sourceLineNo">353</span>          throw new IOException("HBase directory '" + p + "' creation failure.");<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>    else {<a name="line.357"></a>
+<span class="sourceLineNo">358</span>      if (isSecurityEnabled &amp;&amp; !dirPerms.equals(fs.getFileStatus(p).getPermission())) {<a name="line.358"></a>
+<span class="sourceLineNo">359</span>        // check whether the permission match<a name="line.359"></a>
+<span class="sourceLineNo">360</span>        LOG.warn("Found HBase directory permissions NOT matching expected permissions for "<a name="line.360"></a>
+<span class="sourceLineNo">361</span>            + p.toString() + " permissions=" + fs.getFileStatus(p).getPermission()<a name="line.361"></a>
+<span class="sourceLineNo">362</span>            + ", expecting " + dirPerms + ". Automatically setting the permissions. "<a name="line.362"></a>
+<span class="sourceLineNo">363</span>            + "You can change the permissions by setting \"" + dirPermsConfName + "\" in hbase-site.xml "<a name="line.363"></a>
+<span class="sourceLineNo">364</span>            + "and restarting the master");<a name="line.364"></a>
+<span class="sourceLineNo">365</span>        fs.setPermission(p, dirPerms);<a name="line.365"></a>
+<span class="sourceLineNo">366</span>      }<a name="line.366"></a>
+<span class="sourceLineNo">367</span>    }<a name="line.367"></a>
+<span class="sourceLineNo">368</span>  }<a name="line.368"></a>
+<span class="sourceLineNo">369</span><a name="line.369"></a>
+<span class="sourceLineNo">370</span>  /**<a name="line.370"></a>
+<span class="sourceLineNo">371</span>   * Check permissions for bulk load staging directory. This directory has special hidden<a name="line.371"></a>
+<span class="sourceLineNo">372</span>   * permissions. Create it if necessary.<a name="line.372"></a>
+<span class="sourceLineNo">373</span>   * @throws IOException<a name="line.373"></a>
+<span class="sourceLineNo">374</span>   */<a name="line.374"></a>
+<span class="sourceLineNo">375</span>  private void checkStagingDir() throws IOException {<a name="line.375"></a>
+<span class="sourceLineNo">376</span>    Path p = new Path(this.rootdir, HConstants.BULKLOAD_STAGING_DIR_NAME);<a name="line.376"></a>
+<span class="sourceLineNo">377</span>    try {<a name="line.377"></a>
+<span class="sourceLineNo">378</span>      if (!this.fs.exists(p)) {<a name="line.378"></a>
+<span class="sourceLineNo">379</span>        if (!this.fs.mkdirs(p, HiddenDirPerms)) {<a name="line.379"></a>
+<span class="sourceLineNo">380</span>          throw new IOException("Failed to create staging directory " + p.toString());<a name="line.380"></a>
+<span class="sourceLineNo">381</span>        }<a name="line.381"></a>
+<span class="sourceLineNo">382</span>      } else {<a name="line.382"></a>
+<span class="sourceLineNo">383</span>        this.fs.setPermission(p, HiddenDirPerms);<a name="line.383"></a>
+<span class="sourceLineNo">384</span>      }<a name="line.384"></a>
+<span class="sourceLineNo">385</span>    } catch (IOException e) {<a name="line.385"></a>
+<span class="sourceLineNo">386</span>      LOG.error("Failed to create or set permission on staging directory " + p.toString());<a name="line.386"></a>
+<span class="sourceLineNo">387</span>      throw new IOException("Failed to create or set permission on staging directory "<a name="line.387"></a>
+<span class="sourceLineNo">388</span>          + p.toString(), e);<a name="line.388"></a>
+<span class="sourceLineNo">389</span>    }<a name="line.389"></a>
+<span class="sourceLineNo">390</span>  }<a name="line.390"></a>
+<span class="sourceLineNo">391</span><a name="line.391"></a>
+<span class="sourceLineNo">392</span>  private static void bootstrap(final Path rd, final Configuration c)<a name="line.392"></a>
+<span class="sourceLineNo">393</span>  throws IOException {<a name="line.393"></a>
+<span class="sourceLineNo">394</span>    LOG.info("BOOTSTRAP: creating hbase:meta region");<a name="line.394"></a>
+<span class="sourceLineNo">395</span>    try {<a name="line.395"></a>
+<span class="sourceLineNo">396</span>      // Bootstrapping, make sure blockcache is off.  Else, one will be<a name="line.396"></a>
+<span class="sourceLineNo">397</span>      // created here in bootstrap and it'll need to be cleaned up.  Better to<a name="line.397"></a>
+<span class="sourceLineNo">398</span>      // not make it in first place.  Turn off block caching for bootstrap.<a name="line.398"></a>
+<span class="sourceLineNo">399</span>      // Enable after.<a name="line.399"></a>
+<span class="sourceLineNo">400</span>      TableDescriptor metaDescriptor = new FSTableDescriptors(c).get(TableName.META_TABLE_NAME);<a name="line.400"></a>
+<span class="sourceLineNo">401</span>      HRegion meta = HRegion.createHRegion(RegionInfoBuilder.FIRST_META_REGIONINFO, rd,<a name="line.401"></a>
+<span class="sourceLineNo">402</span>          c, setInfoFamilyCachingForMeta(metaDescriptor, false), null);<a name="line.402"></a>
+<span class="sourceLineNo">403</span>      meta.close();<a name="line.403"></a>
+<span class="sourceLineNo">404</span>    } catch (IOException e) {<a name="line.404"></a>
+<span class="sourceLineNo">405</span>        e = e instanceof RemoteException ?<a name="line.405"></a>
+<span class="sourceLineNo">406</span>                ((RemoteException)e).unwrapRemoteException() : e;<a name="line.406"></a>
+<span class="sourceLineNo">407</span>      LOG.error("bootstrap", e);<a name="line.407"></a>
+<span class="sourceLineNo">408</span>      throw e;<a name="line.408"></a>
+<span class="sourceLineNo">409</span>    }<a name="line.409"></a>
+<span class="sourceLineNo">410</span>  }<a name="line.410"></a>
+<span class="sourceLineNo">411</span><a name="line.411"></a>
+<span class="sourceLineNo">412</span>  /**<a name="line.412"></a>
+<span class="sourceLineNo">413</span>   * Enable in memory caching for hbase:meta<a name="line.413"></a>
+<span class="sourceLineNo">414</span>   */<a name="line.414"></a>
+<span class="sourceLineNo">415</span>  public static TableDescriptor setInfoFamilyCachingForMeta(TableDescriptor metaDescriptor, final boolean b) {<a name="line.415"></a>
+<span class="sourceLineNo">416</span>    TableDescriptorBuilder builder = TableDescriptorBuilder.newBuilder(metaDescriptor);<a name="line.416"></a>
+<span class="sourceLineNo">417</span>    for (ColumnFamilyDescriptor hcd: metaDescriptor.getColumnFamilies()) {<a name="line.417"></a>
+<span class="sourceLineNo">418</span>      if (Bytes.equals(hcd.getName(), HConstants.CATALOG_FAMILY)) {<a name="line.418"></a>
+<span class="sourceLineNo">419</span>        builder.modifyColumnFamily(ColumnFamilyDescriptorBuilder.newBuilder(hcd)<a name="line.419"></a>
+<span class="sourceLineNo">420</span>                .setBlockCacheEnabled(b)<a name="line.420"></a>
+<span class="sourceLineNo">421</span>                .setInMemory(b)<a name="line.421"></a>
+<span class="sourceLineNo">422</span>                .build());<a name="line.422"></a>
+<span class="sourceLineNo">423</span>      }<a name="line.423"></a>
+<span class="sourceLineNo">424</span>    }<a name="line.424"></a>
+<span class="sourceLineNo">425</span>    return builder.build();<a name="line.425"></a>
+<span class="sourceLineNo">426</span>  }<a name="line.426"></a>
+<span class="sourceLineNo">427</span><a name="line.427"></a>
+<span class="sourceLineNo">428</span>  public void deleteFamilyFromFS(RegionInfo region, byte[] familyName)<a name="line.428"></a>
+<span class="sourceLineNo">429</span>      throws IOException {<a name="line.429"></a>
+<span class="sourceLineNo">430</span>    deleteFamilyFromFS(rootdir, region, familyName);<a name="line.430"></a>
+<span class="sourceLineNo">431</span>  }<a name="line.431"></a>
+<span class="sourceLineNo">432</span><a name="line.432"></a>
+<span class="sourceLineNo">433</span>  public void deleteFamilyFromFS(Path rootDir, RegionInfo region, byte[] familyName)<a name="line.433"></a>
+<span class="sourceLineNo">434</span>      throws IOException {<a name="line.434"></a>
+<span class="sourceLineNo">435</span>    // archive family store files<a name="line.435"></a>
+<span class="sourceLineNo">436</span>    Path tableDir = FSUtils.getTableDir(rootDir, region.getTable());<a name="line.436"></a>
+<span class="sourceLineNo">437</span>    HFileArchiver.archiveFamily(fs, conf, region, tableDir, familyName);<a name="line.437"></a>
+<span class="sourceLineNo">438</span><a name="line.438"></a>
+<span class="sourceLineNo">439</span>    // delete the family folder<a name="line.439"></a>
+<span class="sourceLineNo">440</span>    Path familyDir = new Path(tableDir,<a name="line.440"></a>
+<span class="sourceLineNo">441</span>      new Path(region.getEncodedName(), Bytes.toString(familyName)));<a name="line.441"></a>
+<span class="sourceLineNo">442</span>    if (fs.delete(familyDir, true) == false) {<a name="line.442"></a>
+<span class="sourceLineNo">443</span>      if (fs.exists(familyDir)) {<a name="line.443"></a>
+<span class="sourceLineNo">444</span>        throw new IOException("Could not delete family "<a name="line.444"></a>
+<span class="sourceLineNo">445</span>            + Bytes.toString(familyName) + " from FileSystem for region "<a name="line.445"></a>
+<span class="sourceLineNo">446</span>            + region.getRegionNameAsString() + "(" + region.getEncodedName()<a name="line.446"></a>
+<span class="sourceLineNo">447</span>            + ")");<a name="line.447"></a>
+<span class="sourceLineNo">448</span>      }<a name="line.448"></a>
+<span class="sourceLineNo">449</span>    }<a name="line.449"></a>
+<span class="sourceLineNo">450</span>  }<a name="line.450"></a>
+<span class="sourceLineNo">451</span><a name="line.451"></a>
+<span class="sourceLineNo">452</span>  public void stop() {<a name="line.452"></a>
+<span class="sourceLineNo">453</span>  }<a name="line.453"></a>
+<span class="sourceLineNo">454</span><a name="line.454"></a>
+<span class="sourceLineNo">455</span>  public void logFileSystemState(Logger log) throws IOException {<a name="line.455"></a>
+<span class="sourceLineNo">456</span>    FSUtils.logFileSystemState(fs, rootdir, log);<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>
 
 
 


Mime
View raw message