@InterfaceAudience.Private public class SpaceQuotaRefresherChore extends ScheduledChore
ScheduledChore
which periodically updates the RegionServerSpaceQuotaManager
with information from the hbase:quota.Modifier and Type | Field and Description |
---|---|
private Connection |
conn |
private static org.slf4j.Logger |
LOG |
private RegionServerSpaceQuotaManager |
manager |
(package private) static long |
POLICY_REFRESHER_CHORE_DELAY_DEFAULT |
(package private) static String |
POLICY_REFRESHER_CHORE_DELAY_KEY |
(package private) static int |
POLICY_REFRESHER_CHORE_PERIOD_DEFAULT |
(package private) static String |
POLICY_REFRESHER_CHORE_PERIOD_KEY |
(package private) static double |
POLICY_REFRESHER_CHORE_REPORT_PERCENT_DEFAULT |
(package private) static String |
POLICY_REFRESHER_CHORE_REPORT_PERCENT_KEY |
(package private) static String |
POLICY_REFRESHER_CHORE_TIMEUNIT_DEFAULT |
(package private) static String |
POLICY_REFRESHER_CHORE_TIMEUNIT_KEY |
private boolean |
quotaTablePresent |
Constructor and Description |
---|
SpaceQuotaRefresherChore(RegionServerSpaceQuotaManager manager,
Connection conn) |
Modifier and Type | Method and Description |
---|---|
(package private) boolean |
checkQuotaTableExists()
Checks if hbase:quota exists in hbase:meta
|
protected void |
chore()
The task to execute on each scheduled execution of the Chore
|
(package private) void |
extractQuotaSnapshot(Result result,
Map<TableName,SpaceQuotaSnapshot> snapshots)
Wrapper around
QuotaTableUtil.extractQuotaSnapshot(Result, Map) for testing. |
Map<TableName,SpaceQuotaSnapshot> |
fetchSnapshotsFromQuotaTable()
Reads all quota snapshots from the quota table.
|
(package private) Connection |
getConnection() |
(package private) static long |
getInitialDelay(org.apache.hadoop.conf.Configuration conf)
Extracts the initial delay for the chore from the configuration.
|
(package private) RegionServerSpaceQuotaManager |
getManager() |
(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 given
snapshot is in violation, allowing the snapshot to be null. |
cancel, cancel, choreForTesting, cleanup, getInitialDelay, getName, getPeriod, getStopper, getTimeUnit, initialChore, isInitialChoreComplete, isScheduled, run, shutdown, shutdown, toString, triggerNow
private static final org.slf4j.Logger LOG
static final String POLICY_REFRESHER_CHORE_PERIOD_KEY
static final int POLICY_REFRESHER_CHORE_PERIOD_DEFAULT
static final String POLICY_REFRESHER_CHORE_DELAY_KEY
static final long POLICY_REFRESHER_CHORE_DELAY_DEFAULT
static final String POLICY_REFRESHER_CHORE_TIMEUNIT_KEY
static final String POLICY_REFRESHER_CHORE_TIMEUNIT_DEFAULT
static final String POLICY_REFRESHER_CHORE_REPORT_PERCENT_KEY
static final double POLICY_REFRESHER_CHORE_REPORT_PERCENT_DEFAULT
private final RegionServerSpaceQuotaManager manager
private final Connection conn
private boolean quotaTablePresent
public SpaceQuotaRefresherChore(RegionServerSpaceQuotaManager manager, Connection conn)
protected void chore()
ScheduledChore
chore
in class ScheduledChore
boolean checkQuotaTableExists() throws IOException
IOException
- throws IOExceptionboolean isInViolation(SpaceQuotaSnapshot snapshot)
snapshot
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.snapshot
- The snapshot to operate on.public Map<TableName,SpaceQuotaSnapshot> fetchSnapshotsFromQuotaTable() throws IOException
IOException
void extractQuotaSnapshot(Result result, Map<TableName,SpaceQuotaSnapshot> snapshots)
QuotaTableUtil.extractQuotaSnapshot(Result, Map)
for testing.Connection getConnection()
RegionServerSpaceQuotaManager getManager()
static int getPeriod(org.apache.hadoop.conf.Configuration conf)
conf
- The configuration object.static long getInitialDelay(org.apache.hadoop.conf.Configuration conf)
conf
- The configuration object.static TimeUnit getTimeUnit(org.apache.hadoop.conf.Configuration conf)
POLICY_REFRESHER_CHORE_TIMEUNIT_KEY
must correspond to a
TimeUnit
value.conf
- The configuration object.static Double getRegionReportPercent(org.apache.hadoop.conf.Configuration conf)
conf
- The configuration object.Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.