Class MasterFileSystem

java.lang.Object
org.apache.hadoop.hbase.master.MasterFileSystem

@Private public class MasterFileSystem extends Object
This class abstracts a bunch of operations the HMaster needs to interact with the underlying file system like creating the initial layout, checking file system status, etc.
  • Field Details

    • LOG

      private static final org.slf4j.Logger LOG
    • HBASE_DIR_PERMS

      public static final String HBASE_DIR_PERMS
      Parameter name for HBase instance root directory permission
      See Also:
    • HBASE_WAL_DIR_PERMS

      public static final String HBASE_WAL_DIR_PERMS
      Parameter name for HBase WAL directory permission
      See Also:
    • conf

      private final org.apache.hadoop.conf.Configuration conf
    • clusterId

    • fs

      private final org.apache.hadoop.fs.FileSystem fs
    • walFs

      private final org.apache.hadoop.fs.FileSystem walFs
    • rootdir

      private final org.apache.hadoop.fs.Path rootdir
    • tempdir

      private final org.apache.hadoop.fs.Path tempdir
    • walRootDir

      private final org.apache.hadoop.fs.Path walRootDir
    • secureRootSubDirPerms

      private final org.apache.hadoop.fs.permission.FsPermission secureRootSubDirPerms
    • secureRootFilePerms

      private final org.apache.hadoop.fs.permission.FsPermission secureRootFilePerms
    • HiddenDirPerms

      private final org.apache.hadoop.fs.permission.FsPermission HiddenDirPerms
    • isSecurityEnabled

      private boolean isSecurityEnabled
  • Constructor Details

  • Method Details

    • createInitialFileSystemLayout

      Create initial layout in filesystem.
      1. Check if the meta region exists and is readable, if not create it. Create hbase.version and the hbase:meta directory if not one.
      Idempotent.
      Throws:
      IOException
    • getFileSystem

      public org.apache.hadoop.fs.FileSystem getFileSystem()
    • getWALFileSystem

      public org.apache.hadoop.fs.FileSystem getWALFileSystem()
    • getConfiguration

      public org.apache.hadoop.conf.Configuration getConfiguration()
    • getRootDir

      public org.apache.hadoop.fs.Path getRootDir()
      Returns HBase root dir.
    • getWALRootDir

      public org.apache.hadoop.fs.Path getWALRootDir()
      Returns HBase root log dir.
    • getRegionDir

      public org.apache.hadoop.fs.Path getRegionDir(RegionInfo region)
      Returns the directory for a give region.
    • getTempDir

      public org.apache.hadoop.fs.Path getTempDir()
      Returns HBase temp dir.
    • getClusterId

      Returns The unique identifier generated for this cluster
    • checkRootDir

      private void checkRootDir(org.apache.hadoop.fs.Path rd, org.apache.hadoop.conf.Configuration c, org.apache.hadoop.fs.FileSystem fs) throws IOException
      Get the rootdir. Make sure its wholesome and exists before returning.
      Throws:
      IOException
    • checkTempDir

      void checkTempDir(org.apache.hadoop.fs.Path tmpdir, org.apache.hadoop.conf.Configuration c, org.apache.hadoop.fs.FileSystem fs) throws IOException
      Make sure the hbase temp directory exists and is empty. NOTE that this method is only executed once just after the master becomes the active one.
      Throws:
      IOException
    • checkSubDir

      private void checkSubDir(org.apache.hadoop.fs.Path p, String dirPermsConfName) throws IOException
      Make sure the directories under rootDir have good permissions. Create if necessary.
      Throws:
      IOException
    • checkStagingDir

      private void checkStagingDir() throws IOException
      Check permissions for bulk load staging directory. This directory has special hidden permissions. Create it if necessary.
      Throws:
      IOException
    • deleteFamilyFromFS

      public void deleteFamilyFromFS(RegionInfo region, byte[] familyName) throws IOException
      Throws:
      IOException
    • deleteFamilyFromFS

      public void deleteFamilyFromFS(org.apache.hadoop.fs.Path rootDir, RegionInfo region, byte[] familyName) throws IOException
      Throws:
      IOException
    • stop

      public void stop()
    • logFileSystemState

      public void logFileSystemState(org.slf4j.Logger log) throws IOException
      Throws:
      IOException