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 classes/interfaces inherited from class org.apache.hadoop.hbase.util.AbstractHBaseTool
AbstractHBaseTool.OptionsOrderComparator
-
Field Summary
Modifier and TypeFieldDescriptionprivate String
protected BloomType
protected Cipher
protected org.apache.hbase.thirdparty.org.apache.commons.cli.CommandLine
This will be removed as we factor out the dependency on command lineprivate static final String
protected Compression.Algorithm
protected DataBlockEncoding
private static final byte[][]
Column families used by the testprivate static byte[]
Column family used by the testprotected static final int
The default data size if not specifiedstatic final int
protected static final int
The number of reader/writer threads if not specifiedprotected static final long
protected static final String
Table name to use of not overridden on the command lineprotected boolean
protected long
private byte[][]
Column families for the testprotected boolean
private boolean
protected boolean
protected boolean
protected boolean
protected boolean
protected boolean
protected boolean
protected boolean
protected boolean
private int
private static final org.slf4j.Logger
protected int
protected int
private int
protected int
protected int
private int
private int
protected static final String
private int
private int
private int
protected int
protected int
protected static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
protected static final String
static final String
static final String
protected static final String
static final String
protected static final String
protected static final String
static final String
protected static final String
static final String
static final String
protected static final String
static final String
protected static final String
protected static final String
static final String
static final String
static final String
protected static final String
static final String
protected static final String
protected static final String
protected static final String
static final String
protected static final String
static final String
static final String
protected static final String
protected static final String
static final String
protected static final String
Usage string for the load optionprotected static final String
Usage string for the read optionprotected static final String
Usage string for the update optionprotected static final String
protected static final String
static final String
static final String
protected static final String
protected static final String
protected MultiThreadedReader
private int
private int
protected long
private String
private TableName
Table name for the testprotected AtomicReference<Throwable>
protected int
protected MultiThreadedUpdater
private String
private User
private int
protected MultiThreadedWriter
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 TypeMethodDescriptionprivate void
addAuthInfoToConf
(Properties authConfig, org.apache.hadoop.conf.Configuration conf, String owner, String userList) protected void
Override this to add command-line options usingAbstractHBaseTool.addOptWithArg(java.lang.String, java.lang.String)
and similar methods.protected void
applyColumnFamilyOptions
(TableName tableName, byte[][] columnFamilies) Apply column family options such as Bloom filters, compression, and data block encoding.private void
Check for errors in the writer threads.protected int
doWork()
The "main function" of the toolbyte[][]
private LoadTestDataGenerator
getLoadGeneratorInstance
(String clazzName) private MultiThreadedReader
getMultiThreadedReaderInstance
(String clazzName, LoadTestDataGenerator dataGen) private MultiThreadedUpdater
getMultiThreadedUpdaterInstance
(String clazzName, LoadTestDataGenerator dataGen) private MultiThreadedWriter
getMultiThreadedWriterInstance
(String clazzName, LoadTestDataGenerator dataGen) protected int
getNumThreads
(String numThreadsStr) void
protected int
static void
protected org.apache.hbase.thirdparty.org.apache.commons.cli.CommandLineParser
Create the parser to use for parsing and validating the command line.private int
When NUM_TABLES is specified, the function starts multiple worker threads which individually start a LoadTestTool instance to load a table.private void
parseColumnFamilyOptions
(org.apache.hbase.thirdparty.org.apache.commons.cli.CommandLine cmd) protected void
processOptions
(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 void
Methods 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:AbstractHBaseTool
Override this to add command-line options usingAbstractHBaseTool.addOptWithArg(java.lang.String, java.lang.String)
and similar methods.- Specified by:
addOptions
in classAbstractHBaseTool
-
newParser
Description copied from class:AbstractHBaseTool
Create 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:
newParser
in classAbstractHBaseTool
- Returns:
- a new parser specific to the current tool
-
processOptions
Description copied from class:AbstractHBaseTool
This method is called to process the options after they have been parsed.- Specified by:
processOptions
in classAbstractHBaseTool
-
parseColumnFamilyOptions
private void parseColumnFamilyOptions(org.apache.hbase.thirdparty.org.apache.commons.cli.CommandLine cmd) -
initTestTable
- Throws:
IOException
-
doWork
Description copied from class:AbstractHBaseTool
The "main function" of the tool- Specified by:
doWork
in 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
-