Package org.apache.hadoop.hbase.util
Class LoadTestTool
java.lang.Object
org.apache.hadoop.hbase.util.AbstractHBaseTool
org.apache.hadoop.hbase.util.LoadTestTool
- All Implemented Interfaces:
org.apache.hadoop.conf.Configurable,org.apache.hadoop.util.Tool
A command-line utility that reads, writes, and verifies data. Unlike
PerformanceEvaluation, this tool validates the data written, and
supports simultaneously writing and reading the same set of keys.-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.apache.hadoop.hbase.util.AbstractHBaseTool
AbstractHBaseTool.OptionsOrderComparator -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Stringprotected BloomTypeprotected Cipherprotected org.apache.hbase.thirdparty.org.apache.commons.cli.CommandLineThis will be removed as we factor out the dependency on command lineprivate static final Stringprotected Compression.Algorithmprotected DataBlockEncodingprivate static final byte[][]Column families used by the testprivate static byte[]Column family used by the testprotected static final intThe default data size if not specifiedstatic final intprotected static final intThe number of reader/writer threads if not specifiedprotected static final longprotected static final StringTable name to use of not overridden on the command lineprotected booleanprotected longprivate byte[][]Column families for the testprotected booleanprivate booleanprotected booleanprotected booleanprotected booleanprotected booleanprotected booleanprotected booleanprotected booleanprotected booleanprivate intprivate static final org.slf4j.Loggerprotected intprotected intprivate intprotected intprotected intprivate intprivate intprotected static final Stringprivate intprivate intprivate intprotected intprotected intprotected static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected static final Stringstatic final Stringstatic final Stringprotected static final Stringstatic final Stringprotected static final Stringprotected static final Stringstatic final Stringprotected static final Stringstatic final Stringstatic final Stringprotected static final Stringstatic final Stringprotected static final Stringprotected static final Stringstatic final Stringstatic final Stringstatic final Stringprotected static final Stringstatic final Stringprotected static final Stringprotected static final Stringprotected static final Stringstatic final Stringprotected static final Stringstatic final Stringstatic final Stringprotected static final Stringprotected static final Stringstatic final Stringprotected static final StringUsage string for the load optionprotected static final StringUsage string for the read optionprotected static final StringUsage string for the update optionprotected static final Stringprotected static final Stringstatic final Stringstatic final Stringprotected static final Stringprotected static final Stringprotected MultiThreadedReaderprivate intprivate intprotected longprivate Stringprivate TableNameTable name for the testprotected AtomicReference<Throwable>protected intprotected MultiThreadedUpdaterprivate Stringprivate Userprivate intprotected MultiThreadedWriterFields 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 TypeMethodDescriptionprivate voidaddAuthInfoToConf(Properties authConfig, org.apache.hadoop.conf.Configuration conf, String owner, String userList) protected voidOverride this to add command-line options usingAbstractHBaseTool.addOptWithArg(java.lang.String, java.lang.String)and similar methods.protected voidapplyColumnFamilyOptions(TableName tableName, byte[][] columnFamilies) Apply column family options such as Bloom filters, compression, and data block encoding.private voidCheck for errors in the writer threads.protected intdoWork()The "main function" of the toolbyte[][]private LoadTestDataGeneratorgetLoadGeneratorInstance(String clazzName) private MultiThreadedReadergetMultiThreadedReaderInstance(String clazzName, LoadTestDataGenerator dataGen) private MultiThreadedUpdatergetMultiThreadedUpdaterInstance(String clazzName, LoadTestDataGenerator dataGen) private MultiThreadedWritergetMultiThreadedWriterInstance(String clazzName, LoadTestDataGenerator dataGen) protected intgetNumThreads(String numThreadsStr) voidprotected intstatic voidprotected org.apache.hbase.thirdparty.org.apache.commons.cli.CommandLineParserCreate the parser to use for parsing and validating the command line.private intWhen NUM_TABLES is specified, the function starts multiple worker threads which individually start a LoadTestTool instance to load a table.private voidparseColumnFamilyOptions(org.apache.hbase.thirdparty.org.apache.commons.cli.CommandLine cmd) protected voidprocessOptions(org.apache.hbase.thirdparty.org.apache.commons.cli.CommandLine cmd) This method is called to process the options after they have been parsed.protected String[]splitColonSeparated(String option, int minNumCols, int maxNumCols) private voidMethods inherited from class org.apache.hadoop.hbase.util.AbstractHBaseTool
addOption, addOptNoArg, addOptNoArg, addOptWithArg, addOptWithArg, addRequiredOption, addRequiredOptWithArg, addRequiredOptWithArg, doStaticMain, getConf, getOptionAsDouble, getOptionAsInt, getOptionAsInt, getOptionAsLong, getOptionAsLong, parseArgs, parseInt, parseLong, printUsage, printUsage, processOldArgs, run, setConf
-
Field Details
-
LOG
-
COLON
- See Also:
-
tableName
Table name for the test -
families
Column families for the test -
DEFAULT_COLUMN_FAMILY
Column family used by the test -
DEFAULT_COLUMN_FAMILIES
Column families used by the test -
DEFAULT_TABLE_NAME
Table name to use of not overridden on the command line- See Also:
-
DEFAULT_DATA_SIZE
The default data size if not specified- See Also:
-
DEFAULT_NUM_THREADS
The number of reader/writer threads if not specified- See Also:
-
OPT_USAGE_LOAD
Usage string for the load option- See Also:
-
OPT_USAGE_READ
Usage string for the read option- See Also:
-
OPT_USAGE_UPDATE
Usage string for the update option- See Also:
-
OPT_USAGE_BLOOM
-
OPT_USAGE_COMPRESSION
-
OPT_VERBOSE
- See Also:
-
OPT_BLOOM
- See Also:
-
OPT_BLOOM_PARAM
- See Also:
-
OPT_COMPRESSION
- See Also:
-
OPT_DEFERRED_LOG_FLUSH
- See Also:
-
OPT_DEFERRED_LOG_FLUSH_USAGE
- See Also:
-
OPT_INMEMORY
- See Also:
-
OPT_USAGE_IN_MEMORY
- See Also:
-
OPT_GENERATOR
- See Also:
-
OPT_GENERATOR_USAGE
- See Also:
-
OPT_WRITER
- See Also:
-
OPT_WRITER_USAGE
- See Also:
-
OPT_UPDATER
- See Also:
-
OPT_UPDATER_USAGE
- See Also:
-
OPT_READER
- See Also:
-
OPT_READER_USAGE
- See Also:
-
OPT_KEY_WINDOW
- See Also:
-
OPT_WRITE
- See Also:
-
OPT_MAX_READ_ERRORS
- See Also:
-
OPT_MULTIPUT
- See Also:
-
OPT_MULTIGET
- See Also:
-
OPT_NUM_KEYS
- See Also:
-
OPT_READ
- See Also:
-
OPT_START_KEY
- See Also:
-
OPT_TABLE_NAME
- See Also:
-
OPT_COLUMN_FAMILIES
- See Also:
-
OPT_ZK_QUORUM
- See Also:
-
OPT_ZK_PARENT_NODE
- See Also:
-
OPT_SKIP_INIT
- See Also:
-
OPT_INIT_ONLY
- See Also:
-
NUM_TABLES
- See Also:
-
OPT_BATCHUPDATE
- See Also:
-
OPT_UPDATE
- See Also:
-
OPT_ENCRYPTION
- See Also:
-
OPT_ENCRYPTION_USAGE
-
OPT_NUM_REGIONS_PER_SERVER
- See Also:
-
OPT_NUM_REGIONS_PER_SERVER_USAGE
- See Also:
-
DEFAULT_NUM_REGIONS_PER_SERVER
- See Also:
-
OPT_REGION_REPLICATION
- See Also:
-
OPT_REGION_REPLICATION_USAGE
- See Also:
-
OPT_REGION_REPLICA_ID
- See Also:
-
OPT_REGION_REPLICA_ID_USAGE
- See Also:
-
OPT_MOB_THRESHOLD
- See Also:
-
OPT_MOB_THRESHOLD_USAGE
- See Also:
-
DEFAULT_START_KEY
- See Also:
-
cmd
This will be removed as we factor out the dependency on command line -
writerThreads
-
readerThreads
-
updaterThreads
-
startKey
-
endKey
-
isVerbose
-
isWrite
-
isRead
-
isUpdate
-
deferredLogFlush
-
dataBlockEncodingAlgo
-
compressAlgo
-
bloomType
-
inMemoryCF
-
userOwner
-
numWriterThreads
-
minColsPerKey
-
maxColsPerKey
-
minColDataSize
-
maxColDataSize
-
isMultiPut
-
numUpdaterThreads
-
updatePercent
-
ignoreConflicts
-
isBatchUpdate
-
numReaderThreads
-
keyWindow
-
multiGetBatchSize
-
maxReadErrors
-
verifyPercent
-
numTables
-
superUser
-
userNames
-
authnFileName
-
numRegionsPerServer
-
regionReplication
-
regionReplicaId
-
mobThreshold
-
isSkipInit
-
isInitOnly
-
cipher
-
thrown
-
-
Constructor Details
-
LoadTestTool
public LoadTestTool()
-
-
Method Details
-
splitColonSeparated
-
getNumThreads
-
getColumnFamilies
-
applyColumnFamilyOptions
protected void applyColumnFamilyOptions(TableName tableName, byte[][] columnFamilies) throws IOException Apply column family options such as Bloom filters, compression, and data block encoding.- Throws:
IOException
-
addOptions
Description copied from class:AbstractHBaseToolOverride this to add command-line options usingAbstractHBaseTool.addOptWithArg(java.lang.String, java.lang.String)and similar methods.- Specified by:
addOptionsin classAbstractHBaseTool
-
newParser
Description copied from class:AbstractHBaseToolCreate the parser to use for parsing and validating the command line. Since commons-cli lacks the capability to validate arbitrary combination of options, it may be helpful to bake custom logic into a specialized parser implementation. See LoadTestTool for examples.- Overrides:
newParserin classAbstractHBaseTool- Returns:
- a new parser specific to the current tool
-
processOptions
Description copied from class:AbstractHBaseToolThis method is called to process the options after they have been parsed.- Specified by:
processOptionsin classAbstractHBaseTool
-
parseColumnFamilyOptions
private void parseColumnFamilyOptions(org.apache.hbase.thirdparty.org.apache.commons.cli.CommandLine cmd) -
initTestTable
- Throws:
IOException
-
doWork
Description copied from class:AbstractHBaseToolThe "main function" of the tool- Specified by:
doWorkin classAbstractHBaseTool- Throws:
IOException
-
loadTable
- Throws:
IOException
-
getLoadGeneratorInstance
- Throws:
IOException
-
getMultiThreadedWriterInstance
private MultiThreadedWriter getMultiThreadedWriterInstance(String clazzName, LoadTestDataGenerator dataGen) throws IOException - Throws:
IOException
-
getMultiThreadedUpdaterInstance
private MultiThreadedUpdater getMultiThreadedUpdaterInstance(String clazzName, LoadTestDataGenerator dataGen) throws IOException - Throws:
IOException
-
getMultiThreadedReaderInstance
private MultiThreadedReader getMultiThreadedReaderInstance(String clazzName, LoadTestDataGenerator dataGen) throws IOException - Throws:
IOException
-
main
-
parallelLoadTables
When NUM_TABLES is specified, the function starts multiple worker threads which individually start a LoadTestTool instance to load a table. Each table name is in format <tn>_<index>. For example, "-tn test -num_tables 2" , table names will be "test_1", "test_2"- Throws:
IOException- if one of the load tasks is unable to complete
-
workerThreadError
-
checkForErrors
Check for errors in the writer threads. If any is found, rethrow it.- Throws:
IOException
-
addAuthInfoToConf
private void addAuthInfoToConf(Properties authConfig, org.apache.hadoop.conf.Configuration conf, String owner, String userList) throws IOException - Throws:
IOException
-