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
Modifier and TypeFieldDescriptionprivate static String
private static final String
protected static final String
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static Object
protected static final org.slf4j.Logger
protected static final String
protected static final String
protected static int
protected static int
protected static final String
protected static int
protected static final String
protected static int
protected static final String
protected static int
protected static final long
protected static final String
protected long
protected 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, util
Fields inherited from class org.apache.hadoop.hbase.util.AbstractHBaseTool
cmdLineArgs, conf, EXIT_FAILURE, EXIT_SUCCESS, LONG_HELP_OPTION, options, SHORT_HELP_OPTION
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
private String[]
allIncremental
(List<String> backupIds) private String
backup
(org.apache.hadoop.hbase.backup.BackupRequest request, org.apache.hadoop.hbase.backup.BackupAdmin client) protected boolean
checkSucceeded
(String backupId) Returns status of backupprivate void
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.private void
createTable
(org.apache.hadoop.hbase.TableName tableName) private void
private void
private void
enableBackup
(org.apache.hadoop.conf.Configuration conf) private org.apache.hadoop.hbase.backup.BackupInfo
getBackupInfo
(String backupId) Provides the name of the CFs that are protected from random Chaos monkey activity (alter)org.apache.hadoop.hbase.TableName
Provides the name of the table that is protected from random Chaos monkey activityprivate void
loadData
(org.apache.hadoop.hbase.TableName table, int numRows) static void
private void
protected void
processOptions
(org.apache.hbase.thirdparty.org.apache.commons.cli.CommandLine cmd) private void
restore
(org.apache.hadoop.hbase.backup.RestoreRequest request, org.apache.hadoop.hbase.backup.BackupAdmin client) 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) int
Returns status of CLI executionprivate void
private void
runTestSingle
(org.apache.hadoop.hbase.TableName table) void
setUp()
void
void
void
tearDown()
void
Methods inherited from class org.apache.hadoop.hbase.IntegrationTestBase
cleanUp, cleanUpCluster, cleanUpMonkey, cleanUpMonkey, doWork, getConf, getDefaultMonkeyFactory, getTestingUtil, loadMonkeyProperties, processBaseOptions, startMonkey
Methods 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:
setUp
in classIntegrationTestBase
- Throws:
Exception
-
tearDown
- Throws:
IOException
-
setUpMonkey
- Overrides:
setUpMonkey
in 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
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:
setUpCluster
in classIntegrationTestBase
- Throws:
Exception
-
runTestFromCommandLine
Returns status of CLI execution- Specified by:
runTestFromCommandLine
in classIntegrationTestBase
- Throws:
Exception
-
getTablename
Description copied from class:IntegrationTestBase
Provides the name of the table that is protected from random Chaos monkey activity- Specified by:
getTablename
in classIntegrationTestBase
- Returns:
- table to not delete.
-
getColumnFamilies
Description copied from class:IntegrationTestBase
Provides the name of the CFs that are protected from random Chaos monkey activity (alter)- Specified by:
getColumnFamilies
in classIntegrationTestBase
- Returns:
- set of cf names to protect.
-
addOptions
- Overrides:
addOptions
in classIntegrationTestBase
-
processOptions
- Overrides:
processOptions
in classIntegrationTestBase
-
main
- Throws:
Exception
-