Package org.apache.hadoop.hbase.util
Class HFileArchiveTestingUtil
java.lang.Object
org.apache.hadoop.hbase.util.HFileArchiveTestingUtil
Test helper for testing archiving of HFiles
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static StringassertArchiveEquality(List<String> expected, List<String> archived) static voidassertArchiveEqualToOriginal(org.apache.hadoop.fs.FileStatus[] expected, org.apache.hadoop.fs.FileStatus[] actual, org.apache.hadoop.fs.FileSystem fs) Compare the archived files to the files in the original directorystatic voidassertArchiveEqualToOriginal(org.apache.hadoop.fs.FileStatus[] expected, org.apache.hadoop.fs.FileStatus[] actual, org.apache.hadoop.fs.FileSystem fs, boolean hasTimedBackup) Compare the archived files to the files in the original directorystatic booleancompareArchiveToOriginal(org.apache.hadoop.fs.FileStatus[] previous, org.apache.hadoop.fs.FileStatus[] archived, org.apache.hadoop.fs.FileSystem fs, boolean hasTimedBackup) private static StringcompareFileLists(List<String> expected, List<String> gotten) convertToString(List<org.apache.hadoop.fs.FileStatus> files) convertToString(org.apache.hadoop.fs.FileStatus[] files) getFileLists(org.apache.hadoop.fs.FileStatus[] previous, org.apache.hadoop.fs.FileStatus[] archived) Returns <expected, gotten, backup>, where each is sortedstatic org.apache.hadoop.fs.PathgetRegionArchiveDir(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.hbase.regionserver.HRegion region) Helper method to get the archive directory for the specified regionstatic org.apache.hadoop.fs.PathgetStoreArchivePath(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.hbase.regionserver.HRegion region, org.apache.hadoop.hbase.regionserver.Store store) Helper method to get the store archive directory for the specified regionstatic org.apache.hadoop.fs.PathgetStoreArchivePath(HBaseTestingUtil util, String tableName, byte[] storeName)
-
Field Details
-
LOG
-
-
Constructor Details
-
HFileArchiveTestingUtil
private HFileArchiveTestingUtil()
-
-
Method Details
-
compareArchiveToOriginal
public static boolean compareArchiveToOriginal(org.apache.hadoop.fs.FileStatus[] previous, org.apache.hadoop.fs.FileStatus[] archived, org.apache.hadoop.fs.FileSystem fs, boolean hasTimedBackup) -
assertArchiveEqualToOriginal
public static void assertArchiveEqualToOriginal(org.apache.hadoop.fs.FileStatus[] expected, org.apache.hadoop.fs.FileStatus[] actual, org.apache.hadoop.fs.FileSystem fs) throws IOException Compare the archived files to the files in the original directory- Parameters:
expected- original files that should have been archivedactual- files that were archivedfs- filessystem on which the archiving took place- Throws:
IOException
-
assertArchiveEqualToOriginal
public static void assertArchiveEqualToOriginal(org.apache.hadoop.fs.FileStatus[] expected, org.apache.hadoop.fs.FileStatus[] actual, org.apache.hadoop.fs.FileSystem fs, boolean hasTimedBackup) throws IOException Compare the archived files to the files in the original directory- Parameters:
expected- original files that should have been archivedactual- files that were archivedfs-FileSystemon which the archiving took placehasTimedBackup- true if we expect to find an archive backup directory with a copy of the files in the archive directory (and the original files).- Throws:
IOException
-
assertArchiveEquality
-
getFileLists
private static List<List<String>> getFileLists(org.apache.hadoop.fs.FileStatus[] previous, org.apache.hadoop.fs.FileStatus[] archived) Returns <expected, gotten, backup>, where each is sorted -
convertToString
-
convertToString
-
compareFileLists
-
getRegionArchiveDir
public static org.apache.hadoop.fs.Path getRegionArchiveDir(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.hbase.regionserver.HRegion region) throws IOException Helper method to get the archive directory for the specified region- Parameters:
conf-Configurationto check for the name of the archive directoryregion- region that is being archived- Returns:
Pathto the archive directory for the given region- Throws:
IOException
-
getStoreArchivePath
public static org.apache.hadoop.fs.Path getStoreArchivePath(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.hbase.regionserver.HRegion region, org.apache.hadoop.hbase.regionserver.Store store) throws IOException Helper method to get the store archive directory for the specified region- Parameters:
conf-Configurationto check for the name of the archive directoryregion- region that is being archivedstore- store that is archiving files- Returns:
Pathto the store archive directory for the given region- Throws:
IOException
-
getStoreArchivePath
public static org.apache.hadoop.fs.Path getStoreArchivePath(HBaseTestingUtil util, String tableName, byte[] storeName) throws IOException - Throws:
IOException
-