org.apache.hadoop.hbase.master
Class MasterFileSystem

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

@InterfaceAudience.Private
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, boolean masterRecovery)
           
 
Method Summary
 HTableDescriptor addColumn(TableName tableName, HColumnDescriptor hcd)
          Add column to a table
 boolean checkFileSystem()
          Checks to see if the file system is still accessible.
 HTableDescriptor deleteColumn(TableName tableName, byte[] familyName)
          Delete column of a table
 void deleteFamilyFromFS(HRegionInfo region, byte[] familyName)
           
 void deleteRegion(HRegionInfo region)
           
 void deleteTable(TableName tableName)
           
 ClusterId getClusterId()
           
 org.apache.hadoop.fs.FileSystem getFileSystem()
           
 ZooKeeperProtos.SplitLogTask.RecoveryMode getLogRecoveryMode()
           
 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(TableName tableName, HColumnDescriptor hcd)
          Modify Column of a table
 org.apache.hadoop.fs.Path moveTableToTemp(TableName tableName)
          Move the specified table to the hbase temp directory
 void prepareLogReplay(ServerName serverName, Set<HRegionInfo> regions)
          Mark regions in recovering state when distributedLogReplay are set true
 void prepareLogReplay(Set<ServerName> serverNames)
          Mark regions in recovering state when distributedLogReplay are set true
static void setInfoFamilyCachingForMeta(HTableDescriptor metaDescriptor, boolean b)
          Enable in memory caching for hbase:meta
 void setLogRecoveryMode()
          The function is used in SSH to set recovery mode based on configuration after all outstanding log split tasks drained.
 void splitLog(ServerName serverName)
           
 void splitLog(Set<ServerName> serverNames)
           
 void splitLog(Set<ServerName> serverNames, org.apache.hadoop.fs.PathFilter filter)
          This method is the base split method that splits HLog files matching a filter.
 void splitMetaLog(ServerName serverName)
          Specialized method to handle the splitting for meta HLog
 void splitMetaLog(Set<ServerName> serverNames)
          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,
                        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 ClusterId getClusterId()
Returns:
The unique identifier generated for this cluster

splitLog

public void splitLog(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

splitMetaLog

public void splitMetaLog(Set<ServerName> serverNames)
                  throws IOException
Specialized method to handle the splitting for meta HLog

Parameters:
serverNames -
Throws:
IOException

prepareLogReplay

public void prepareLogReplay(Set<ServerName> serverNames)
                      throws IOException
Mark regions in recovering state when distributedLogReplay are set true

Parameters:
serverNames - Set of ServerNames to be replayed wals in order to recover changes contained in them
Throws:
IOException

prepareLogReplay

public void prepareLogReplay(ServerName serverName,
                             Set<HRegionInfo> regions)
                      throws IOException
Mark regions in recovering state when distributedLogReplay are set true

Parameters:
serverName - Failed region server whose wals to be replayed
regions - Set of regions to be recovered
Throws:
IOException

splitLog

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

splitLog

public void splitLog(Set<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

setInfoFamilyCachingForMeta

public static void setInfoFamilyCachingForMeta(HTableDescriptor metaDescriptor,
                                               boolean b)
Enable in memory caching for hbase:meta


deleteRegion

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

deleteTable

public void deleteTable(TableName tableName)
                 throws IOException
Throws:
IOException

moveTableToTemp

public org.apache.hadoop.fs.Path moveTableToTemp(TableName 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()

deleteColumn

public HTableDescriptor deleteColumn(TableName 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(TableName 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(TableName tableName,
                                  HColumnDescriptor hcd)
                           throws IOException
Add column to a table

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

setLogRecoveryMode

public void setLogRecoveryMode()
                        throws IOException
The function is used in SSH to set recovery mode based on configuration after all outstanding log split tasks drained.

Throws:
org.apache.zookeeper.KeeperException
InterruptedIOException
IOException

getLogRecoveryMode

public ZooKeeperProtos.SplitLogTask.RecoveryMode getLogRecoveryMode()


Copyright © 2007–2015 The Apache Software Foundation. All rights reserved.