Modifier and Type | Class and Description |
---|---|
static class |
FSUtils.BlackListDirFilter
Directory filter that doesn't include any of the directories in the specified blacklist
|
static class |
FSUtils.DirFilter
A
PathFilter that only allows directories. |
static class |
FSUtils.FamilyDirFilter
Filter for all dirs that are legal column family names.
|
(package private) static class |
FSUtils.FileFilter
A
PathFilter that returns only regular files. |
static class |
FSUtils.HFileFilter
Filter for HFiles that excludes reference files.
|
static class |
FSUtils.HFileLinkFilter
Filter for HFileLinks (StoreFiles and HFiles not included).
|
(package private) static interface |
FSUtils.ProgressReporter
Called every so-often by storefile map builder getTableStoreFilePathMap to
report progress.
|
static class |
FSUtils.ReferenceFileFilter |
static class |
FSUtils.RegionDirFilter
Filter for all dirs that don't start with '.'
|
static class |
FSUtils.UserTableDirFilter
A
PathFilter that returns usertable directories. |
Modifier and Type | Field and Description |
---|---|
private static int |
DEFAULT_THREAD_POOLSIZE |
private static org.slf4j.Logger |
LOG |
private static String |
THREAD_POOLSIZE |
static boolean |
WINDOWS
Set to true on Windows platforms
|
Modifier | Constructor and Description |
---|---|
private |
FSUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
addToHDFSBlocksDistribution(HDFSBlocksDistribution blocksDistribution,
org.apache.hadoop.fs.BlockLocation[] blockLocations)
Update blocksDistribution with blockLocations
|
static boolean |
checkClusterIdExists(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path rootdir,
long wait)
Checks that a cluster ID file exists in the HBase root directory
|
static void |
checkDfsSafeMode(org.apache.hadoop.conf.Configuration conf)
Check whether dfs is in safemode.
|
static void |
checkFileSystemAvailable(org.apache.hadoop.fs.FileSystem fs)
Checks to see if the specified file system is available
|
static void |
checkShortCircuitReadBufferSize(org.apache.hadoop.conf.Configuration conf)
Check if short circuit read buffer size is set and if not, set it to hbase value.
|
static void |
checkVersion(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path rootdir,
boolean message)
Verifies current version of file system
|
static void |
checkVersion(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path rootdir,
boolean message,
int wait,
int retries)
Verifies current version of file system
|
static HDFSBlocksDistribution |
computeHDFSBlocksDistribution(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.FileStatus status,
long start,
long length)
Compute HDFS blocks distribution of a given file, or a portion of the file
|
private static List<org.apache.hadoop.fs.Path> |
copyFiles(org.apache.hadoop.fs.FileSystem srcFS,
org.apache.hadoop.fs.Path src,
org.apache.hadoop.fs.FileSystem dstFS,
org.apache.hadoop.fs.Path dst,
org.apache.hadoop.conf.Configuration conf,
ExecutorService pool,
List<Future<Void>> futures) |
static List<org.apache.hadoop.fs.Path> |
copyFilesParallel(org.apache.hadoop.fs.FileSystem srcFS,
org.apache.hadoop.fs.Path src,
org.apache.hadoop.fs.FileSystem dstFS,
org.apache.hadoop.fs.Path dst,
org.apache.hadoop.conf.Configuration conf,
int threads) |
static org.apache.hadoop.fs.FSDataOutputStream |
create(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path,
org.apache.hadoop.fs.permission.FsPermission perm,
InetSocketAddress[] favoredNodes)
Create the specified file on the filesystem.
|
static boolean |
deleteRegionDir(org.apache.hadoop.conf.Configuration conf,
RegionInfo hri)
Delete the region directory if exists.
|
static List<org.apache.hadoop.fs.FileStatus> |
filterFileStatuses(org.apache.hadoop.fs.FileStatus[] input,
FileStatusFilter filter)
Filters FileStatuses in an array and returns a list
|
static List<org.apache.hadoop.fs.FileStatus> |
filterFileStatuses(Iterator<org.apache.hadoop.fs.FileStatus> input,
FileStatusFilter filter)
Filters FileStatuses in an iterator and returns a list
|
static ClusterId |
getClusterId(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path rootdir)
Returns the value of the unique cluster ID stored for this HBase instance.
|
static org.apache.hadoop.hdfs.DFSHedgedReadMetrics |
getDFSHedgedReadMetrics(org.apache.hadoop.conf.Configuration c) |
static List<org.apache.hadoop.fs.Path> |
getFamilyDirs(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path regionDir)
Given a particular region dir, return all the familydirs inside it
|
static List<org.apache.hadoop.fs.Path> |
getLocalTableDirs(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path rootdir) |
private static Set<InetSocketAddress> |
getNNAddresses(org.apache.hadoop.hdfs.DistributedFileSystem fs,
org.apache.hadoop.conf.Configuration conf) |
static List<org.apache.hadoop.fs.Path> |
getReferenceFilePaths(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path familyDir) |
static Map<String,Map<String,Float>> |
getRegionDegreeLocalityMappingFromFS(org.apache.hadoop.conf.Configuration conf)
This function is to scan the root path of the file system to get the
degree of locality for each region on each of the servers having at least
one block of that region.
|
static Map<String,Map<String,Float>> |
getRegionDegreeLocalityMappingFromFS(org.apache.hadoop.conf.Configuration conf,
String desiredTable,
int threadPoolSize)
This function is to scan the root path of the file system to get the
degree of locality for each region on each of the servers having at least
one block of that region.
|
static org.apache.hadoop.fs.Path |
getRegionDirFromRootDir(org.apache.hadoop.fs.Path rootDir,
RegionInfo region) |
static org.apache.hadoop.fs.Path |
getRegionDirFromTableDir(org.apache.hadoop.fs.Path tableDir,
RegionInfo region) |
static org.apache.hadoop.fs.Path |
getRegionDirFromTableDir(org.apache.hadoop.fs.Path tableDir,
String encodedRegionName) |
static List<org.apache.hadoop.fs.Path> |
getRegionDirs(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path tableDir)
Given a particular table dir, return all the regiondirs inside it, excluding files such as
.tableinfo
|
private static void |
getRegionLocalityMappingFromFS(org.apache.hadoop.conf.Configuration conf,
String desiredTable,
int threadPoolSize,
Map<String,Map<String,Float>> regionDegreeLocalityMapping)
This function is to scan the root path of the file system to get either the
mapping between the region name and its best locality region server or the
degree of locality of each region on each of the servers having at least
one block of that region.
|
static int |
getRegionReferenceFileCount(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path p) |
static List<org.apache.hadoop.fs.Path> |
getTableDirs(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path rootdir) |
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 Map<String,org.apache.hadoop.fs.Path> |
getTableStoreFilePathMap(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path hbaseRootDir)
Runs through the HBase rootdir and creates a reverse lookup map for
table StoreFile names to the full Path.
|
static Map<String,org.apache.hadoop.fs.Path> |
getTableStoreFilePathMap(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path hbaseRootDir,
org.apache.hadoop.fs.PathFilter sfFilter,
ExecutorService executor,
FSUtils.ProgressReporter progressReporter)
Runs through the HBase rootdir and creates a reverse lookup map for
table StoreFile names to the full Path.
|
static Map<String,org.apache.hadoop.fs.Path> |
getTableStoreFilePathMap(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path hbaseRootDir,
org.apache.hadoop.fs.PathFilter sfFilter,
ExecutorService executor,
HbckErrorReporter progressReporter)
Deprecated.
Since 2.3.0. Will be removed in hbase4. Used
getTableStoreFilePathMap(FileSystem, Path, PathFilter, ExecutorService, ProgressReporter) |
static Map<String,org.apache.hadoop.fs.Path> |
getTableStoreFilePathMap(Map<String,org.apache.hadoop.fs.Path> map,
org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path hbaseRootDir,
TableName tableName)
Runs through the HBase rootdir/tablename and creates a reverse lookup map for
table StoreFile names to the full Path.
|
static Map<String,org.apache.hadoop.fs.Path> |
getTableStoreFilePathMap(Map<String,org.apache.hadoop.fs.Path> resultMap,
org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path hbaseRootDir,
TableName tableName,
org.apache.hadoop.fs.PathFilter sfFilter,
ExecutorService executor,
FSUtils.ProgressReporter progressReporter)
Runs through the HBase rootdir/tablename and creates a reverse lookup map for
table StoreFile names to the full Path.
|
static Map<String,org.apache.hadoop.fs.Path> |
getTableStoreFilePathMap(Map<String,org.apache.hadoop.fs.Path> resultMap,
org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path hbaseRootDir,
TableName tableName,
org.apache.hadoop.fs.PathFilter sfFilter,
ExecutorService executor,
HbckErrorReporter progressReporter)
Deprecated.
Since 2.3.0. For removal in hbase4. Use ProgressReporter override instead.
|
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 |
isDistributedFileSystem(org.apache.hadoop.fs.FileSystem fs) |
private static boolean |
isInSafeMode(org.apache.hadoop.hdfs.DistributedFileSystem dfs)
We use reflection because
DistributedFileSystem.setSafeMode(
HdfsConstants.SafeModeAction action, boolean isChecked) is not in hadoop 1.1 |
static boolean |
isMatchingTail(org.apache.hadoop.fs.Path pathToSearch,
org.apache.hadoop.fs.Path pathTail)
Compare path component of the Path URI; e.g.
|
static boolean |
isSameHdfs(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.FileSystem srcFs,
org.apache.hadoop.fs.FileSystem desFs) |
static List<org.apache.hadoop.fs.FileStatus> |
listStatusWithStatusFilter(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path dir,
FileStatusFilter filter)
Calls fs.listStatus() and treats FileNotFoundException as non-fatal
This accommodates differences between hadoop versions, where hadoop 1
does not throw a FileNotFoundException, and return an empty FileStatus[]
while Hadoop 2 will throw FileNotFoundException.
|
static boolean |
metaRegionExists(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path rootDir)
Checks if meta region exists
|
(package private) static String |
parseVersionFrom(byte[] bytes)
Parse the content of the ${HBASE_ROOTDIR}/hbase.version file.
|
private static void |
rewriteAsPb(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path rootdir,
org.apache.hadoop.fs.Path p,
ClusterId cid) |
static void |
setClusterId(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path rootdir,
ClusterId clusterId,
int wait)
Writes a new unique identifier for this cluster to the "hbase.id" file
in the HBase root directory
|
static void |
setupShortCircuitRead(org.apache.hadoop.conf.Configuration conf)
Do our short circuit read setup.
|
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,
int wait,
int retries)
Sets version of file system
|
static void |
setVersion(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path rootdir,
String version,
int wait,
int retries)
Sets version of file system
|
(package private) static byte[] |
toVersionByteArray(String version)
Create the content to write into the ${HBASE_ROOTDIR}/hbase.version file.
|
static void |
waitOnSafeMode(org.apache.hadoop.conf.Configuration conf,
long wait)
If DFS, check safe mode and if so, wait until we clear it.
|
private static final org.slf4j.Logger LOG
private static final String THREAD_POOLSIZE
private static final int DEFAULT_THREAD_POOLSIZE
public static final boolean WINDOWS
private FSUtils()
public static boolean isDistributedFileSystem(org.apache.hadoop.fs.FileSystem fs) throws IOException
fs
is instance of DistributedFileSystemIOException
public static boolean isMatchingTail(org.apache.hadoop.fs.Path pathToSearch, org.apache.hadoop.fs.Path pathTail)
pathToSearch
- Path we will be trying to match.pathTail
- pathTail
is tail on the path of pathToSearch
public static boolean deleteRegionDir(org.apache.hadoop.conf.Configuration conf, RegionInfo hri) throws IOException
IOException
public static org.apache.hadoop.fs.FSDataOutputStream create(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path, org.apache.hadoop.fs.permission.FsPermission perm, InetSocketAddress[] favoredNodes) throws IOException
ColumnFamilyDescriptorBuilder.DEFAULT_DFS_REPLICATION
conf
- configurationsfs
- FileSystem
on which to write the filepath
- Path
to the file to writeperm
- permissionsfavoredNodes
- favored data nodesIOException
- if the file cannot be createdpublic static void checkFileSystemAvailable(org.apache.hadoop.fs.FileSystem fs) throws IOException
fs
- filesystemIOException
- eprivate static boolean isInSafeMode(org.apache.hadoop.hdfs.DistributedFileSystem dfs) throws IOException
DistributedFileSystem.setSafeMode(
HdfsConstants.SafeModeAction action, boolean isChecked)
is not in hadoop 1.1dfs
- IOException
public static void checkDfsSafeMode(org.apache.hadoop.conf.Configuration conf) throws IOException
conf
- IOException
public static String getVersion(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path rootdir) throws IOException, DeserializationException
fs
- filesystem objectrootdir
- root hbase directoryIOException
- if the version file fails to openDeserializationException
- if the version data cannot be translated into a versionstatic String parseVersionFrom(byte[] bytes) throws DeserializationException
bytes
- The byte content of the hbase.version fileDeserializationException
- if the version data cannot be translated into a versionstatic byte[] toVersionByteArray(String version)
version
- Version to persistversion
content and a bit of pb magic for a prefix.public static void checkVersion(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path rootdir, boolean message) throws IOException, DeserializationException
fs
- file systemrootdir
- root directory of HBase installationmessage
- if true, issues a message on System.outIOException
- if the version file cannot be openedDeserializationException
- if the contents of the version file cannot be parsedpublic static void checkVersion(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path rootdir, boolean message, int wait, int retries) throws IOException, DeserializationException
fs
- file systemrootdir
- root directory of HBase installationmessage
- if true, issues a message on System.outwait
- wait intervalretries
- number of times to retryIOException
- if the version file cannot be openedDeserializationException
- if the contents of the version file cannot be parsedpublic static void setVersion(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path rootdir) throws IOException
fs
- filesystem objectrootdir
- hbase rootIOException
- epublic static void setVersion(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path rootdir, int wait, int retries) throws IOException
fs
- filesystem objectrootdir
- hbase rootwait
- time to wait for retryretries
- number of times to retry before failingIOException
- epublic static void setVersion(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path rootdir, String version, int wait, int retries) throws IOException
fs
- filesystem objectrootdir
- hbase root directoryversion
- version to setwait
- time to wait for retryretries
- number of times to retry before throwing an IOExceptionIOException
- epublic static boolean checkClusterIdExists(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path rootdir, long wait) throws IOException
fs
- the root directory FileSystemrootdir
- the HBase root directory in HDFSwait
- how long to wait between retriestrue
if the file exists, otherwise false
IOException
- if checking the FileSystem failspublic static ClusterId getClusterId(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path rootdir) throws IOException
fs
- the root directory FileSystemrootdir
- the path to the HBase root directoryIOException
- if reading the cluster ID file failsprivate static void rewriteAsPb(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path rootdir, org.apache.hadoop.fs.Path p, ClusterId cid) throws IOException
cid
- IOException
public static void setClusterId(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path rootdir, ClusterId clusterId, int wait) throws IOException
fs
- the root directory FileSystemrootdir
- the path to the HBase root directoryclusterId
- the unique identifier to storewait
- how long (in milliseconds) to wait between retriesIOException
- if writing to the FileSystem fails and no wait valuepublic static void waitOnSafeMode(org.apache.hadoop.conf.Configuration conf, long wait) throws IOException
conf
- configurationwait
- Sleep between retriesIOException
- epublic static boolean metaRegionExists(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path rootDir) throws IOException
fs
- file systemrootDir
- root directory of HBase installationIOException
public static HDFSBlocksDistribution computeHDFSBlocksDistribution(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.FileStatus status, long start, long length) throws IOException
fs
- file systemstatus
- file status of the filestart
- start position of the portionlength
- length of the portionIOException
public static void addToHDFSBlocksDistribution(HDFSBlocksDistribution blocksDistribution, org.apache.hadoop.fs.BlockLocation[] blockLocations) throws IOException
blocksDistribution
- the hdfs blocks distributionblockLocations
- an array containing block locationIOException
public static int getTotalTableFragmentation(HMaster master) throws IOException
master
- The master defining the HBase root and file systemIOException
- When scanning the directory failspublic 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 usehbaseRootDir
- The root directory to scanIOException
- When scanning the directory failspublic static List<org.apache.hadoop.fs.Path> getTableDirs(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path rootdir) throws IOException
IOException
public static List<org.apache.hadoop.fs.Path> getLocalTableDirs(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path rootdir) throws IOException
fs
- rootdir
- rootdir
. Ignore non table hbase folders such as
.logs, .oldlogs, .corrupt folders.IOException
public static List<org.apache.hadoop.fs.Path> getRegionDirs(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path tableDir) throws IOException
fs
- A file system for the PathtableDir
- Path to a specific table directory <hbase.rootdir>/<tabledir>IOException
public static org.apache.hadoop.fs.Path getRegionDirFromRootDir(org.apache.hadoop.fs.Path rootDir, RegionInfo region)
public static org.apache.hadoop.fs.Path getRegionDirFromTableDir(org.apache.hadoop.fs.Path tableDir, RegionInfo region)
public static org.apache.hadoop.fs.Path getRegionDirFromTableDir(org.apache.hadoop.fs.Path tableDir, String encodedRegionName)
public static List<org.apache.hadoop.fs.Path> getFamilyDirs(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path regionDir) throws IOException
fs
- A file system for the PathregionDir
- Path to a specific region directoryIOException
public static List<org.apache.hadoop.fs.Path> getReferenceFilePaths(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path familyDir) throws IOException
IOException
public static Map<String,org.apache.hadoop.fs.Path> getTableStoreFilePathMap(Map<String,org.apache.hadoop.fs.Path> map, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path hbaseRootDir, TableName tableName) throws IOException, InterruptedException
map
- map to add values. If null, this method will create and populate one to returnfs
- The file system to use.hbaseRootDir
- The root directory to scan.tableName
- name of the table to scan.IOException
- When scanning the directory fails.InterruptedException
@Deprecated public static Map<String,org.apache.hadoop.fs.Path> getTableStoreFilePathMap(Map<String,org.apache.hadoop.fs.Path> resultMap, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path hbaseRootDir, TableName tableName, org.apache.hadoop.fs.PathFilter sfFilter, ExecutorService executor, HbckErrorReporter progressReporter) throws IOException, InterruptedException
resultMap
- map to add values. If null, this method will create and populate one to returnfs
- The file system to use.hbaseRootDir
- The root directory to scan.tableName
- name of the table to scan.sfFilter
- optional path filter to apply to store filesexecutor
- optional executor service to parallelize this operationprogressReporter
- Instance or null; gets called every time we move to new region of
family dir and for each store file.IOException
- When scanning the directory fails.InterruptedException
public static Map<String,org.apache.hadoop.fs.Path> getTableStoreFilePathMap(Map<String,org.apache.hadoop.fs.Path> resultMap, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path hbaseRootDir, TableName tableName, org.apache.hadoop.fs.PathFilter sfFilter, ExecutorService executor, FSUtils.ProgressReporter progressReporter) throws IOException, InterruptedException
resultMap
- map to add values. If null, this method will create and populate one
to returnfs
- The file system to use.hbaseRootDir
- The root directory to scan.tableName
- name of the table to scan.sfFilter
- optional path filter to apply to store filesexecutor
- optional executor service to parallelize this operationprogressReporter
- Instance or null; gets called every time we move to new region of
family dir and for each store file.IOException
- When scanning the directory fails.InterruptedException
- the thread is interrupted, either before or during the activity.public static int getRegionReferenceFileCount(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path p)
public static Map<String,org.apache.hadoop.fs.Path> getTableStoreFilePathMap(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path hbaseRootDir) throws IOException, InterruptedException
fs
- The file system to use.hbaseRootDir
- The root directory to scan.IOException
- When scanning the directory fails.InterruptedException
@Deprecated public static Map<String,org.apache.hadoop.fs.Path> getTableStoreFilePathMap(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path hbaseRootDir, org.apache.hadoop.fs.PathFilter sfFilter, ExecutorService executor, HbckErrorReporter progressReporter) throws IOException, InterruptedException
getTableStoreFilePathMap(FileSystem, Path, PathFilter, ExecutorService, ProgressReporter)
fs
- The file system to use.hbaseRootDir
- The root directory to scan.sfFilter
- optional path filter to apply to store filesexecutor
- optional executor service to parallelize this operationprogressReporter
- Instance or null; gets called every time we move to new region of
family dir and for each store file.IOException
- When scanning the directory fails.InterruptedException
public static Map<String,org.apache.hadoop.fs.Path> getTableStoreFilePathMap(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path hbaseRootDir, org.apache.hadoop.fs.PathFilter sfFilter, ExecutorService executor, FSUtils.ProgressReporter progressReporter) throws IOException, InterruptedException
fs
- The file system to use.hbaseRootDir
- The root directory to scan.sfFilter
- optional path filter to apply to store filesexecutor
- optional executor service to parallelize this operationprogressReporter
- Instance or null; gets called every time we move to new region of
family dir and for each store file.IOException
- When scanning the directory fails.InterruptedException
public static List<org.apache.hadoop.fs.FileStatus> filterFileStatuses(org.apache.hadoop.fs.FileStatus[] input, FileStatusFilter filter)
input
- An array of FileStatusesfilter
- A required filter to filter the arraypublic static List<org.apache.hadoop.fs.FileStatus> filterFileStatuses(Iterator<org.apache.hadoop.fs.FileStatus> input, FileStatusFilter filter)
input
- An iterator of FileStatusesfilter
- A required filter to filter the arraypublic static List<org.apache.hadoop.fs.FileStatus> listStatusWithStatusFilter(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path dir, FileStatusFilter filter) throws IOException
fs
- file systemdir
- directoryfilter
- file status filterIOException
public static Map<String,Map<String,Float>> getRegionDegreeLocalityMappingFromFS(org.apache.hadoop.conf.Configuration conf) throws IOException
RegionPlacementMaintainer
conf
- the configuration to useIOException
- in case of file system errors or interruptspublic static Map<String,Map<String,Float>> getRegionDegreeLocalityMappingFromFS(org.apache.hadoop.conf.Configuration conf, String desiredTable, int threadPoolSize) throws IOException
conf
- the configuration to usedesiredTable
- the table you wish to scan locality forthreadPoolSize
- the thread pool size to useIOException
- in case of file system errors or interruptsprivate static void getRegionLocalityMappingFromFS(org.apache.hadoop.conf.Configuration conf, String desiredTable, int threadPoolSize, Map<String,Map<String,Float>> regionDegreeLocalityMapping) throws IOException
conf
- the configuration to usedesiredTable
- the table you wish to scan locality forthreadPoolSize
- the thread pool size to useregionDegreeLocalityMapping
- the map into which to put the locality degree mapping or null,
must be a thread-safe implementationIOException
- in case of file system errors or interruptspublic static void setupShortCircuitRead(org.apache.hadoop.conf.Configuration conf)
conf
- public static void checkShortCircuitReadBufferSize(org.apache.hadoop.conf.Configuration conf)
conf
- public static org.apache.hadoop.hdfs.DFSHedgedReadMetrics getDFSHedgedReadMetrics(org.apache.hadoop.conf.Configuration c) throws IOException
c
- IOException
public static List<org.apache.hadoop.fs.Path> copyFilesParallel(org.apache.hadoop.fs.FileSystem srcFS, org.apache.hadoop.fs.Path src, org.apache.hadoop.fs.FileSystem dstFS, org.apache.hadoop.fs.Path dst, org.apache.hadoop.conf.Configuration conf, int threads) throws IOException
IOException
private static List<org.apache.hadoop.fs.Path> copyFiles(org.apache.hadoop.fs.FileSystem srcFS, org.apache.hadoop.fs.Path src, org.apache.hadoop.fs.FileSystem dstFS, org.apache.hadoop.fs.Path dst, org.apache.hadoop.conf.Configuration conf, ExecutorService pool, List<Future<Void>> futures) throws IOException
IOException
private static Set<InetSocketAddress> getNNAddresses(org.apache.hadoop.hdfs.DistributedFileSystem fs, org.apache.hadoop.conf.Configuration conf)
public static boolean isSameHdfs(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem srcFs, org.apache.hadoop.fs.FileSystem desFs)
conf
- the Configuration of HBaseCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.