Package org.apache.hadoop.hbase.client
Class SimpleRequestController
java.lang.Object
org.apache.hadoop.hbase.client.SimpleRequestController
- All Implemented Interfaces:
RequestController
Holds back the requests if they reach any thresholds.
-
Nested Class Summary
Modifier and TypeClassDescription(package private) static class
limit the heap size for each request.(package private) static class
limit the number of rows for each request.(package private) static interface
Provide a way to control the flow of rows iteration.(package private) static class
limit the heapsize of total submitted data.(package private) static class
limit the max number of tasks in an AsyncProcess.Nested classes/interfaces inherited from interface org.apache.hadoop.hbase.client.RequestController
RequestController.Checker, RequestController.ReturnCode
-
Field Summary
Modifier and TypeFieldDescription(package private) static final long
Default value ofHBASE_CLIENT_MAX_PERREQUEST_HEAPSIZE
.(package private) static final long
Default value ofHBASE_CLIENT_MAX_PERREQUEST_ROWS
.(package private) static final long
Default value ofHBASE_CLIENT_MAX_SUBMIT_HEAPSIZE
.private static final int
private static final int
static final String
The maximum heap size for each request.static final String
The maximum number of rows for each request.static final String
The maximum size of submit.private static final org.slf4j.Logger
(package private) final int
The number of tasks we run in parallel on a single region.(package private) final int
The number of task simultaneously executed on a single region server.private final long
The maximum heap size for each request.private final long
private final long
The maximum number of rows for each request.private final int
The number of tasks simultaneously executed on the cluster.(package private) final ConcurrentMap<byte[],
AtomicInteger> (package private) final ConcurrentMap<ServerName,
AtomicInteger> (package private) final AtomicLong
static final String
static final String
private final int
private final int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate static int
checkAndGet
(org.apache.hadoop.conf.Configuration conf, String key, int defaultValue) private static long
checkAndGet
(org.apache.hadoop.conf.Configuration conf, String key, long defaultValue) void
decTaskCounters
(Collection<byte[]> regions, ServerName sn) Decrement the counter if a task is accomplished.long
Returns The number of running task.void
incTaskCounters
(Collection<byte[]> regions, ServerName sn) Increment the counter if we build a valid task.private void
logDetailsOfUndoneTasks
(long taskInProgress) Returns A new checker for evaluating a batch rows.(package private) static RequestController.Checker
newChecker
(List<SimpleRequestController.RowChecker> checkers) void
waitForFreeSlot
(long id, int periodToTrigger, Consumer<Long> trigger) Wait until there is at least one slot for a new task.void
waitForMaximumCurrentTasks
(long max, long id, int periodToTrigger, Consumer<Long> trigger) Waits for the running tasks to complete.
-
Field Details
-
LOG
-
HBASE_CLIENT_MAX_PERREQUEST_HEAPSIZE
The maximum heap size for each request.- See Also:
-
DEFAULT_HBASE_CLIENT_MAX_PERREQUEST_HEAPSIZE
Default value ofHBASE_CLIENT_MAX_PERREQUEST_HEAPSIZE
.- See Also:
-
HBASE_CLIENT_MAX_PERREQUEST_ROWS
The maximum number of rows for each request.- See Also:
-
DEFAULT_HBASE_CLIENT_MAX_PERREQUEST_ROWS
Default value ofHBASE_CLIENT_MAX_PERREQUEST_ROWS
.- See Also:
-
HBASE_CLIENT_MAX_SUBMIT_HEAPSIZE
The maximum size of submit.- See Also:
-
DEFAULT_HBASE_CLIENT_MAX_SUBMIT_HEAPSIZE
Default value ofHBASE_CLIENT_MAX_SUBMIT_HEAPSIZE
.- See Also:
-
tasksInProgress
-
taskCounterPerRegion
-
taskCounterPerServer
-
maxTotalConcurrentTasks
The number of tasks simultaneously executed on the cluster. -
maxHeapSizePerRequest
The maximum heap size for each request. -
maxRowsPerRequest
The maximum number of rows for each request. -
maxHeapSizeSubmit
-
maxConcurrentTasksPerRegion
The number of tasks we run in parallel on a single region. With 1 (the default) , we ensure that the ordering of the queries is respected: we don't start a set of operations on a region before the previous one is done. As well, this limits the pressure we put on the region server. -
maxConcurrentTasksPerServer
The number of task simultaneously executed on a single region server. -
thresholdToLogUndoneTaskDetails
-
THRESHOLD_TO_LOG_UNDONE_TASK_DETAILS
- See Also:
-
DEFAULT_THRESHOLD_TO_LOG_UNDONE_TASK_DETAILS
- See Also:
-
THRESHOLD_TO_LOG_REGION_DETAILS
- See Also:
-
DEFAULT_THRESHOLD_TO_LOG_REGION_DETAILS
- See Also:
-
thresholdToLogRegionDetails
-
-
Constructor Details
-
SimpleRequestController
SimpleRequestController(org.apache.hadoop.conf.Configuration conf)
-
-
Method Details
-
checkAndGet
private static int checkAndGet(org.apache.hadoop.conf.Configuration conf, String key, int defaultValue) -
checkAndGet
private static long checkAndGet(org.apache.hadoop.conf.Configuration conf, String key, long defaultValue) -
newChecker
-
newChecker
Description copied from interface:RequestController
Returns A new checker for evaluating a batch rows.- Specified by:
newChecker
in interfaceRequestController
-
incTaskCounters
Description copied from interface:RequestController
Increment the counter if we build a valid task.- Specified by:
incTaskCounters
in interfaceRequestController
- Parameters:
regions
- The destination of tasksn
- The target server
-
decTaskCounters
Description copied from interface:RequestController
Decrement the counter if a task is accomplished.- Specified by:
decTaskCounters
in interfaceRequestController
- Parameters:
regions
- The destination of tasksn
- The target server
-
getNumberOfTasksInProgress
Description copied from interface:RequestController
Returns The number of running task.- Specified by:
getNumberOfTasksInProgress
in interfaceRequestController
-
waitForMaximumCurrentTasks
public void waitForMaximumCurrentTasks(long max, long id, int periodToTrigger, Consumer<Long> trigger) throws InterruptedIOException Description copied from interface:RequestController
Waits for the running tasks to complete. If there are specified threshold and trigger, the implementation should wake up once in a while for checking the threshold and calling trigger.- Specified by:
waitForMaximumCurrentTasks
in interfaceRequestController
- Parameters:
max
- This method will return if the number of running tasks is less than or equal to max.id
- the caller's idperiodToTrigger
- The period to invoke the trigger. This value is a hint. The real period depends on the implementation.trigger
- The object to call periodically.- Throws:
InterruptedIOException
- If the waiting is interrupted
-
logDetailsOfUndoneTasks
-
waitForFreeSlot
public void waitForFreeSlot(long id, int periodToTrigger, Consumer<Long> trigger) throws InterruptedIOException Description copied from interface:RequestController
Wait until there is at least one slot for a new task.- Specified by:
waitForFreeSlot
in interfaceRequestController
- Parameters:
id
- the caller's idperiodToTrigger
- The period to invoke the trigger. This value is a hint. The real period depends on the implementation.trigger
- The object to call periodically.- Throws:
InterruptedIOException
- If the waiting is interrupted
-