Package org.apache.hadoop.hbase.util
Class MultiThreadedWriterBase
java.lang.Object
org.apache.hadoop.hbase.util.MultiThreadedAction
org.apache.hadoop.hbase.util.MultiThreadedWriterBase
- Direct Known Subclasses:
MultiThreadedUpdater,MultiThreadedWriter
Creates multiple threads that write key/values into the
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classA thread that keeps track of the highest key in the contiguous range of inserted/updated keys.Nested classes/interfaces inherited from class org.apache.hadoop.hbase.util.MultiThreadedAction
MultiThreadedAction.DefaultDataGenerator -
Field Summary
FieldsModifier and TypeFieldDescriptionThe sorted set of keys NOT inserted/updated by the writersprivate static final org.slf4j.Loggerprotected AtomicLongThis is the current key to be inserted/updated by any thread.protected booleanEnable this if used in conjunction with a concurrent reader.protected AtomicLongThe total size of the temporary inserted/updated key set that have not yet lined up in a our contiguous sequence starting from startKey.protected BlockingQueue<Long>A temporary place to keep track of inserted/updated keys.protected AtomicLongThe highest key in the contiguous range of keys .Fields inherited from class org.apache.hadoop.hbase.util.MultiThreadedAction
conf, connection, dataGenerator, endKey, numCols, numKeys, numThreads, numThreadsWorking, REPORTING_INTERVAL_MS, startKey, tableName, totalOpTimeMs, verbose -
Constructor Summary
ConstructorsConstructorDescriptionMultiThreadedWriterBase(LoadTestDataGenerator dataGen, org.apache.hadoop.conf.Configuration conf, TableName tableName, String actionLetter) -
Method Summary
Modifier and TypeMethodDescriptionprotected BlockingQueue<Long>createWriteKeysQueue(org.apache.hadoop.conf.Configuration conf) booleanfailedToWriteKey(long k) intprotected StringgetRegionDebugInfoSafe(Table table, byte[] rowKey) protected StringReturns a task-specific progress stringvoidsetTrackWroteKeys(boolean enable) Used for a joint write/read workload.voidstart(long startKey, long endKey, int numThreads) longThe max key until which all keys have been inserted/updated (successfully or not).Methods inherited from class org.apache.hadoop.hbase.util.MultiThreadedAction
appendToStatus, appendToStatus, close, getEndKey, isDone, startThreads, verifyResultAgainstDataGenerator, verifyResultAgainstDataGenerator, waitForFinish
-
Field Details
-
LOG
-
wroteKeys
A temporary place to keep track of inserted/updated keys. This is written to by all writers and is drained on a separate thread that populateswroteUpToKey, the maximum key in the contiguous range of keys being inserted/updated. This queue is supposed to stay small. -
nextKeyToWrite
This is the current key to be inserted/updated by any thread. Each thread does an atomic get and increment operation and inserts the current value. -
wroteUpToKey
The highest key in the contiguous range of keys . -
failedKeySet
The sorted set of keys NOT inserted/updated by the writers -
wroteKeyQueueSize
The total size of the temporary inserted/updated key set that have not yet lined up in a our contiguous sequence starting from startKey. Supposed to stay small. -
trackWroteKeys
Enable this if used in conjunction with a concurrent reader.
-
-
Constructor Details
-
MultiThreadedWriterBase
public MultiThreadedWriterBase(LoadTestDataGenerator dataGen, org.apache.hadoop.conf.Configuration conf, TableName tableName, String actionLetter) throws IOException - Throws:
IOException
-
-
Method Details
-
createWriteKeysQueue
-
start
- Overrides:
startin classMultiThreadedAction- Throws:
IOException
-
getRegionDebugInfoSafe
-
getNumWriteFailures
-
wroteUpToKey
The max key until which all keys have been inserted/updated (successfully or not).- Returns:
- the last key that we have inserted/updated all keys up to (inclusive)
-
failedToWriteKey
-
progressInfo
Description copied from class:MultiThreadedActionReturns a task-specific progress string- Specified by:
progressInfoin classMultiThreadedAction
-
setTrackWroteKeys
Used for a joint write/read workload. Enables tracking the last inserted/updated key, which requires a blocking queue and a consumer thread.- Parameters:
enable- whether to enable tracking the last inserted/updated key
-