@InterfaceAudience.Private public final class SnapshotTestingUtils extends Object
| Modifier and Type | Class and Description | 
|---|---|
static class  | 
SnapshotTestingUtils.SnapshotMock  | 
| Modifier and Type | Field and Description | 
|---|---|
private static byte[] | 
KEYS  | 
private static org.slf4j.Logger | 
LOG  | 
| Modifier | Constructor and Description | 
|---|---|
private  | 
SnapshotTestingUtils()  | 
| Modifier and Type | Method and Description | 
|---|---|
static List<org.apache.hadoop.hbase.client.SnapshotDescription> | 
assertExistsMatchingSnapshot(org.apache.hadoop.hbase.client.Admin admin,
                            String snapshotName,
                            org.apache.hadoop.hbase.TableName tableName)
Make sure that there is only one snapshot returned from the master and its
 name and table match the passed in parameters. 
 | 
static void | 
assertNoSnapshots(org.apache.hadoop.hbase.client.Admin admin)
Assert that we don't have any snapshots lists 
 | 
static List<org.apache.hadoop.hbase.client.SnapshotDescription> | 
assertOneSnapshotThatMatches(org.apache.hadoop.hbase.client.Admin admin,
                            byte[] snapshot,
                            org.apache.hadoop.hbase.TableName tableName)
Make sure that there is only one snapshot returned from the master and its
 name and table match the passed in parameters. 
 | 
static void | 
assertOneSnapshotThatMatches(org.apache.hadoop.hbase.client.Admin admin,
                            org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshot)
Make sure that there is only one snapshot returned from the master 
 | 
static List<org.apache.hadoop.hbase.client.SnapshotDescription> | 
assertOneSnapshotThatMatches(org.apache.hadoop.hbase.client.Admin admin,
                            String snapshotName,
                            org.apache.hadoop.hbase.TableName tableName)
Make sure that there is only one snapshot returned from the master and its
 name and table match the passed in parameters. 
 | 
static void | 
cleanupSnapshot(org.apache.hadoop.hbase.client.Admin admin,
               byte[] tableName)  | 
static void | 
cleanupSnapshot(org.apache.hadoop.hbase.client.Admin admin,
               String snapshotName)  | 
static void | 
confirmEmptySnapshotValid(org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshotDescriptor,
                         org.apache.hadoop.hbase.TableName tableName,
                         byte[] testFamily,
                         org.apache.hadoop.fs.Path rootDir,
                         org.apache.hadoop.hbase.client.Admin admin,
                         org.apache.hadoop.fs.FileSystem fs)
Confirm that the snapshot has no references files but only metadata. 
 | 
static void | 
confirmSnapshotValid(HBaseTestingUtility testUtil,
                    org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshotDescriptor,
                    org.apache.hadoop.hbase.TableName tableName,
                    byte[] family)  | 
static void | 
confirmSnapshotValid(org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshotDescriptor,
                    org.apache.hadoop.hbase.TableName tableName,
                    byte[] testFamily,
                    org.apache.hadoop.fs.Path rootDir,
                    org.apache.hadoop.hbase.client.Admin admin,
                    org.apache.hadoop.fs.FileSystem fs)
Confirm that the snapshot contains references to all the files that should
 be in the snapshot. 
 | 
static void | 
confirmSnapshotValid(org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshotDescriptor,
                    org.apache.hadoop.hbase.TableName tableName,
                    List<byte[]> nonEmptyTestFamilies,
                    List<byte[]> emptyTestFamilies,
                    org.apache.hadoop.fs.Path rootDir,
                    org.apache.hadoop.hbase.client.Admin admin,
                    org.apache.hadoop.fs.FileSystem fs)
Confirm that the snapshot contains references to all the files that should
 be in the snapshot. 
 | 
static ArrayList | 
corruptSnapshot(HBaseTestingUtility util,
               String snapshotName)
Corrupt the specified snapshot by deleting some files. 
 | 
static void | 
createPreSplitTable(HBaseTestingUtility util,
                   org.apache.hadoop.hbase.TableName tableName,
                   int nRegions,
                   byte[]... families)  | 
private static org.apache.hadoop.hbase.client.Put | 
createPut(byte[][] families,
         byte[] key,
         byte[] value)  | 
static void | 
createSnapshotAndValidate(org.apache.hadoop.hbase.client.Admin admin,
                         org.apache.hadoop.hbase.TableName tableName,
                         List<byte[]> nonEmptyFamilyNames,
                         List<byte[]> emptyFamilyNames,
                         String snapshotNameString,
                         org.apache.hadoop.fs.Path rootDir,
                         org.apache.hadoop.fs.FileSystem fs,
                         boolean onlineSnapshot)
Take a snapshot of the specified table and verify the given families. 
 | 
