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
Nested ClassesModifier and TypeClassDescription(package private) static classlimit the heap size for each request.(package private) static classlimit the number of rows for each request.(package private) static interfaceProvide a way to control the flow of rows iteration.(package private) static classlimit the heapsize of total submitted data.(package private) static classlimit 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
FieldsModifier and TypeFieldDescription(package private) static final longDefault value ofHBASE_CLIENT_MAX_PERREQUEST_HEAPSIZE.(package private) static final longDefault value ofHBASE_CLIENT_MAX_PERREQUEST_ROWS.(package private) static final longDefault value ofHBASE_CLIENT_MAX_SUBMIT_HEAPSIZE.private static final intprivate static final intstatic final StringThe maximum heap size for each request.static final StringThe maximum number of rows for each request.static final StringThe maximum size of submit.private static final org.slf4j.Logger(package private) final intThe number of tasks we run in parallel on a single region.(package private) final intThe number of task simultaneously executed on a single region server.private final longThe maximum heap size for each request.private final longprivate final longThe maximum number of rows for each request.private final intThe number of tasks simultaneously executed on the cluster.(package private) final ConcurrentMap<byte[],AtomicInteger> (package private) final ConcurrentMap<ServerName,AtomicInteger> (package private) final AtomicLongstatic final Stringstatic final Stringprivate final intprivate final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static intcheckAndGet(org.apache.hadoop.conf.Configuration conf, String key, int defaultValue) private static longcheckAndGet(org.apache.hadoop.conf.Configuration conf, String key, long defaultValue) voiddecTaskCounters(Collection<byte[]> regions, ServerName sn) Decrement the counter if a task is accomplished.longReturns The number of running task.voidincTaskCounters(Collection<byte[]> regions, ServerName sn) Increment the counter if we build a valid task.private voidlogDetailsOfUndoneTasks(long taskInProgress) Returns A new checker for evaluating a batch rows.(package private) static RequestController.CheckernewChecker(List<SimpleRequestController.RowChecker> checkers) voidwaitForFreeSlot(long id, int periodToTrigger, Consumer<Long> trigger) Wait until there is at least one slot for a new task.voidwaitForMaximumCurrentTasks(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:RequestControllerReturns A new checker for evaluating a batch rows.- Specified by:
newCheckerin interfaceRequestController
-
incTaskCounters
Description copied from interface:RequestControllerIncrement the counter if we build a valid task.- Specified by:
incTaskCountersin interfaceRequestController- Parameters:
regions- The destination of tasksn- The target server
-
decTaskCounters
Description copied from interface:RequestControllerDecrement the counter if a task is accomplished.- Specified by:
decTaskCountersin interfaceRequestController- Parameters:
regions- The destination of tasksn- The target server
-
getNumberOfTasksInProgress
Description copied from interface:RequestControllerReturns The number of running task.- Specified by:
getNumberOfTasksInProgressin interfaceRequestController
-
waitForMaximumCurrentTasks
public void waitForMaximumCurrentTasks(long max, long id, int periodToTrigger, Consumer<Long> trigger) throws InterruptedIOException Description copied from interface:RequestControllerWaits 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:
waitForMaximumCurrentTasksin 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:RequestControllerWait until there is at least one slot for a new task.- Specified by:
waitForFreeSlotin 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
-