Package org.apache.hadoop.hbase.util
Class MultiThreadedAction
java.lang.Object
org.apache.hadoop.hbase.util.MultiThreadedAction
- Direct Known Subclasses:
MultiThreadedReader
,MultiThreadedWriterBase
Common base class for reader and writer parts of multi-thread HBase load test (See LoadTestTool).
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Default implementation of LoadTestDataGenerator that uses LoadTestKVGenerator, fixed set of column families, and random number of columns in range.private class
Asynchronously reports progress -
Field Summary
Modifier and TypeFieldDescriptionprivate String
"R" or "W"protected final org.apache.hadoop.conf.Configuration
protected final org.apache.hadoop.hbase.client.ClusterConnection
protected LoadTestDataGenerator
protected long
The end key of the key range, exclusiveprivate static final org.slf4j.Logger
protected AtomicLong
protected AtomicLong
protected int
protected AtomicInteger
static final int
protected long
The start key of the key range, inclusiveprivate boolean
Whether we need to print out Hadoop Streaming-style countersprotected final org.apache.hadoop.hbase.TableName
protected AtomicLong
protected boolean
-
Constructor Summary
ConstructorDescriptionMultiThreadedAction
(LoadTestDataGenerator dataGen, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.hbase.TableName tableName, String actionLetter) -
Method Summary
Modifier and TypeMethodDescriptionprotected static void
appendToStatus
(StringBuilder sb, String desc, long v) protected static void
appendToStatus
(StringBuilder sb, String desc, String v) void
close()
private static String
formatTime
(long elapsedTime) long
Returns the end key of the key range, exclusiveboolean
isDone()
private Map<String,
org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.MutationProto.MutationType> parseMutateInfo
(byte[] mutateInfo) private void
printLocations
(org.apache.hadoop.hbase.client.Result r) protected abstract String
Returns a task-specific progress stringprivate String
resultToString
(org.apache.hadoop.hbase.client.Result result) void
start
(long startKey, long endKey, int numThreads) protected void
startThreads
(Collection<? extends Thread> threads) boolean
verifyResultAgainstDataGenerator
(org.apache.hadoop.hbase.client.Result result, boolean verifyValues) boolean
verifyResultAgainstDataGenerator
(org.apache.hadoop.hbase.client.Result result, boolean verifyValues, boolean verifyCfAndColumnIntegrity) Verifies the result from get or scan using the dataGenerator (that was presumably also used to generate said result).void
-
Field Details
-
LOG
-
tableName
-
conf
-
connection
-
numThreads
-
startKey
The start key of the key range, inclusive -
endKey
The end key of the key range, exclusive -
numThreadsWorking
-
numKeys
-
numCols
-
totalOpTimeMs
-
verbose
-
dataGenerator
-
actionLetter
"R" or "W" -
streamingCounters
Whether we need to print out Hadoop Streaming-style counters -
REPORTING_INTERVAL_MS
- See Also:
-
-
Constructor Details
-
MultiThreadedAction
public MultiThreadedAction(LoadTestDataGenerator dataGen, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.hbase.TableName tableName, String actionLetter) throws IOException - Throws:
IOException
-
-
Method Details
-
start
- Throws:
IOException
-
formatTime
-
close
-
waitForFinish
-
isDone
-
startThreads
-
getEndKey
Returns the end key of the key range, exclusive -
progressInfo
Returns a task-specific progress string -
appendToStatus
-
appendToStatus
-
verifyResultAgainstDataGenerator
public boolean verifyResultAgainstDataGenerator(org.apache.hadoop.hbase.client.Result result, boolean verifyValues) SeeverifyResultAgainstDataGenerator(Result, boolean, boolean)
. Does not verify cf/column integrity. -
verifyResultAgainstDataGenerator
public boolean verifyResultAgainstDataGenerator(org.apache.hadoop.hbase.client.Result result, boolean verifyValues, boolean verifyCfAndColumnIntegrity) Verifies the result from get or scan using the dataGenerator (that was presumably also used to generate said result).- Parameters:
verifyValues
- verify that values in the result make sense for row/cf/column combinationverifyCfAndColumnIntegrity
- verify that cf/column set in the result is complete. Note that to use this multiPut should be used, or verification has to happen after writes, otherwise there can be races.- Returns:
- true if the values of row result makes sense for row/cf/column combination and true if the cf/column set in the result is complete, false otherwise.
-
printLocations
-
resultToString
-
parseMutateInfo
private Map<String,org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.MutationProto.MutationType> parseMutateInfo(byte[] mutateInfo)
-