static void | 
createSnapshotAndValidate(org.apache.hadoop.hbase.client.Admin admin,
                         org.apache.hadoop.hbase.TableName tableName,
                         String familyName,
                         String snapshotNameString,
                         org.apache.hadoop.fs.Path rootDir,
                         org.apache.hadoop.fs.FileSystem fs,
                         boolean onlineSnapshot)
Take a snapshot of the specified table and verify that the given family is
 not empty. 
 | 
static void | 
createTable(HBaseTestingUtility util,
           org.apache.hadoop.hbase.TableName tableName,
           byte[]... families)  | 
static void | 
createTable(HBaseTestingUtility util,
           org.apache.hadoop.hbase.TableName tableName,
           int regionReplication,
           byte[]... families)  | 
static void | 
createTable(HBaseTestingUtility util,
           org.apache.hadoop.hbase.TableName tableName,
           int regionReplication,
           int nRegions,
           byte[]... families)  | 
static void | 
deleteAllSnapshots(org.apache.hadoop.hbase.client.Admin admin)  | 
static void | 
deleteArchiveDirectory(HBaseTestingUtility util)  | 
static void | 
expectSnapshotDoneException(org.apache.hadoop.hbase.master.HMaster master,
                           org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.IsSnapshotDoneRequest snapshot,
                           Class<? extends org.apache.hadoop.hbase.snapshot.HBaseSnapshotException> clazz)
Expect the snapshot to throw an error when checking if the snapshot is
 complete 
 | 
static byte[][] | 
getSplitKeys()  | 
static byte[][] | 
getSplitKeys(int nRegions)  | 
static ArrayList<String> | 
listHFileNames(org.apache.hadoop.fs.FileSystem fs,
              org.apache.hadoop.fs.Path tableDir)
List all the HFiles in the given table 
 | 
static void | 
loadData(HBaseTestingUtility util,
        org.apache.hadoop.hbase.client.BufferedMutator mutator,
        int rows,
        byte[]... families)  | 
static void | 
loadData(HBaseTestingUtility util,
        org.apache.hadoop.hbase.TableName tableName,
        int rows,
        byte[]... families)  | 
static void | 
snapshot(org.apache.hadoop.hbase.client.Admin admin,
        String snapshotName,
        org.apache.hadoop.hbase.TableName tableName,
        org.apache.hadoop.hbase.client.SnapshotType type,
        int numTries)  | 
static void | 
verifyReplicasCameOnline(org.apache.hadoop.hbase.TableName tableName,
                        org.apache.hadoop.hbase.client.Admin admin,
                        int regionReplication)  | 
static void | 
verifyRowCount(HBaseTestingUtility util,
              org.apache.hadoop.hbase.TableName tableName,
              long expectedRows)  | 
static void | 
waitForSnapshotToComplete(org.apache.hadoop.hbase.master.HMaster master,
                         org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshot,
                         long sleep)
Helper method for testing async snapshot operations. 
 | 
static void | 
waitForTableToBeOnline(HBaseTestingUtility util,
                      org.apache.hadoop.hbase.TableName tableName)  | 
