org.apache.hadoop.hbase.master
Class MasterFileSystem

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

public class MasterFileSystem
extends Object

This class abstracts a bunch of operations the HMaster needs to interact with the underlying file system, including splitting log files, checking file system status, etc.


Constructor Summary
MasterFileSystem(Server master, MasterServices services, MasterMetrics metrics, boolean masterRecovery)
           
 
Method Summary
 HTableDescriptor addColumn(byte[] tableName, HColumnDescriptor hcd)
          Add column to a table
 boolean checkFileSystem()
          Checks to see if the file system is still accessible.
 void createTableDescriptor(HTableDescriptor htableDescriptor)
          Create new HTableDescriptor in HDFS.
 HTableDescriptor deleteColumn(byte[] tableName, byte[] familyName)
          Delete column of a table
 void deleteFamilyFromFS(HRegionInfo region, byte[] familyName)
           
 void deleteRegion(HRegionInfo region)
           
 void deleteTable(byte[] tableName)
           
 String getClusterId()
           
 org.apache.hadoop.fs.FileSystem getFileSystem()
           
 org.apache.hadoop.fs.Path getOldLogDir()
          Get the directory where old logs go
 org.apache.hadoop.fs.Path getRootDir()
           
 org.apache.hadoop.fs.Path getTempDir()
           
 HTableDescriptor modifyColumn(byte[] tableName, HColumnDescriptor hcd)
          Modify Column of a table
 org.apache.hadoop.fs.Path moveTableToTemp(byte[] tableName)
          Move the specified table to the hbase temp directory
 org.apache.hadoop.fs.Path moveToTemp(org.apache.hadoop.fs.Path path)
          Move the specified file/directory to the hbase temp directory.
static void setInfoFamilyCachingForMeta(boolean b)
          Enable in memory caching for .META.
static void setInfoFamilyCachingForRoot(boolean b)
          Enable in-memory caching for -ROOT-
 void splitAllLogs(List<ServerName> serverNames)
           
 void splitAllLogs(ServerName serverName)
           
 void splitLog(List<ServerName> serverNames)
           
 void splitLog(List<ServerName> serverNames, org.apache.hadoop.fs.PathFilter filter)
          This method is the base split method that splits HLog files matching a filter.
 void splitLog(ServerName serverName)
           
 void splitMetaLog(ServerName serverName)
          Specialized method to handle the splitting for meta HLog
 void stop()
           
 void updateRegionInfo(HRegionInfo region)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MasterFileSystem

public MasterFileSystem(Server master,
                        MasterServices services,
                        MasterMetrics metrics,
                        boolean masterRecovery)
                 throws IOException
Throws:
IOException
Method Detail

getFileSystem

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

getOldLogDir

public org.apache.hadoop.fs.Path getOldLogDir()
Get the directory where old logs go

Returns:
the dir

checkFileSystem

public boolean checkFileSystem()
Checks to see if the file system is still accessible. If not, sets closed

Returns:
false if file system is not available

getRootDir

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

getTempDir

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

getClusterId

public String getClusterId()
Returns:
The unique identifier generated for this cluster

splitLog

public void splitLog(ServerName serverName)
              throws IOException
Throws:
IOException

splitAllLogs

public void splitAllLogs(ServerName serverName)
                  throws IOException
Throws:
IOException

splitMetaLog

public void splitMetaLog(ServerName serverName)
                  throws IOException
Specialized method to handle the splitting for meta HLog

Parameters:
serverName -
Throws:
IOException

splitLog

public void splitLog(List<ServerName> serverNames)
              throws IOException
Throws:
IOException

splitAllLogs

public void splitAllLogs(List<ServerName> serverNames)
                  throws IOException
Throws:
IOException

splitLog

public void splitLog(List<ServerName> serverNames,
                     org.apache.hadoop.fs.PathFilter filter)
              throws IOException
This method is the base split method that splits HLog files matching a filter. Callers should pass the appropriate filter for meta and non-meta HLogs.

Parameters:
serverNames -
filter -
Throws:
IOException

setInfoFamilyCachingForRoot

public static void setInfoFamilyCachingForRoot(boolean b)
Enable in-memory caching for -ROOT-


setInfoFamilyCachingForMeta

public static void setInfoFamilyCachingForMeta(boolean b)
Enable in memory caching for .META.


deleteRegion

public void deleteRegion(HRegionInfo region)
                  throws IOException
Throws:
IOException

deleteTable

public void deleteTable(byte[] tableName)
                 throws IOException
Throws:
IOException

moveToTemp

public org.apache.hadoop.fs.Path moveToTemp(org.apache.hadoop.fs.Path path)
                                     throws IOException
Move the specified file/directory to the hbase temp directory.

Parameters:
path - The path of the file/directory to move
Returns:
The temp location of the file/directory moved
Throws:
IOException - in case of file-system failure

moveTableToTemp

public org.apache.hadoop.fs.Path moveTableToTemp(byte[] tableName)
                                          throws IOException
Move the specified table to the hbase temp directory

Parameters:
tableName - Table name to move
Returns:
The temp location of the table moved
Throws:
IOException - in case of file-system failure

updateRegionInfo

public void updateRegionInfo(HRegionInfo region)

deleteFamilyFromFS

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

stop

public void stop()

createTableDescriptor

public void createTableDescriptor(HTableDescriptor htableDescriptor)
                           throws IOException
Create new HTableDescriptor in HDFS.

Parameters:
htableDescriptor -
Throws:
IOException

deleteColumn

public HTableDescriptor deleteColumn(byte[] tableName,
                                     byte[] familyName)
                              throws IOException
Delete column of a table

Parameters:
tableName -
familyName -
Returns:
Modified HTableDescriptor with requested column deleted.
Throws:
IOException

modifyColumn

public HTableDescriptor modifyColumn(byte[] tableName,
                                     HColumnDescriptor hcd)
                              throws IOException
Modify Column of a table

Parameters:
tableName -
hcd - HColumnDesciptor
Returns:
Modified HTableDescriptor with the column modified.
Throws:
IOException

addColumn

public HTableDescriptor addColumn(byte[] tableName,
                                  HColumnDescriptor hcd)
                           throws IOException
Add column to a table

Parameters:
tableName -
hcd -
Returns:
Modified HTableDescriptor with new column added.
Throws:
IOException


Copyright © 2014 The Apache Software Foundation. All Rights Reserved.