Package org.apache.hadoop.hbase.quotas
Class TableQuotaSnapshotStore
java.lang.Object
org.apache.hadoop.hbase.quotas.TableQuotaSnapshotStore
- All Implemented Interfaces:
QuotaSnapshotStore<TableName>
@Private
public class TableQuotaSnapshotStore
extends Object
implements QuotaSnapshotStore<TableName>
QuotaSnapshotStore for tables.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final QuotaObserverChoreprivate final Connectionprivate final ReentrantReadWriteLockprivate static final org.slf4j.Loggerprivate Map<RegionInfo,Long> private final ReentrantReadWriteLock.ReadLockprivate final ReentrantReadWriteLock.WriteLockFields inherited from interface org.apache.hadoop.hbase.quotas.QuotaSnapshotStore
NO_QUOTA -
Constructor Summary
ConstructorsConstructorDescriptionTableQuotaSnapshotStore(Connection conn, QuotaObserverChore chore, Map<RegionInfo, Long> regionUsage) -
Method Summary
Modifier and TypeMethodDescriptionfilterBySubject(TableName table) Filters the providedregions, returning those which match the givensubject.getCurrentState(TableName table) Returns the currentSpaceQuotaSnapshotfor the givensubject.(package private) org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.QuotasgetQuotaForTable(TableName table) Fetches the table quota.(package private) longFetches any serialized snapshot sizes from the quota table for thetnprovided.org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.SpaceQuotagetSpaceQuota(TableName subject) Fetch the Quota for the givensubject.getTargetState(TableName table, org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.SpaceQuota spaceQuota) voidsetCurrentState(TableName table, SpaceQuotaSnapshot snapshot) Persists the currentSpaceQuotaSnapshotfor thesubject.voidsetRegionUsage(Map<RegionInfo, Long> regionUsage) Updatesthiswith the latest snapshot of filesystem use by region.
-
Field Details
-
LOG
-
lock
-
rlock
-
wlock
-
conn
-
chore
-
regionUsage
-
-
Constructor Details
-
TableQuotaSnapshotStore
public TableQuotaSnapshotStore(Connection conn, QuotaObserverChore chore, Map<RegionInfo, Long> regionUsage)
-
-
Method Details
-
getSpaceQuota
public org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.SpaceQuota getSpaceQuota(TableName subject) throws IOException Description copied from interface:QuotaSnapshotStoreFetch the Quota for the givensubject. May be null.- Specified by:
getSpaceQuotain interfaceQuotaSnapshotStore<TableName>- Parameters:
subject- The object for which the quota should be fetched- Throws:
IOException
-
getQuotaForTable
org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas getQuotaForTable(TableName table) throws IOException Fetches the table quota. Visible for mocking/testing.- Throws:
IOException
-
getCurrentState
Description copied from interface:QuotaSnapshotStoreReturns the currentSpaceQuotaSnapshotfor the givensubject.- Specified by:
getCurrentStatein interfaceQuotaSnapshotStore<TableName>- Parameters:
table- The object which the quota snapshot should be fetched
-
getTargetState
public SpaceQuotaSnapshot getTargetState(TableName table, org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.SpaceQuota spaceQuota) throws IOException Description copied from interface:QuotaSnapshotStore- Specified by:
getTargetStatein interfaceQuotaSnapshotStore<TableName>- Parameters:
table- The object which to determine the target SpaceQuotaSnapshot ofspaceQuota- The quota "definition" for thesubject- Throws:
IOException
-
getSnapshotSizesForTable
Fetches any serialized snapshot sizes from the quota table for thetnprovided. Any malformed records are skipped with a warning printed out.- Throws:
IOException
-
filterBySubject
Description copied from interface:QuotaSnapshotStoreFilters the providedregions, returning those which match the givensubject.- Specified by:
filterBySubjectin interfaceQuotaSnapshotStore<TableName>- Parameters:
table- The filter criteria. Only regions belonging to this parameter will be returned
-
setCurrentState
Description copied from interface:QuotaSnapshotStorePersists the currentSpaceQuotaSnapshotfor thesubject.- Specified by:
setCurrentStatein interfaceQuotaSnapshotStore<TableName>- Parameters:
table- The object which theSpaceQuotaSnapshotis being persisted forsnapshot- The current state of thesubject
-
setRegionUsage
Description copied from interface:QuotaSnapshotStoreUpdatesthiswith the latest snapshot of filesystem use by region.- Specified by:
setRegionUsagein interfaceQuotaSnapshotStore<TableName>- Parameters:
regionUsage- A map ofRegionInfoobjects to their filesystem usage in bytes
-