@InterfaceAudience.Private public class SnapshotQuotaObserverChore extends ScheduledChore
Chore
that computes the size of each snapshot which was created from
a table which has a space quota.Modifier and Type | Field and Description |
---|---|
private org.apache.hadoop.conf.Configuration |
conf |
private Connection |
conn |
private org.apache.hadoop.fs.FileSystem |
fs |
private static org.slf4j.Logger |
LOG |
private MetricsMaster |
metrics |
(package private) static long |
SNAPSHOT_QUOTA_CHORE_DELAY_DEFAULT |
(package private) static String |
SNAPSHOT_QUOTA_CHORE_DELAY_KEY |
(package private) static int |
SNAPSHOT_QUOTA_CHORE_PERIOD_DEFAULT |
(package private) static String |
SNAPSHOT_QUOTA_CHORE_PERIOD_KEY |
(package private) static String |
SNAPSHOT_QUOTA_CHORE_TIMEUNIT_DEFAULT |
(package private) static String |
SNAPSHOT_QUOTA_CHORE_TIMEUNIT_KEY |
Constructor and Description |
---|
SnapshotQuotaObserverChore(Connection conn,
org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.FileSystem fs,
Stoppable stopper,
MetricsMaster metrics) |
SnapshotQuotaObserverChore(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) Map<String,Long> |
computeSnapshotSizes(org.apache.hbase.thirdparty.com.google.common.collect.Multimap<TableName,String> snapshotsToComputeSize)
Computes the size of each snapshot provided given the current files referenced by the table.
|
(package private) static long |
getInitialDelay(org.apache.hadoop.conf.Configuration conf)
Extracts the initial delay for the chore from the configuration.
|
(package private) FileArchiverNotifier |
getNotifierForTable(TableName tn)
Returns the correct instance of
FileArchiverNotifier for the given table name. |
(package private) static int |
getPeriod(org.apache.hadoop.conf.Configuration conf)
Extracts the period for the chore from the configuration.
|
(package private) org.apache.hbase.thirdparty.com.google.common.collect.Multimap<TableName,String> |
getSnapshotsFromTables(Admin admin,
Set<TableName> tablesToFetchSnapshotsFrom)
Computes a mapping of originating
TableName to snapshots, when the TableName
exists in the provided Set . |
(package private) org.apache.hbase.thirdparty.com.google.common.collect.Multimap<TableName,String> |
getSnapshotsToComputeSize()
Fetches each table with a quota (table or namespace quota), and then fetch the name of each
snapshot which was created from that table.
|
(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 |
persistSnapshotSizesForNamespaces(Map<String,Long> snapshotSizesByNamespace)
Writes the size used by snapshots for each namespace to the quota table.
|
(package private) void |
pruneNamespaceSnapshots(org.apache.hbase.thirdparty.com.google.common.collect.Multimap<TableName,String> snapshotsToComputeSize)
Removes the snapshot entries that are present in Quota table but not in snapshotsToComputeSize
|
(package private) void |
pruneTableSnapshots(org.apache.hbase.thirdparty.com.google.common.collect.Multimap<TableName,String> snapshotsToComputeSize)
Removes the snapshot entries that are present in Quota table but not in snapshotsToComputeSize
|
(package private) void |
removeExistingNamespaceSnapshotSizes(Set<String> snapshotEntriesToRemove) |
(package private) void |
removeExistingSnapshotSizes(List<Delete> deletes) |
(package private) void |
removeExistingTableSnapshotSizes(org.apache.hbase.thirdparty.com.google.common.collect.Multimap<TableName,String> snapshotEntriesToRemove) |
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 SNAPSHOT_QUOTA_CHORE_PERIOD_KEY
static final int SNAPSHOT_QUOTA_CHORE_PERIOD_DEFAULT
static final String SNAPSHOT_QUOTA_CHORE_DELAY_KEY
static final long SNAPSHOT_QUOTA_CHORE_DELAY_DEFAULT
static final String SNAPSHOT_QUOTA_CHORE_TIMEUNIT_KEY
static final String SNAPSHOT_QUOTA_CHORE_TIMEUNIT_DEFAULT
private final Connection conn
private final org.apache.hadoop.conf.Configuration conf
private final MetricsMaster metrics
private final org.apache.hadoop.fs.FileSystem fs
public SnapshotQuotaObserverChore(HMaster master, MetricsMaster metrics)
SnapshotQuotaObserverChore(Connection conn, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs, Stoppable stopper, MetricsMaster metrics)
protected void chore()
ScheduledChore
chore
in class ScheduledChore
void _chore() throws IOException
IOException
void pruneTableSnapshots(org.apache.hbase.thirdparty.com.google.common.collect.Multimap<TableName,String> snapshotsToComputeSize) throws IOException
snapshotsToComputeSize
- list of snapshots to be persistedIOException
void pruneNamespaceSnapshots(org.apache.hbase.thirdparty.com.google.common.collect.Multimap<TableName,String> snapshotsToComputeSize) throws IOException
snapshotsToComputeSize
- list of snapshots to be persistedIOException
org.apache.hbase.thirdparty.com.google.common.collect.Multimap<TableName,String> getSnapshotsToComputeSize() throws IOException
IOException
org.apache.hbase.thirdparty.com.google.common.collect.Multimap<TableName,String> getSnapshotsFromTables(Admin admin, Set<TableName> tablesToFetchSnapshotsFrom) throws IOException
TableName
to snapshots, when the TableName
exists in the provided Set
.IOException
Map<String,Long> computeSnapshotSizes(org.apache.hbase.thirdparty.com.google.common.collect.Multimap<TableName,String> snapshotsToComputeSize) throws IOException
snapshotsToComputeSize
- The snapshots to compute the size ofIOException
FileArchiverNotifier getNotifierForTable(TableName tn)
FileArchiverNotifier
for the given table name.tn
- The table nameFileArchiverNotifier
instancevoid persistSnapshotSizesForNamespaces(Map<String,Long> snapshotSizesByNamespace) throws IOException
IOException
void removeExistingTableSnapshotSizes(org.apache.hbase.thirdparty.com.google.common.collect.Multimap<TableName,String> snapshotEntriesToRemove) throws IOException
IOException
void removeExistingNamespaceSnapshotSizes(Set<String> snapshotEntriesToRemove) throws IOException
IOException
void removeExistingSnapshotSizes(List<Delete> deletes) throws IOException
IOException
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)
SNAPSHOT_QUOTA_CHORE_TIMEUNIT_KEY
must correspond to
a TimeUnit
value.conf
- The configuration object.Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.