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
Nested ClassesModifier and TypeClassDescriptionstatic classDefault implementation of LoadTestDataGenerator that uses LoadTestKVGenerator, fixed set of column families, and random number of columns in range.private classAsynchronously reports progress -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate String"R" or "W"protected final org.apache.hadoop.conf.Configurationprotected final org.apache.hadoop.hbase.client.ClusterConnectionprotected LoadTestDataGeneratorprotected longThe end key of the key range, exclusiveprivate static final org.slf4j.Loggerprotected AtomicLongprotected AtomicLongprotected intprotected AtomicIntegerstatic final intprotected longThe start key of the key range, inclusiveprivate booleanWhether we need to print out Hadoop Streaming-style countersprotected final org.apache.hadoop.hbase.TableNameprotected AtomicLongprotected boolean -
Constructor Summary
ConstructorsConstructorDescriptionMultiThreadedAction(LoadTestDataGenerator dataGen, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.hbase.TableName tableName, String actionLetter) -
Method Summary
Modifier and TypeMethodDescriptionprotected static voidappendToStatus(StringBuilder sb, String desc, long v) protected static voidappendToStatus(StringBuilder sb, String desc, String v) voidclose()private static StringformatTime(long elapsedTime) longReturns the end key of the key range, exclusivebooleanisDone()private Map<String,org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.MutationProto.MutationType> parseMutateInfo(byte[] mutateInfo) private voidprintLocations(org.apache.hadoop.hbase.client.Result r) protected abstract StringReturns a task-specific progress stringprivate StringresultToString(org.apache.hadoop.hbase.client.Result result) voidstart(long startKey, long endKey, int numThreads) protected voidstartThreads(Collection<? extends Thread> threads) booleanverifyResultAgainstDataGenerator(org.apache.hadoop.hbase.client.Result result, boolean verifyValues) booleanverifyResultAgainstDataGenerator(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)
-