Package org.apache.hadoop.hbase.quotas
Class SpaceQuotaRefresherChore
java.lang.Object
org.apache.hadoop.hbase.ScheduledChore
org.apache.hadoop.hbase.quotas.SpaceQuotaRefresherChore
- All Implemented Interfaces:
Runnable
A
ScheduledChore
which periodically updates the RegionServerSpaceQuotaManager
with information from the hbase:quota.-
Field Summary
Modifier and TypeFieldDescriptionprivate final Connection
private static final org.slf4j.Logger
private final RegionServerSpaceQuotaManager
(package private) static final long
(package private) static final String
(package private) static final int
(package private) static final String
(package private) static final double
(package private) static final String
(package private) static final String
(package private) static final String
private boolean
-
Constructor Summary
ConstructorDescriptionSpaceQuotaRefresherChore
(RegionServerSpaceQuotaManager manager, Connection conn) -
Method Summary
Modifier and TypeMethodDescription(package private) boolean
Checks if hbase:quota exists in hbase:metaprotected void
chore()
The task to execute on each scheduled execution of the Chore(package private) void
extractQuotaSnapshot
(Result result, Map<TableName, SpaceQuotaSnapshot> snapshots) Wrapper aroundQuotaTableUtil.extractQuotaSnapshot(Result, Map)
for testing.Reads all quota snapshots from the quota table.(package private) Connection
(package private) static long
getInitialDelay
(org.apache.hadoop.conf.Configuration conf) Extracts the initial delay for the chore from the configuration.(package private) RegionServerSpaceQuotaManager
(package private) static int
getPeriod
(org.apache.hadoop.conf.Configuration conf) Extracts the period for the chore from the configuration.(package private) static Double
getRegionReportPercent
(org.apache.hadoop.conf.Configuration conf) Extracts the percent of Regions for a table to have been reported to enable quota violation state change.(package private) static TimeUnit
getTimeUnit
(org.apache.hadoop.conf.Configuration conf) Extracts the time unit for the chore period and initial delay from the configuration.(package private) boolean
isInViolation
(SpaceQuotaSnapshot snapshot) Checks if the givensnapshot
is in violation, allowing the snapshot to be null.Methods inherited from class org.apache.hadoop.hbase.ScheduledChore
cancel, cancel, choreForTesting, cleanup, getInitialDelay, getName, getPeriod, getStopper, getTimeUnit, initialChore, isInitialChoreComplete, isScheduled, run, shutdown, shutdown, toString, triggerNow
-
Field Details
-
LOG
-
POLICY_REFRESHER_CHORE_PERIOD_KEY
- See Also:
-
POLICY_REFRESHER_CHORE_PERIOD_DEFAULT
- See Also:
-
POLICY_REFRESHER_CHORE_DELAY_KEY
- See Also:
-
POLICY_REFRESHER_CHORE_DELAY_DEFAULT
- See Also:
-
POLICY_REFRESHER_CHORE_TIMEUNIT_KEY
- See Also:
-
POLICY_REFRESHER_CHORE_TIMEUNIT_DEFAULT
-
POLICY_REFRESHER_CHORE_REPORT_PERCENT_KEY
- See Also:
-
POLICY_REFRESHER_CHORE_REPORT_PERCENT_DEFAULT
- See Also:
-
manager
-
conn
-
quotaTablePresent
-
-
Constructor Details
-
SpaceQuotaRefresherChore
-
-
Method Details
-
chore
Description copied from class:ScheduledChore
The task to execute on each scheduled execution of the Chore- Specified by:
chore
in classScheduledChore
-
checkQuotaTableExists
Checks if hbase:quota exists in hbase:meta- Returns:
- true if hbase:quota table is in meta, else returns false.
- Throws:
IOException
- throws IOException
-
isInViolation
Checks if the givensnapshot
is in violation, allowing the snapshot to be null. If the snapshot is null, this is interpreted as no snapshot which implies not in violation.- Parameters:
snapshot
- The snapshot to operate on.- Returns:
- true if the snapshot is in violation, false otherwise.
-
fetchSnapshotsFromQuotaTable
Reads all quota snapshots from the quota table.- Returns:
- The current "view" of space use by each table.
- Throws:
IOException
-
extractQuotaSnapshot
Wrapper aroundQuotaTableUtil.extractQuotaSnapshot(Result, Map)
for testing. -
getConnection
-
getManager
-
getPeriod
Extracts the period for the chore from the configuration.- Parameters:
conf
- The configuration object.- Returns:
- The configured chore period or the default value.
-
getInitialDelay
Extracts the initial delay for the chore from the configuration.- Parameters:
conf
- The configuration object.- Returns:
- The configured chore initial delay or the default value.
-
getTimeUnit
Extracts the time unit for the chore period and initial delay from the configuration. The configuration value forPOLICY_REFRESHER_CHORE_TIMEUNIT_KEY
must correspond to aTimeUnit
value.- Parameters:
conf
- The configuration object.- Returns:
- The configured time unit for the chore period and initial delay or the default value.
-
getRegionReportPercent
Extracts the percent of Regions for a table to have been reported to enable quota violation state change.- Parameters:
conf
- The configuration object.- Returns:
- The percent of regions reported to use.
-