org.apache.hadoop.hbase.fs
Class HFileSystem

java.lang.Object
  extended by org.apache.hadoop.conf.Configured
      extended by org.apache.hadoop.fs.FileSystem
          extended by org.apache.hadoop.fs.FilterFileSystem
              extended by org.apache.hadoop.hbase.fs.HFileSystem
All Implemented Interfaces:
Closeable, org.apache.hadoop.conf.Configurable

public class HFileSystem
extends org.apache.hadoop.fs.FilterFileSystem

An encapsulation for the FileSystem object that hbase uses to access data. This class allows the flexibility of using separate filesystem objects for reading and writing hfiles and hlogs. In future, if we want to make hlogs be in a different filesystem, this is the place to make it happen.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.hadoop.fs.FileSystem
org.apache.hadoop.fs.FileSystem.Statistics
 
Field Summary
static org.apache.commons.logging.Log LOG
           
 
Fields inherited from class org.apache.hadoop.fs.FilterFileSystem
fs, swapScheme
 
Fields inherited from class org.apache.hadoop.fs.FileSystem
DEFAULT_FS, FS_DEFAULT_NAME_KEY, SHUTDOWN_HOOK_PRIORITY, statistics
 
Constructor Summary
HFileSystem(org.apache.hadoop.conf.Configuration conf, boolean useHBaseChecksum)
          Create a FileSystem object for HBase regionservers.
HFileSystem(org.apache.hadoop.fs.FileSystem fs)
          Wrap a FileSystem object within a HFileSystem.
 
Method Summary
static boolean addLocationsOrderInterceptor(org.apache.hadoop.conf.Configuration conf)
           
 void close()
          Close this filesystem object
 org.apache.hadoop.fs.FSDataOutputStream createNonRecursive(org.apache.hadoop.fs.Path f, boolean overwrite, int bufferSize, short replication, long blockSize, org.apache.hadoop.util.Progressable progress)
          The org.apache.hadoop.fs.FilterFileSystem does not yet support createNonRecursive.
static org.apache.hadoop.fs.FileSystem get(org.apache.hadoop.conf.Configuration conf)
          Create a new HFileSystem object, similar to FileSystem.get().
 org.apache.hadoop.fs.FileSystem getBackingFs()
          Returns the underlying filesystem
static org.apache.hadoop.fs.FileSystem getLocalFs(org.apache.hadoop.conf.Configuration conf)
          Wrap a LocalFileSystem within a HFileSystem.
 org.apache.hadoop.fs.FileSystem getNoChecksumFs()
          Returns the filesystem that is specially setup for doing reads from storage.
 boolean useHBaseChecksum()
          Are we verifying checksums in HBase?
 
Methods inherited from class org.apache.hadoop.fs.FilterFileSystem
append, canonicalizeUri, checkPath, completeLocalOutput, concat, copyFromLocalFile, copyFromLocalFile, copyFromLocalFile, copyToLocalFile, create, createNonRecursive, createSnapshot, createSymlink, delete, deleteSnapshot, getCanonicalUri, getChildFileSystems, getConf, getContentSummary, getDefaultBlockSize, getDefaultBlockSize, getDefaultReplication, getDefaultReplication, getFileBlockLocations, getFileChecksum, getFileLinkStatus, getFileStatus, getHomeDirectory, getInitialWorkingDirectory, getLinkTarget, getRawFileSystem, getServerDefaults, getServerDefaults, getStatus, getUri, getUsed, getWorkingDirectory, initialize, listCorruptFileBlocks, listLocatedStatus, listStatus, makeQualified, mkdirs, open, primitiveCreate, primitiveMkdir, rename, renameSnapshot, resolveLink, resolvePath, setOwner, setPermission, setReplication, setTimes, setVerifyChecksum, setWorkingDirectory, setWriteChecksum, startLocalOutput, supportsSymlinks
 
