|
||||||||||
| 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 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 Map<String,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 Map<String,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 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 |
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,
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 IOException
fs - filesystem objectdir - directory to delete
dir
IOException - e
public org.apache.hadoop.fs.Path checkdir(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path dir)
throws IOException
fs - filesystem objectdir - path to check
IOException - e
public static org.apache.hadoop.fs.Path create(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path p)
throws IOException
fs - filesystem objectp - path to create
IOException - e
public static void checkFileSystemAvailable(org.apache.hadoop.fs.FileSystem fs)
throws IOException
fs - filesystem
IOException - e
public static String getVersion(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path rootdir)
throws IOException
fs - filesystem objectrootdir - root hbase directory
IOException - e
public static void checkVersion(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path rootdir,
boolean message)
throws IOException
fs - file systemrootdir - root directory of HBase installationmessage - if true, issues a message on System.out
IOException - e
public static void setVersion(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path rootdir)
throws IOException
fs - filesystem objectrootdir - hbase root
IOException - e
public static void setVersion(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path rootdir,
String version)
throws IOException
fs - filesystem objectrootdir - hbase root directoryversion - version to set
IOException - e
public static org.apache.hadoop.fs.Path validateRootPath(org.apache.hadoop.fs.Path root)
throws IOException
root - root directory path
root argument.
IOException - if not a valid URI with a scheme
public static void waitOnSafeMode(org.apache.hadoop.conf.Configuration conf,
long wait)
throws IOException
conf - configurationwait - Sleep between retries
IOException - epublic static 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 IOException
c - configuration
hbase.rootdir from
configuration as a Path.
IOException - e
public static boolean rootRegionExists(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path rootdir)
throws IOException
fs - file systemrootdir - root directory of HBase installation
IOException - e
public static boolean isMajorCompacted(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path hbaseRootDir)
throws IOException
fs - filesystemhbaseRootDir - hbase root directory
IOException - e
public static int getTotalTableFragmentation(HMaster master)
throws IOException
master - The master defining the HBase root and file system.
IOException - When scanning the directory fails.
public static Map<String,Integer> getTableFragmentation(HMaster master)
throws IOException
master - The master defining the HBase root and file system.
IOException - When scanning the directory fails.
public static Map<String,Integer> getTableFragmentation(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path hbaseRootDir)
throws IOException
fs - The file system to use.hbaseRootDir - The root directory to scan.
IOException - When scanning the directory fails.
public static boolean isPre020FileLayout(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path hbaseRootDir)
throws IOException
fs - filesystemhbaseRootDir - hbase root directory
IOException - e
public static boolean isMajorCompactedPre020(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path hbaseRootDir)
throws 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
IOException - epublic static boolean isAppendSupported(org.apache.hadoop.conf.Configuration conf)
conf -
public static void recoverFileLease(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path p,
org.apache.hadoop.conf.Configuration conf)
throws IOException
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||