Class HFileArchiveTestingUtil

java.lang.Object
org.apache.hadoop.hbase.util.HFileArchiveTestingUtil

public class HFileArchiveTestingUtil extends Object
Test helper for testing archiving of HFiles
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final org.slf4j.Logger
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private static String
    assertArchiveEquality(List<String> expected, List<String> archived)
     
    static void
    assertArchiveEqualToOriginal(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 directory
    static void
    assertArchiveEqualToOriginal(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 directory
    static boolean
    compareArchiveToOriginal(org.apache.hadoop.fs.FileStatus[] previous, org.apache.hadoop.fs.FileStatus[] archived, org.apache.hadoop.fs.FileSystem fs, boolean hasTimedBackup)
     
    private static String
    compareFileLists(List<String> expected, List<String> gotten)
     
    private static List<String>
    convertToString(List<org.apache.hadoop.fs.FileStatus> files)
     
    private static List<String>
    convertToString(org.apache.hadoop.fs.FileStatus[] files)
     
    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
    static org.apache.hadoop.fs.Path
    getRegionArchiveDir(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.hbase.regionserver.HRegion region)
    Helper method to get the archive directory for the specified region
    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)
    Helper method to get the store archive directory for the specified region
    static org.apache.hadoop.fs.Path
    getStoreArchivePath(HBaseTestingUtil util, String tableName, byte[] storeName)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • LOG

      private static final org.slf4j.Logger LOG
  • Constructor Details

  • 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 archived
      actual - files that were archived
      fs - 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 archived
      actual - files that were archived
      fs - FileSystem on which the archiving took place
      hasTimedBackup - 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

      private static String assertArchiveEquality(List<String> expected, List<String> archived)
    • 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

      private static List<String> convertToString(org.apache.hadoop.fs.FileStatus[] files)
    • convertToString

      private static List<String> convertToString(List<org.apache.hadoop.fs.FileStatus> files)
    • compareFileLists

      private static String compareFileLists(List<String> expected, List<String> gotten)
    • 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 - Configuration to check for the name of the archive directory
      region - region that is being archived
      Returns:
      Path to 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 - Configuration to check for the name of the archive directory
      region - region that is being archived
      store - store that is archiving files
      Returns:
      Path to 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