@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 if the admin operation fails
|
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(HBaseTestingUtil 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(HBaseTestingUtil util,
String snapshotName)
Corrupt the specified snapshot by deleting some files.
|
static void |
createPreSplitTable(HBaseTestingUtil 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(HBaseTestingUtil util,
org.apache.hadoop.hbase.TableName tableName,
byte[]... families) |
static void |
createTable(HBaseTestingUtil util,
org.apache.hadoop.hbase.TableName tableName,
int regionReplication,
byte[]... families) |
static void |
createTable(HBaseTestingUtil 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(HBaseTestingUtil 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(HBaseTestingUtil util,
org.apache.hadoop.hbase.client.BufferedMutator mutator,
int rows,
byte[]... families) |
static void |
loadData(HBaseTestingUtil 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 |
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,
Map<String,Object> snapshotProps) |
static void |
verifyReplicasCameOnline(org.apache.hadoop.hbase.TableName tableName,
org.apache.hadoop.hbase.client.Admin admin,
int regionReplication) |
static void |
verifyRowCount(HBaseTestingUtil util,
org.apache.hadoop.hbase.TableName tableName,
long expectedRows) |
static void |
waitForTableToBeOnline(HBaseTestingUtil util,
org.apache.hadoop.hbase.TableName tableName) |
private SnapshotTestingUtils()
public static void assertNoSnapshots(org.apache.hadoop.hbase.client.Admin admin) throws IOException
IOException
public 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
IOException
public static void assertOneSnapshotThatMatches(org.apache.hadoop.hbase.client.Admin admin, org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshot) throws IOException
IOException
public 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
IOException
public 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
IOException
public static void confirmSnapshotValid(HBaseTestingUtil testUtil, org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshotDescriptor, org.apache.hadoop.hbase.TableName tableName, byte[] family) throws IOException
IOException
public 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
IOException
public 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
IOException
public 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
IOException
public 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
IOException
public 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, Map<String,Object> snapshotProps) throws IOException
IOException
public static void cleanupSnapshot(org.apache.hadoop.hbase.client.Admin admin, byte[] tableName) throws IOException
IOException
public static void cleanupSnapshot(org.apache.hadoop.hbase.client.Admin admin, String snapshotName) throws IOException
IOException
public 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
Exception
public 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
Exception
public static ArrayList corruptSnapshot(HBaseTestingUtil util, String snapshotName) throws IOException
util
- HBaseTestingUtil
snapshotName
- name of the snapshot to corruptIOException
- on unexecpted error reading the FSpublic static void waitForTableToBeOnline(HBaseTestingUtil util, org.apache.hadoop.hbase.TableName tableName) throws IOException, InterruptedException
IOException
InterruptedException
public static void createTable(HBaseTestingUtil util, org.apache.hadoop.hbase.TableName tableName, int regionReplication, int nRegions, byte[]... families) throws IOException, InterruptedException
IOException
InterruptedException
public static byte[][] getSplitKeys()
public static byte[][] getSplitKeys(int nRegions)
public static void createTable(HBaseTestingUtil util, org.apache.hadoop.hbase.TableName tableName, byte[]... families) throws IOException, InterruptedException
IOException
InterruptedException
public static void createTable(HBaseTestingUtil util, org.apache.hadoop.hbase.TableName tableName, int regionReplication, byte[]... families) throws IOException, InterruptedException
IOException
InterruptedException
public static void createPreSplitTable(HBaseTestingUtil util, org.apache.hadoop.hbase.TableName tableName, int nRegions, byte[]... families) throws IOException, InterruptedException
IOException
InterruptedException
public static void loadData(HBaseTestingUtil util, org.apache.hadoop.hbase.TableName tableName, int rows, byte[]... families) throws IOException, InterruptedException
IOException
InterruptedException
public static void loadData(HBaseTestingUtil util, org.apache.hadoop.hbase.client.BufferedMutator mutator, int rows, byte[]... families) throws IOException, InterruptedException
IOException
InterruptedException
private 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
IOException
public static void deleteArchiveDirectory(HBaseTestingUtil util) throws IOException
IOException
public static void verifyRowCount(HBaseTestingUtil util, org.apache.hadoop.hbase.TableName tableName, long expectedRows) throws IOException
IOException
public static void verifyReplicasCameOnline(org.apache.hadoop.hbase.TableName tableName, org.apache.hadoop.hbase.client.Admin admin, int regionReplication) throws IOException
IOException
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.