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
FieldsModifier and TypeFieldDescriptionprivate final Connectionprivate static final org.slf4j.Loggerprivate 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 Stringprivate boolean -
Constructor Summary
ConstructorsConstructorDescriptionSpaceQuotaRefresherChore(RegionServerSpaceQuotaManager manager, Connection conn) -
Method Summary
Modifier and TypeMethodDescription(package private) booleanChecks if hbase:quota exists in hbase:metaprotected voidchore()The task to execute on each scheduled execution of the Chore(package private) voidextractQuotaSnapshot(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 longgetInitialDelay(org.apache.hadoop.conf.Configuration conf) Extracts the initial delay for the chore from the configuration.(package private) RegionServerSpaceQuotaManager(package private) static intgetPeriod(org.apache.hadoop.conf.Configuration conf) Extracts the period for the chore from the configuration.(package private) static DoublegetRegionReportPercent(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 TimeUnitgetTimeUnit(org.apache.hadoop.conf.Configuration conf) Extracts the time unit for the chore period and initial delay from the configuration.(package private) booleanisInViolation(SpaceQuotaSnapshot snapshot) Checks if the givensnapshotis 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:ScheduledChoreThe task to execute on each scheduled execution of the Chore- Specified by:
chorein 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 givensnapshotis 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_KEYmust correspond to aTimeUnitvalue.- 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.
-