private SnapshotTestingUtils()
public static void assertNoSnapshots(org.apache.hadoop.hbase.client.Admin admin) throws IOException
IOException - if the admin operation failspublic static List<org.apache.hadoop.hbase.client.SnapshotDescription> assertExistsMatchingSnapshot(org.apache.hadoop.hbase.client.Admin admin, String snapshotName, org.apache.hadoop.hbase.TableName tableName) throws IOException
IOExceptionpublic static void assertOneSnapshotThatMatches(org.apache.hadoop.hbase.client.Admin admin, org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshot) throws IOException
IOExceptionpublic static List<org.apache.hadoop.hbase.client.SnapshotDescription> assertOneSnapshotThatMatches(org.apache.hadoop.hbase.client.Admin admin, String snapshotName, org.apache.hadoop.hbase.TableName tableName) throws IOException
IOExceptionpublic static List<org.apache.hadoop.hbase.client.SnapshotDescription> assertOneSnapshotThatMatches(org.apache.hadoop.hbase.client.Admin admin, byte[] snapshot, org.apache.hadoop.hbase.TableName tableName) throws IOException
IOExceptionpublic static void confirmSnapshotValid(HBaseTestingUtility testUtil, org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshotDescriptor, org.apache.hadoop.hbase.TableName tableName, byte[] family) throws IOException
IOExceptionpublic static void confirmSnapshotValid(org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshotDescriptor, org.apache.hadoop.hbase.TableName tableName, byte[] testFamily, org.apache.hadoop.fs.Path rootDir, org.apache.hadoop.hbase.client.Admin admin, org.apache.hadoop.fs.FileSystem fs) throws IOException
IOExceptionpublic static void confirmEmptySnapshotValid(org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshotDescriptor, org.apache.hadoop.hbase.TableName tableName, byte[] testFamily, org.apache.hadoop.fs.Path rootDir, org.apache.hadoop.hbase.client.Admin admin, org.apache.hadoop.fs.FileSystem fs) throws IOException
IOExceptionpublic static void confirmSnapshotValid(org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshotDescriptor, org.apache.hadoop.hbase.TableName tableName, List<byte[]> nonEmptyTestFamilies, List<byte[]> emptyTestFamilies, org.apache.hadoop.fs.Path rootDir, org.apache.hadoop.hbase.client.Admin admin, org.apache.hadoop.fs.FileSystem fs) throws IOException
IOExceptionpublic static void waitForSnapshotToComplete(org.apache.hadoop.hbase.master.HMaster master, org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshot, long sleep) throws org.apache.hbase.thirdparty.com.google.protobuf.ServiceException
master: - the master running the snapshotsnapshot: - the snapshot to checksleep: - amount to sleep between checks to see if the snapshot is donecom.google.protobuf.ServiceException - if the snapshot failsorg.apache.hbase.thirdparty.com.google.protobuf.ServiceExceptionpublic static void snapshot(org.apache.hadoop.hbase.client.Admin admin, String snapshotName, org.apache.hadoop.hbase.TableName tableName, org.apache.hadoop.hbase.client.SnapshotType type, int numTries) throws IOException
IOExceptionpublic static void cleanupSnapshot(org.apache.hadoop.hbase.client.Admin admin, byte[] tableName) throws IOException
IOExceptionpublic static void cleanupSnapshot(org.apache.hadoop.hbase.client.Admin admin, String snapshotName) throws IOException
IOExceptionpublic static void expectSnapshotDoneException(org.apache.hadoop.hbase.master.HMaster master, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.IsSnapshotDoneRequest snapshot, Class<? extends org.apache.hadoop.hbase.snapshot.HBaseSnapshotException> clazz)
master - master to checksnapshot - the SnapshotDescription request to pass to the masterclazz - expected exception from the masterpublic static ArrayList<String> listHFileNames(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path tableDir) throws IOException
fs: - FileSystem where the table livestableDir - directory of the tableIOException - on unexecpted error reading the FSpublic static void createSnapshotAndValidate(org.apache.hadoop.hbase.client.Admin admin, org.apache.hadoop.hbase.TableName tableName, String familyName, String snapshotNameString, org.apache.hadoop.fs.Path rootDir, org.apache.hadoop.fs.FileSystem fs, boolean onlineSnapshot) throws Exception
Exceptionpublic static void createSnapshotAndValidate(org.apache.hadoop.hbase.client.Admin admin, org.apache.hadoop.hbase.TableName tableName, List<byte[]> nonEmptyFamilyNames, List<byte[]> emptyFamilyNames, String snapshotNameString, org.apache.hadoop.fs.Path rootDir, org.apache.hadoop.fs.FileSystem fs, boolean onlineSnapshot) throws Exception
Exceptionpublic static ArrayList corruptSnapshot(HBaseTestingUtility util, String snapshotName) throws IOException
util - HBaseTestingUtilitysnapshotName - name of the snapshot to corruptIOException - on unexecpted error reading the FSpublic static void waitForTableToBeOnline(HBaseTestingUtility util, org.apache.hadoop.hbase.TableName tableName) throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic static void createTable(HBaseTestingUtility util, org.apache.hadoop.hbase.TableName tableName, int regionReplication, int nRegions, byte[]... families) throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic static byte[][] getSplitKeys()
public static byte[][] getSplitKeys(int nRegions)
public static void createTable(HBaseTestingUtility util, org.apache.hadoop.hbase.TableName tableName, byte[]... families) throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic static void createTable(HBaseTestingUtility util, org.apache.hadoop.hbase.TableName tableName, int regionReplication, byte[]... families) throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic static void createPreSplitTable(HBaseTestingUtility util, org.apache.hadoop.hbase.TableName tableName, int nRegions, byte[]... families) throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic static void loadData(HBaseTestingUtility util, org.apache.hadoop.hbase.TableName tableName, int rows, byte[]... families) throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic static void loadData(HBaseTestingUtility util, org.apache.hadoop.hbase.client.BufferedMutator mutator, int rows, byte[]... families) throws IOException, InterruptedException
IOExceptionInterruptedExceptionprivate static org.apache.hadoop.hbase.client.Put createPut(byte[][] families, byte[] key, byte[] value)
public static void deleteAllSnapshots(org.apache.hadoop.hbase.client.Admin admin) throws IOException
IOExceptionpublic static void deleteArchiveDirectory(HBaseTestingUtility util) throws IOException
IOExceptionpublic static void verifyRowCount(HBaseTestingUtility util, org.apache.hadoop.hbase.TableName tableName, long expectedRows) throws IOException
IOExceptionpublic static void verifyReplicasCameOnline(org.apache.hadoop.hbase.TableName tableName, org.apache.hadoop.hbase.client.Admin admin, int regionReplication) throws IOException
IOExceptionCopyright © 2007–2019 The Apache Software Foundation. All rights reserved.