|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.hadoop.hbase.util.FSUtils
public class FSUtils
Utility methods for interacting with the underlying file system.
| Nested Class Summary | |
|---|---|
static class |
FSUtils.DirFilter
A PathFilter that returns directories. |
| Method Summary | |
|---|---|
org.apache.hadoop.fs.Path |
checkdir(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path dir)
Check if directory exists. |
static void |
checkFileSystemAvailable(org.apache.hadoop.fs.FileSystem fs)
Checks to see if the specified file system is available |
static void |
checkVersion(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path rootdir,
boolean message)
Verifies current version of file system |
static org.apache.hadoop.fs.Path |
create(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path p)
Create file. |
static boolean |
deleteDirectory(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path dir)
Delete if exists. |
static java.lang.String |
getPath(org.apache.hadoop.fs.Path p)
Return the 'path' component of a Path. |
static org.apache.hadoop.fs.Path |
getRootDir(org.apache.hadoop.conf.Configuration c)
|
static java.util.Map<java.lang.String,java.lang.Integer> |
getTableFragmentation(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path hbaseRootDir)
Runs through the HBase rootdir and checks how many stores for each table have more than one file in them. |
static java.util.Map<java.lang.String,java.lang.Integer> |
getTableFragmentation(HMaster master)
Runs through the HBase rootdir and checks how many stores for each table have more than one file in them. |
static int |
getTotalTableFragmentation(HMaster master)
Returns the total overall fragmentation percentage. |
static java.lang.String |
getVersion(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path rootdir)
Verifies current version of file system |
static boolean |
isAppendSupported(org.apache.hadoop.conf.Configuration conf)
Heuristic to determine whether is safe or not to open a file for append Looks both for dfs.support.append and use reflection to search for SequenceFile.Writer.syncFs() or FSDataOutputStream.hflush() |
static boolean |
isHDFS(org.apache.hadoop.conf.Configuration conf)
|
static boolean |
isMajorCompacted(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path hbaseRootDir)
Runs through the hbase rootdir and checks all stores have only one file in them -- that is, they've been major compacted. |
static boolean |
isMajorCompactedPre020(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path hbaseRootDir)
Runs through the hbase rootdir and checks all stores have only one file in them -- that is, they've been major compacted. |
static boolean |
isPre020FileLayout(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path hbaseRootDir)
Expects to find -ROOT- directory. |
static void |
recoverFileLease(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path p,
org.apache.hadoop.conf.Configuration conf)
|
static boolean |
rootRegionExists(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path rootdir)
Checks if root region exists |
static void |
setVersion(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path rootdir)
Sets version of file system |
static void |
setVersion(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path rootdir,
java.lang.String version)
Sets version of file system |
static org.apache.hadoop.fs.Path |
validateRootPath(org.apache.hadoop.fs.Path root)
Verifies root directory path is a valid URI with a scheme |
static void |
waitOnSafeMode(org.apache.hadoop.conf.Configuration conf,
long wait)
If DFS, check safe mode and if so, wait until we clear it. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static boolean deleteDirectory(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path dir)
throws java.io.IOException
fs - filesystem objectdir - directory to delete
dir
java.io.IOException - e
public org.apache.hadoop.fs.Path checkdir(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path dir)
throws java.io.IOException
fs - filesystem objectdir - path to check
java.io.IOException - e
public static org.apache.hadoop.fs.Path create(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path p)
throws java.io.IOException
fs - filesystem objectp - path to create
java.io.IOException - e
public static void checkFileSystemAvailable(org.apache.hadoop.fs.FileSystem fs)
throws java.io.IOException
fs - filesystem
java.io.IOException - e
public static java.lang.String getVersion(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path rootdir)
throws java.io.IOException
fs - filesystem objectrootdir - root hbase directory
java.io.IOException - e
public static void checkVersion(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path rootdir,
boolean message)
throws java.io.IOException
fs - file systemrootdir - root directory of HBase installationmessage - if true, issues a message on System.out
java.io.IOException - e
public static void setVersion(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path rootdir)
throws java.io.IOException
fs - filesystem objectrootdir - hbase root
java.io.IOException - e
public static void setVersion(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path rootdir,
java.lang.String version)
throws java.io.IOException
fs - filesystem objectrootdir - hbase root directoryversion - version to set
java.io.IOException - e
public static org.apache.hadoop.fs.Path validateRootPath(org.apache.hadoop.fs.Path root)
throws java.io.IOException
root - root directory path
root argument.
java.io.IOException - if not a valid URI with a scheme
public static void waitOnSafeMode(org.apache.hadoop.conf.Configuration conf,
long wait)
throws java.io.IOException
conf - configurationwait - Sleep between retries
java.io.IOException - epublic static java.lang.String getPath(org.apache.hadoop.fs.Path p)
hdfs://example.org:9000/hbase_trunk/TestTable/compaction.dir,
this method returns /hbase_trunk/TestTable/compaction.dir.
This method is useful if you want to print out a Path without qualifying
Filesystem instance.
p - Filesystem Path whose 'path' component we are to return.
public static org.apache.hadoop.fs.Path getRootDir(org.apache.hadoop.conf.Configuration c)
throws java.io.IOException
c - configuration
hbase.rootdir from
configuration as a Path.
java.io.IOException - e
public static boolean rootRegionExists(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path rootdir)
throws java.io.IOException
fs - file systemrootdir - root directory of HBase installation
java.io.IOException - e
public static boolean isMajorCompacted(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path hbaseRootDir)
throws java.io.IOException
fs - filesystemhbaseRootDir - hbase root directory
java.io.IOException - e
public static int getTotalTableFragmentation(HMaster master)
throws java.io.IOException
master - The master defining the HBase root and file system.
java.io.IOException - When scanning the directory fails.
public static java.util.Map<java.lang.String,java.lang.Integer> getTableFragmentation(HMaster master)
throws java.io.IOException
master - The master defining the HBase root and file system.
java.io.IOException - When scanning the directory fails.
public static java.util.Map<java.lang.String,java.lang.Integer> getTableFragmentation(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path hbaseRootDir)
throws java.io.IOException
fs - The file system to use.hbaseRootDir - The root directory to scan.
java.io.IOException - When scanning the directory fails.
public static boolean isPre020FileLayout(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path hbaseRootDir)
throws java.io.IOException
fs - filesystemhbaseRootDir - hbase root directory
java.io.IOException - e
public static boolean isMajorCompactedPre020(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path hbaseRootDir)
throws java.io.IOException
isMajorCompacted(FileSystem, Path) in that it expects a
pre-0.20.0 hbase layout on the filesystem. Used migrating.
fs - filesystemhbaseRootDir - hbase root directory
java.io.IOException - epublic static boolean isAppendSupported(org.apache.hadoop.conf.Configuration conf)
conf -
public static boolean isHDFS(org.apache.hadoop.conf.Configuration conf)
throws java.io.IOException
conf -
java.io.IOException
public static void recoverFileLease(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path p,
org.apache.hadoop.conf.Configuration conf)
throws java.io.IOException
java.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||