@InterfaceAudience.Private public class HRegionFileSystem extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static Log |
LOG |
static java.lang.String |
REGION_INFO_FILE
Name of the region info file that resides just under the region directory.
|
static java.lang.String |
REGION_MERGES_DIR
Temporary subdirectory of the region directory used for merges.
|
static java.lang.String |
REGION_SPLITS_DIR
Temporary subdirectory of the region directory used for splits.
|
| Modifier and Type | Method and Description |
|---|---|
Path |
commitStoreFile(java.lang.String familyName,
Path buildPath)
Move the file from a build/temp location to the main family store directory.
|
static HRegionFileSystem |
createRegionOnFileSystem(Configuration conf,
FileSystem fs,
Path tableDir,
HRegionInfo regionInfo)
Create a new Region on file-system.
|
Path |
createTempName()
Generate a unique temporary Path.
|
Path |
createTempName(java.lang.String suffix)
Generate a unique temporary Path.
|
void |
deleteFamily(java.lang.String familyName)
Remove the region family from disk, archiving the store files.
|
static void |
deleteRegionFromFileSystem(Configuration conf,
FileSystem fs,
Path tableDir,
HRegionInfo regionInfo)
Remove the region from the table directory, archiving the region's hfiles.
|
java.util.Collection<java.lang.String> |
getFamilies() |
FileSystem |
getFileSystem() |
Path |
getRegionDir() |
HRegionInfo |
getRegionInfo() |
HRegionInfo |
getRegionInfoForFS() |
Path |
getStoreDir(java.lang.String familyName)
Returns the directory path of the specified family
|
java.util.Collection<StoreFileInfo> |
getStoreFiles(byte[] familyName)
Returns the store files available for the family.
|
java.util.Collection<StoreFileInfo> |
getStoreFiles(java.lang.String familyName) |
java.util.Collection<StoreFileInfo> |
getStoreFiles(java.lang.String familyName,
boolean validate)
Returns the store files available for the family.
|
Path |
getTableDir() |
boolean |
hasReferences(HTableDescriptor htd)
Check whether region has Reference file
|
boolean |
hasReferences(java.lang.String familyName)
Returns true if the specified family has reference files
|
static HRegionInfo |
loadRegionInfoFileContent(FileSystem fs,
Path regionDir)
Create a
HRegionInfo from the serialized version on-disk. |
static HRegionFileSystem |
openRegionFromFileSystem(Configuration conf,
FileSystem fs,
Path tableDir,
HRegionInfo regionInfo,
boolean readOnly)
Open Region from file-system.
|
void |
removeStoreFile(java.lang.String familyName,
Path filePath)
Archives the specified store file from the specified family.
|
void |
removeStoreFiles(java.lang.String familyName,
java.util.Collection<StoreFile> storeFiles)
Closes and archives the specified store files from the specified family.
|
public static final Log LOG
public static final java.lang.String REGION_INFO_FILE
public static final java.lang.String REGION_MERGES_DIR
public static final java.lang.String REGION_SPLITS_DIR
public FileSystem getFileSystem()
FileSystempublic HRegionInfo getRegionInfo()
HRegionInfo that describe this on-disk region viewpublic HRegionInfo getRegionInfoForFS()
public Path getTableDir()
Path to the region's root directory.public Path getRegionDir()
Path to the region directory.public Path getStoreDir(java.lang.String familyName)
familyName - Column Family NamePath to the directory of the specified familypublic java.util.Collection<StoreFileInfo> getStoreFiles(byte[] familyName) throws java.io.IOException
familyName - Column Family NameStoreFileInfo for the specified family.java.io.IOExceptionpublic java.util.Collection<StoreFileInfo> getStoreFiles(java.lang.String familyName) throws java.io.IOException
java.io.IOExceptionpublic java.util.Collection<StoreFileInfo> getStoreFiles(java.lang.String familyName, boolean validate) throws java.io.IOException
familyName - Column Family NameStoreFileInfo for the specified family.java.io.IOExceptionpublic boolean hasReferences(java.lang.String familyName)
throws java.io.IOException
familyName - Column Family Namejava.io.IOExceptionpublic boolean hasReferences(HTableDescriptor htd) throws java.io.IOException
htd - table desciptor of the regionjava.io.IOExceptionpublic java.util.Collection<java.lang.String> getFamilies()
throws java.io.IOException
java.io.IOExceptionpublic void deleteFamily(java.lang.String familyName)
throws java.io.IOException
familyName - Column Family Namejava.io.IOException - if an error occours during the archivingpublic Path createTempName()
Path file = fs.createTempName();
...StoreFile.Writer(file)...
fs.commitStoreFile("family", file);
Path of the temporary filepublic Path createTempName(java.lang.String suffix)
Path file = fs.createTempName();
...StoreFile.Writer(file)...
fs.commitStoreFile("family", file);
suffix - extra information to append to the generated namePath of the temporary filepublic Path commitStoreFile(java.lang.String familyName,
Path buildPath)
throws java.io.IOException
familyName - Family that will gain the filebuildPath - Path to the file to commit.Path of the committed filejava.io.IOExceptionpublic void removeStoreFile(java.lang.String familyName,
Path filePath)
throws java.io.IOException
familyName - Family that contains the store filesfilePath - Path to the store file to removejava.io.IOException - if the archiving failspublic void removeStoreFiles(java.lang.String familyName,
java.util.Collection<StoreFile> storeFiles)
throws java.io.IOException
familyName - Family that contains the store filesstoreFiles - set of store files to removejava.io.IOException - if the archiving failspublic static HRegionInfo loadRegionInfoFileContent(FileSystem fs, Path regionDir) throws java.io.IOException
HRegionInfo from the serialized version on-disk.fs - FileSystem that contains the Region Info fileregionDir - Path to the Region Directory that contains the Info fileHRegionInfo instance gotten from the Region Info file.java.io.IOException - if an error occurred during file open/read operation.public static HRegionFileSystem createRegionOnFileSystem(Configuration conf, FileSystem fs, Path tableDir, HRegionInfo regionInfo) throws java.io.IOException
conf - the Configuration to usefs - FileSystem from which to add the regiontableDir - Path to where the table is being storedregionInfo - HRegionInfo for region to be addedjava.io.IOException - if the region creation fails due to a FileSystem exception.public static HRegionFileSystem openRegionFromFileSystem(Configuration conf, FileSystem fs, Path tableDir, HRegionInfo regionInfo, boolean readOnly) throws java.io.IOException
conf - the Configuration to usefs - FileSystem from which to add the regiontableDir - Path to where the table is being storedregionInfo - HRegionInfo for region to be addedreadOnly - True if you don't want to edit the region datajava.io.IOException - if the region creation fails due to a FileSystem exception.public static void deleteRegionFromFileSystem(Configuration conf,
FileSystem fs,
Path tableDir,
HRegionInfo regionInfo)
throws java.io.IOException
conf - the Configuration to usefs - FileSystem from which to remove the regiontableDir - Path to where the table is being storedregionInfo - HRegionInfo for region to be deletedjava.io.IOException - if the request cannot be completed