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
Modifier and TypeClassDescriptionprivate class
A 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
Modifier and TypeFieldDescriptionThe sorted set of keys NOT inserted/updated by the writersprivate static final org.slf4j.Logger
protected AtomicLong
This is the current key to be inserted/updated by any thread.protected boolean
Enable this if used in conjunction with a concurrent reader.protected AtomicLong
The 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 AtomicLong
The 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
ConstructorDescriptionMultiThreadedWriterBase
(LoadTestDataGenerator dataGen, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.hbase.TableName tableName, String actionLetter) -
Method Summary
Modifier and TypeMethodDescriptionprotected BlockingQueue<Long>
createWriteKeysQueue
(org.apache.hadoop.conf.Configuration conf) boolean
failedToWriteKey
(long k) int
protected String
getRegionDebugInfoSafe
(org.apache.hadoop.hbase.client.Table table, byte[] rowKey) protected String
Returns a task-specific progress stringvoid
setTrackWroteKeys
(boolean enable) Used for a joint write/read workload.void
start
(long startKey, long endKey, int numThreads) long
The 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, org.apache.hadoop.hbase.TableName tableName, String actionLetter) throws IOException - Throws:
IOException
-
-
Method Details
-
createWriteKeysQueue
-
start
- Overrides:
start
in 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:MultiThreadedAction
Returns a task-specific progress string- Specified by:
progressInfo
in 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
-