@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 | Class and Description | 
|---|---|
| (package private) static class  | SnapshotQuotaObserverChore.SnapshotWithSizeA struct encapsulating the name of a snapshot and its "size" on the filesystem. | 
| (package private) static class  | SnapshotQuotaObserverChore.StoreFileReferenceA reference to a collection of files in the archive directory for a single region. | 
| 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) org.apache.hbase.thirdparty.com.google.common.collect.Multimap<TableName,SnapshotQuotaObserverChore.SnapshotWithSize> | 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) static int | getPeriod(org.apache.hadoop.conf.Configuration conf)Extracts the period for the chore from the configuration. | 
| (package private) long | getSizeOfStoreFile(TableName tn,
                  SnapshotQuotaObserverChore.StoreFileReference storeFileName)Computes the size of the store files for a single region. | 
| (package private) long | getSizeOfStoreFile(TableName tn,
                  String regionName,
                  String family,
                  String storeFile)Computes the size of the store file given its name, region and family name in
 the archive directory. | 
| (package private) long | getSizeOfStoreFiles(TableName tn,
                   Set<SnapshotQuotaObserverChore.StoreFileReference> storeFileNames)Computes the size of each store file in  storeFileNames | 
| (package private) org.apache.hbase.thirdparty.com.google.common.collect.Multimap<TableName,String> | getSnapshotsFromTables(Admin admin,
                      Set<TableName> tablesToFetchSnapshotsFrom)Computes a mapping of originating  TableNameto snapshots, when theTableNameexists in the providedSet. | 
| (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) Set<SnapshotQuotaObserverChore.StoreFileReference> | getStoreFilesFromSnapshot(SnapshotManifest manifest,
                         Predicate<String> filter)Extracts the names of the store files referenced by this snapshot which satisfy the given
 predicate (the predicate returns  true). | 
| (package private) org.apache.hadoop.fs.Path | getTableDir(TableName tn)Calculates the directory in HDFS for a table based on the configuration. | 
| (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) Map<String,Long> | groupSnapshotSizesByNamespace(org.apache.hbase.thirdparty.com.google.common.collect.Multimap<TableName,SnapshotQuotaObserverChore.SnapshotWithSize> snapshotsWithSize)Sums the snapshot sizes for each namespace. | 
| (package private) void | persistSnapshotSizes(org.apache.hbase.thirdparty.com.google.common.collect.Multimap<TableName,SnapshotQuotaObserverChore.SnapshotWithSize> snapshotsWithSize)Writes the snapshot sizes to the  hbase:quotatable. | 
| (package private) void | persistSnapshotSizes(Table table,
                    org.apache.hbase.thirdparty.com.google.common.collect.Multimap<TableName,SnapshotQuotaObserverChore.SnapshotWithSize> snapshotsWithSize)Writes the snapshot sizes to the provided  table. | 
| (package private) void | persistSnapshotSizesByNS(Table quotaTable,
                        org.apache.hbase.thirdparty.com.google.common.collect.Multimap<TableName,SnapshotQuotaObserverChore.SnapshotWithSize> snapshotsWithSize)Rolls up the snapshot sizes by namespace and writes a single record for each namespace
 which is the size of all snapshots in that namespace. | 
cancel, cancel, choreForTesting, cleanup, getInitialDelay, getName, getPeriod, getStopper, getTimeUnit, initialChore, isInitialChoreComplete, isScheduled, run, toString, triggerNowprivate 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()
ScheduledChorechore in class ScheduledChorevoid _chore() throws IOException
IOExceptionorg.apache.hbase.thirdparty.com.google.common.collect.Multimap<TableName,String> getSnapshotsToComputeSize() throws IOException
IOExceptionorg.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.IOExceptionorg.apache.hbase.thirdparty.com.google.common.collect.Multimap<TableName,SnapshotQuotaObserverChore.SnapshotWithSize> computeSnapshotSizes(org.apache.hbase.thirdparty.com.google.common.collect.Multimap<TableName,String> snapshotsToComputeSize) throws IOException
snapshotsToComputeSize - The snapshots to compute the size ofIOExceptionSet<SnapshotQuotaObserverChore.StoreFileReference> getStoreFilesFromSnapshot(SnapshotManifest manifest, Predicate<String> filter)
true).org.apache.hadoop.fs.Path getTableDir(TableName tn) throws IOException
IOExceptionlong getSizeOfStoreFiles(TableName tn, Set<SnapshotQuotaObserverChore.StoreFileReference> storeFileNames)
storeFileNameslong getSizeOfStoreFile(TableName tn, SnapshotQuotaObserverChore.StoreFileReference storeFileName)
long getSizeOfStoreFile(TableName tn, String regionName, String family, String storeFile)
void persistSnapshotSizes(org.apache.hbase.thirdparty.com.google.common.collect.Multimap<TableName,SnapshotQuotaObserverChore.SnapshotWithSize> snapshotsWithSize) throws IOException
hbase:quota table.snapshotsWithSize - The snapshot sizes to write.IOExceptionvoid persistSnapshotSizes(Table table, org.apache.hbase.thirdparty.com.google.common.collect.Multimap<TableName,SnapshotQuotaObserverChore.SnapshotWithSize> snapshotsWithSize) throws IOException
table.IOExceptionvoid persistSnapshotSizesByNS(Table quotaTable, org.apache.hbase.thirdparty.com.google.common.collect.Multimap<TableName,SnapshotQuotaObserverChore.SnapshotWithSize> snapshotsWithSize) throws IOException
IOExceptionMap<String,Long> groupSnapshotSizesByNamespace(org.apache.hbase.thirdparty.com.google.common.collect.Multimap<TableName,SnapshotQuotaObserverChore.SnapshotWithSize> snapshotsWithSize)
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–2019 The Apache Software Foundation. All rights reserved.