Methods inherited from class org.apache.hadoop.fs.FileSystem
addDelegationTokens, append, append, cancelDeleteOnExit, clearStatistics, closeAll, closeAllForUGI, copyFromLocalFile, copyToLocalFile, copyToLocalFile, create, create, create, create, create, create, create, create, create, create, create, create, createNewFile, createNonRecursive, createSnapshot, delete, deleteOnExit, enableSymlinks, exists, fixRelativePart, get, get, getAllStatistics, getBlockSize, getCanonicalServiceName, getDefaultPort, getDefaultUri, getDelegationToken, getFileBlockLocations, getFileSystemClass, getFSofPath, getLength, getLocal, getName, getNamed, getReplication, getScheme, getStatistics, getStatistics, getStatus, globStatus, globStatus, isDirectory, isFile, isSymlinksEnabled, listFiles, listLocatedStatus, listStatus, listStatus, listStatus, mkdirs, mkdirs, moveFromLocalFile, moveFromLocalFile, moveToLocalFile, newInstance, newInstance, newInstance, newInstanceLocal, open, primitiveMkdir, printStatistics, processDeleteOnExit, rename, setDefaultUri, setDefaultUri
 
Methods inherited from class org.apache.hadoop.conf.Configured
setConf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

public static final org.apache.commons.logging.Log LOG
Constructor Detail

HFileSystem

public HFileSystem(org.apache.hadoop.conf.Configuration conf,
                   boolean useHBaseChecksum)
            throws IOException
Create a FileSystem object for HBase regionservers.

Parameters:
conf - The configuration to be used for the filesystem
useHBaseChecksum - if true, then use checksum verfication in hbase, otherwise delegate checksum verification to the FileSystem.
Throws:
IOException

HFileSystem

public HFileSystem(org.apache.hadoop.fs.FileSystem fs)
Wrap a FileSystem object within a HFileSystem. The noChecksumFs and writefs are both set to be the same specified fs. Do not verify hbase-checksums while reading data from filesystem.

Parameters:
fs - Set the noChecksumFs and writeFs to this specified filesystem.
Method Detail

getNoChecksumFs

public org.apache.hadoop.fs.FileSystem getNoChecksumFs()
Returns the filesystem that is specially setup for doing reads from storage. This object avoids doing checksum verifications for reads.

Returns:
The FileSystem object that can be used to read data from files.

getBackingFs

public org.apache.hadoop.fs.FileSystem getBackingFs()
                                             throws IOException
Returns the underlying filesystem

Returns:
The underlying FileSystem for this FilterFileSystem object.
Throws:
IOException

useHBaseChecksum

public boolean useHBaseChecksum()
Are we verifying checksums in HBase?

Returns:
True, if hbase is configured to verify checksums, otherwise false.

close

public void close()
           throws IOException
Close this filesystem object

Specified by:
close in interface Closeable
Overrides:
close in class org.apache.hadoop.fs.FilterFileSystem
Throws:
IOException

addLocationsOrderInterceptor

public static boolean addLocationsOrderInterceptor(org.apache.hadoop.conf.Configuration conf)
                                            throws IOException
Throws:
IOException

get

public static org.apache.hadoop.fs.FileSystem get(org.apache.hadoop.conf.Configuration conf)
                                           throws IOException
Create a new HFileSystem object, similar to FileSystem.get(). This returns a filesystem object that avoids checksum verification in the filesystem for hfileblock-reads. For these blocks, checksum verification is done by HBase.

Throws:
IOException

getLocalFs

public static org.apache.hadoop.fs.FileSystem getLocalFs(org.apache.hadoop.conf.Configuration conf)
                                                  throws IOException
Wrap a LocalFileSystem within a HFileSystem.

Throws:
IOException

createNonRecursive

public org.apache.hadoop.fs.FSDataOutputStream createNonRecursive(org.apache.hadoop.fs.Path f,
                                                                  boolean overwrite,
                                                                  int bufferSize,
                                                                  short replication,
                                                                  long blockSize,
                                                                  org.apache.hadoop.util.Progressable progress)
                                                           throws IOException
The org.apache.hadoop.fs.FilterFileSystem does not yet support createNonRecursive. This is a hadoop bug and when it is fixed in Hadoop, this definition will go away.

Overrides:
createNonRecursive in class org.apache.hadoop.fs.FileSystem
Throws:
IOException


Copyright © 2007-2016 The Apache Software Foundation. All Rights Reserved.