@InterfaceAudience.Private public class QuotaObserverChore extends ScheduledChore
Modifier and Type | Class and Description |
---|---|
(package private) static class |
QuotaObserverChore.TablesWithQuotas
A container which encapsulates the tables that have either a table quota or are contained in a
namespace which have a namespace quota.
|
Constructor and Description |
---|
QuotaObserverChore(Connection conn,
org.apache.hadoop.conf.Configuration conf,
SpaceQuotaSnapshotNotifier snapshotNotifier,
MasterQuotaManager quotaManager,
Stoppable stopper,
MetricsMaster metrics) |
QuotaObserverChore(HMaster master,
MetricsMaster metrics) |
Modifier and Type | Method and Description |
---|---|
(package private) void |
_chore() |
protected void |
chore()
The task to execute on each scheduled execution of the Chore
|
(package private) QuotaObserverChore.TablesWithQuotas |
fetchAllTablesWithQuotasDefined()
Computes the set of all tables that have quotas defined.
|
(package private) static long |
getInitialDelay(org.apache.hadoop.conf.Configuration conf)
Extracts the initial delay for the chore from the configuration.
|
(package private) SpaceQuotaSnapshot |
getNamespaceQuotaSnapshot(String namespace)
Fetches the
SpaceQuotaSnapshot for the given namespace from this chore. |
Map<String,SpaceQuotaSnapshot> |
getNamespaceQuotaSnapshots()
Returns an unmodifiable view over the current
SpaceQuotaSnapshot objects
for each HBase namespace with a quota defined. |
(package private) QuotaSnapshotStore<String> |
getNamespaceSnapshotStore() |
(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) SpaceQuotaSnapshot |
getTableQuotaSnapshot(TableName table)
Fetches the
SpaceQuotaSnapshot for the given table. |
Map<TableName,SpaceQuotaSnapshot> |
getTableQuotaSnapshots()
Returns an unmodifiable view over the current
SpaceQuotaSnapshot objects
for each HBase table with a quota defined. |
(package private) QuotaSnapshotStore<TableName> |
getTableSnapshotStore() |
(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) void |
initializeSnapshotStores(Map<RegionInfo,Long> regionSizes) |
private boolean |
isDisableSpaceViolationPolicy(SpaceViolationPolicy currPolicy,
SpaceViolationPolicy targetPolicy)
Method to check whether we are dealing with DISABLE
SpaceViolationPolicy . |
(package private) void |
processNamespacesWithQuotas(Set<String> namespacesWithQuotas,
org.apache.hbase.thirdparty.com.google.common.collect.Multimap<String,TableName> tablesByNamespace)
Processes each namespace which has a quota defined and moves all of the tables contained
in that namespace into or out of violation of the quota.
|
(package private) void |
processTablesWithQuotas(Set<TableName> tablesWithTableQuotas)
Processes each
TableName which has a quota defined and moves it in or out of
violation based on the space use. |
(package private) void |
pruneOldRegionReports()
Removes region reports over a certain age.
|
(package private) void |
setNamespaceQuotaSnapshot(String namespace,
SpaceQuotaSnapshot snapshot)
Stores the given
snapshot for the given namespace in this chore. |
(package private) void |
setTableQuotaSnapshot(TableName table,
SpaceQuotaSnapshot snapshot)
Stores the quota state for the given table.
|
(package private) void |
updateNamespaceQuota(String namespace,
SpaceQuotaSnapshot currentSnapshot,
SpaceQuotaSnapshot targetSnapshot,
org.apache.hbase.thirdparty.com.google.common.collect.Multimap<String,TableName> tablesByNamespace)
Updates the hbase:quota table with the target quota policy for this
namespace
if necessary. |
(package private) void |
updateTableQuota(TableName table,
SpaceQuotaSnapshot currentSnapshot,
SpaceQuotaSnapshot targetSnapshot)
Updates the hbase:quota table with the new quota policy for this
table
if necessary. |
cancel, cancel, choreForTesting, cleanup, getInitialDelay, getName, getPeriod, getStopper, getTimeUnit, initialChore, isInitialChoreComplete, isScheduled, run, toString, triggerNow
private static final org.slf4j.Logger LOG
static final String QUOTA_OBSERVER_CHORE_PERIOD_KEY
static final int QUOTA_OBSERVER_CHORE_PERIOD_DEFAULT
static final String QUOTA_OBSERVER_CHORE_DELAY_KEY
static final long QUOTA_OBSERVER_CHORE_DELAY_DEFAULT
static final String QUOTA_OBSERVER_CHORE_TIMEUNIT_KEY
static final String QUOTA_OBSERVER_CHORE_TIMEUNIT_DEFAULT
static final String QUOTA_OBSERVER_CHORE_REPORT_PERCENT_KEY
static final double QUOTA_OBSERVER_CHORE_REPORT_PERCENT_DEFAULT
static final String REGION_REPORT_RETENTION_DURATION_KEY
static final long REGION_REPORT_RETENTION_DURATION_DEFAULT
private final Connection conn
private final org.apache.hadoop.conf.Configuration conf
private final MasterQuotaManager quotaManager
private final MetricsMaster metrics
private final SpaceQuotaSnapshotNotifier snapshotNotifier
private final Map<TableName,SpaceQuotaSnapshot> tableQuotaSnapshots
private final Map<TableName,SpaceQuotaSnapshot> readOnlyTableQuotaSnapshots
private final Map<String,SpaceQuotaSnapshot> namespaceQuotaSnapshots
private final Map<String,SpaceQuotaSnapshot> readOnlyNamespaceSnapshots
private final long regionReportLifetimeMillis
private QuotaSnapshotStore<TableName> tableSnapshotStore
private QuotaSnapshotStore<String> namespaceSnapshotStore
public QuotaObserverChore(HMaster master, MetricsMaster metrics)
QuotaObserverChore(Connection conn, org.apache.hadoop.conf.Configuration conf, SpaceQuotaSnapshotNotifier snapshotNotifier, MasterQuotaManager quotaManager, Stoppable stopper, MetricsMaster metrics)
protected void chore()
ScheduledChore
chore
in class ScheduledChore
void _chore() throws IOException
IOException
void initializeSnapshotStores(Map<RegionInfo,Long> regionSizes)
void processTablesWithQuotas(Set<TableName> tablesWithTableQuotas) throws IOException
TableName
which has a quota defined and moves it in or out of
violation based on the space use.tablesWithTableQuotas
- The HBase tables which have quotas definedIOException
void processNamespacesWithQuotas(Set<String> namespacesWithQuotas, org.apache.hbase.thirdparty.com.google.common.collect.Multimap<String,TableName> tablesByNamespace) throws IOException
namespacesWithQuotas
- The set of namespaces that have quotas definedtablesByNamespace
- A mapping of namespaces and the tables contained in those namespacesIOException
void updateTableQuota(TableName table, SpaceQuotaSnapshot currentSnapshot, SpaceQuotaSnapshot targetSnapshot) throws IOException
table
if necessary.table
- The table being checkedcurrentSnapshot
- The state of the quota on this table from the previous invocation.targetSnapshot
- The state the quota should be in for this table.IOException
private boolean isDisableSpaceViolationPolicy(SpaceViolationPolicy currPolicy, SpaceViolationPolicy targetPolicy)
SpaceViolationPolicy
. In such a
case, currPolicy or/and targetPolicy will be having DISABLE policy.currPolicy
- currently set space violation policytargetPolicy
- new space violation policyvoid updateNamespaceQuota(String namespace, SpaceQuotaSnapshot currentSnapshot, SpaceQuotaSnapshot targetSnapshot, org.apache.hbase.thirdparty.com.google.common.collect.Multimap<String,TableName> tablesByNamespace) throws IOException
namespace
if necessary.namespace
- The namespace being checkedcurrentSnapshot
- The state of the quota on this namespace from the previous invocationtargetSnapshot
- The state the quota should be in for this namespacetablesByNamespace
- A mapping of tables in namespaces.IOException
void pruneOldRegionReports()
QuotaObserverChore.TablesWithQuotas fetchAllTablesWithQuotasDefined() throws IOException
IOException
QuotaSnapshotStore<TableName> getTableSnapshotStore()
QuotaSnapshotStore<String> getNamespaceSnapshotStore()
public Map<TableName,SpaceQuotaSnapshot> getTableQuotaSnapshots()
SpaceQuotaSnapshot
objects
for each HBase table with a quota defined.public Map<String,SpaceQuotaSnapshot> getNamespaceQuotaSnapshots()
SpaceQuotaSnapshot
objects
for each HBase namespace with a quota defined.SpaceQuotaSnapshot getTableQuotaSnapshot(TableName table)
SpaceQuotaSnapshot
for the given table.void setTableQuotaSnapshot(TableName table, SpaceQuotaSnapshot snapshot)
SpaceQuotaSnapshot getNamespaceQuotaSnapshot(String namespace)
SpaceQuotaSnapshot
for the given namespace from this chore.void setNamespaceQuotaSnapshot(String namespace, SpaceQuotaSnapshot snapshot)
snapshot
for the given namespace
in this chore.static int getPeriod(org.apache.hadoop.conf.Configuration conf)
conf
- The configuration object.getTimeUnit(Configuration)
static long getInitialDelay(org.apache.hadoop.conf.Configuration conf)
conf
- The configuration object.getTimeUnit(Configuration)
static TimeUnit getTimeUnit(org.apache.hadoop.conf.Configuration conf)
QUOTA_OBSERVER_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.