Package org.apache.hadoop.hbase
Class IntegrationTestBackupRestore
java.lang.Object
org.apache.hadoop.hbase.util.AbstractHBaseTool
org.apache.hadoop.hbase.IntegrationTestBase
org.apache.hadoop.hbase.IntegrationTestBackupRestore
- All Implemented Interfaces:
org.apache.hadoop.conf.Configurable,org.apache.hadoop.util.Tool
An integration test to detect regressions in HBASE-7912. Create a table with many regions, load
data, perform series backup/load operations, then restore and verify data
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.hadoop.hbase.util.AbstractHBaseTool
org.apache.hadoop.hbase.util.AbstractHBaseTool.OptionsOrderComparator -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static Stringprivate static final Stringprotected static final Stringprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static Objectprotected static final org.slf4j.Loggerprotected static final Stringprotected static final Stringprotected static intprotected static intprotected static final Stringprotected static intprotected static final Stringprotected static intprotected static final Stringprotected static intprotected static final longprotected static final Stringprotected longprotected static org.apache.hadoop.hbase.TableName[]Fields inherited from class org.apache.hadoop.hbase.IntegrationTestBase
CHAOS_MONKEY_PROPS, monkey, MONKEY_LONG_OPT, monkeyProps, monkeyToUse, NO_CLUSTER_CLEANUP_LONG_OPT, noClusterCleanUp, utilFields inherited from class org.apache.hadoop.hbase.util.AbstractHBaseTool
cmdLineArgs, conf, EXIT_FAILURE, EXIT_SUCCESS, LONG_HELP_OPTION, options, SHORT_HELP_OPTION -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprivate String[]allIncremental(List<String> backupIds) private Stringbackup(org.apache.hadoop.hbase.backup.BackupRequest request, org.apache.hadoop.hbase.backup.BackupAdmin client) protected booleancheckSucceeded(String backupId) Check if backup is succeededprivate voidorg.apache.hadoop.hbase.backup.RestoreRequestcreateRestoreRequest(String backupRootDir, String backupId, boolean check, org.apache.hadoop.hbase.TableName[] fromTables, org.apache.hadoop.hbase.TableName[] toTables, boolean isOverwrite) Get restore request.private voidcreateTable(org.apache.hadoop.hbase.TableName tableName) private voidprivate voidprivate voidenableBackup(org.apache.hadoop.conf.Configuration conf) private org.apache.hadoop.hbase.backup.BackupInfogetBackupInfo(String backupId) Provides the name of the CFs that are protected from random Chaos monkey activity (alter)org.apache.hadoop.hbase.TableNameProvides the name of the table that is protected from random Chaos monkey activityprivate voidloadData(org.apache.hadoop.hbase.TableName table, int numRows) static voidMain methodprivate voidprotected voidprocessOptions(org.apache.hbase.thirdparty.org.apache.commons.cli.CommandLine cmd) private voidrestore(org.apache.hadoop.hbase.backup.RestoreRequest request, org.apache.hadoop.hbase.backup.BackupAdmin client) private voidrestoreVerifyTable(org.apache.hadoop.hbase.client.Connection conn, org.apache.hadoop.hbase.backup.BackupAdmin client, org.apache.hadoop.hbase.TableName table, String backupId, long expectedRows) intReturns status of CLI executionprivate voidprivate voidrunTestSingle(org.apache.hadoop.hbase.TableName table) voidsetUp()voidvoidvoidtearDown()voidMethods inherited from class org.apache.hadoop.hbase.IntegrationTestBase
cleanUp, cleanUpCluster, cleanUpMonkey, cleanUpMonkey, doWork, getConf, getDefaultMonkeyFactory, getTestingUtil, loadMonkeyProperties, processBaseOptions, startMonkeyMethods inherited from class org.apache.hadoop.hbase.util.AbstractHBaseTool
addOption, addOptNoArg, addOptNoArg, addOptWithArg, addOptWithArg, addRequiredOption, addRequiredOptWithArg, addRequiredOptWithArg, doStaticMain, getOptionAsDouble, getOptionAsInt, getOptionAsInt, getOptionAsLong, getOptionAsLong, newParser, parseArgs, parseInt, parseLong, printUsage, printUsage, processOldArgs, run, setConf
-
Field Details
-
CLASS_NAME
-
LOG
-
NUMBER_OF_TABLES_KEY
- See Also:
-
COLUMN_NAME
- See Also:
-
REGION_COUNT_KEY
- See Also:
-
REGIONSERVER_COUNT_KEY
- See Also:
-
ROWS_PER_ITERATION_KEY
- See Also:
-
NUM_ITERATIONS_KEY
- See Also:
-
DEFAULT_REGION_COUNT
- See Also:
-
DEFAULT_REGIONSERVER_COUNT
- See Also:
-
DEFAULT_NUMBER_OF_TABLES
- See Also:
-
DEFAULT_NUM_ITERATIONS
- See Also:
-
DEFAULT_ROWS_IN_ITERATION
- See Also:
-
SLEEP_TIME_KEY
- See Also:
-
SLEEP_TIME_DEFAULT
- See Also:
-
rowsInIteration
-
regionsCountPerServer
-
regionServerCount
-
numIterations
-
numTables
-
tableNames
-
sleepTime
-
lock
-
BACKUP_ROOT_DIR
-
-
Constructor Details
-
IntegrationTestBackupRestore
public IntegrationTestBackupRestore()
-
-
Method Details
-
setUp
- Overrides:
setUpin classIntegrationTestBase- Throws:
Exception
-
tearDown
- Throws:
IOException
-
setUpMonkey
- Overrides:
setUpMonkeyin classIntegrationTestBase- Throws:
Exception
-
deleteTablesIfAny
- Throws:
IOException
-
createTables
- Throws:
Exception
-
enableBackup
-
cleanUpBackupDir
- Throws:
IOException
-
testBackupRestore
- Throws:
Exception
-
runTestMulti
- Throws:
IOException
-
createTable
- Throws:
Exception
-
loadData
- Throws:
IOException
-
backup
private String backup(org.apache.hadoop.hbase.backup.BackupRequest request, org.apache.hadoop.hbase.backup.BackupAdmin client) throws IOException - Throws:
IOException
-
restore
private void restore(org.apache.hadoop.hbase.backup.RestoreRequest request, org.apache.hadoop.hbase.backup.BackupAdmin client) throws IOException - Throws:
IOException
-
merge
private void merge(String[] backupIds, org.apache.hadoop.hbase.backup.BackupAdmin client) throws IOException - Throws:
IOException
-
runTestSingle
- Throws:
IOException
-
restoreVerifyTable
private void restoreVerifyTable(org.apache.hadoop.hbase.client.Connection conn, org.apache.hadoop.hbase.backup.BackupAdmin client, org.apache.hadoop.hbase.TableName table, String backupId, long expectedRows) throws IOException - Throws:
IOException
-
allIncremental
-
checkSucceeded
Check if backup is succeeded- Parameters:
backupId- pass backup ID to check status of- Returns:
- status of backup
- Throws:
IOException
-
getBackupInfo
- Throws:
IOException
-
createRestoreRequest
public org.apache.hadoop.hbase.backup.RestoreRequest createRestoreRequest(String backupRootDir, String backupId, boolean check, org.apache.hadoop.hbase.TableName[] fromTables, org.apache.hadoop.hbase.TableName[] toTables, boolean isOverwrite) Get restore request.- Parameters:
backupRootDir- directory where backup is locatedbackupId- backup IDcheck- check the backupfromTables- table names to restore fromtoTables- new table names to restore toisOverwrite- overwrite the table(s)- Returns:
- an instance of RestoreRequest
-
setUpCluster
- Specified by:
setUpClusterin classIntegrationTestBase- Throws:
Exception
-
runTestFromCommandLine
Returns status of CLI execution- Specified by:
runTestFromCommandLinein classIntegrationTestBase- Throws:
Exception
-
getTablename
Description copied from class:IntegrationTestBaseProvides the name of the table that is protected from random Chaos monkey activity- Specified by:
getTablenamein classIntegrationTestBase- Returns:
- table to not delete.
-
getColumnFamilies
Description copied from class:IntegrationTestBaseProvides the name of the CFs that are protected from random Chaos monkey activity (alter)- Specified by:
getColumnFamiliesin classIntegrationTestBase- Returns:
- set of cf names to protect.
-
addOptions
- Overrides:
addOptionsin classIntegrationTestBase
-
processOptions
- Overrides:
processOptionsin classIntegrationTestBase
-
main
Main method- Parameters:
args- argument list- Throws:
Exception
-