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
Modifier and TypeFieldDescriptionprivate final QuotaObserverChore
private final Connection
private final ReentrantReadWriteLock
private static final org.slf4j.Logger
private Map<RegionInfo,
Long> private final ReentrantReadWriteLock.ReadLock
private final ReentrantReadWriteLock.WriteLock
Fields inherited from interface org.apache.hadoop.hbase.quotas.QuotaSnapshotStore
NO_QUOTA
-
Constructor Summary
ConstructorDescriptionTableQuotaSnapshotStore
(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 currentSpaceQuotaSnapshot
for the givensubject
.(package private) org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas
getQuotaForTable
(TableName table) Fetches the table quota.(package private) long
Fetches any serialized snapshot sizes from the quota table for thetn
provided.org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.SpaceQuota
getSpaceQuota
(TableName subject) Fetch the Quota for the givensubject
.getTargetState
(TableName table, org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.SpaceQuota spaceQuota) void
setCurrentState
(TableName table, SpaceQuotaSnapshot snapshot) Persists the currentSpaceQuotaSnapshot
for thesubject
.void
setRegionUsage
(Map<RegionInfo, Long> regionUsage) Updatesthis
with 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:QuotaSnapshotStore
Fetch the Quota for the givensubject
. May be null.- Specified by:
getSpaceQuota
in 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:QuotaSnapshotStore
Returns the currentSpaceQuotaSnapshot
for the givensubject
.- Specified by:
getCurrentState
in 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:
getTargetState
in 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 thetn
provided. Any malformed records are skipped with a warning printed out.- Throws:
IOException
-
filterBySubject
Description copied from interface:QuotaSnapshotStore
Filters the providedregions
, returning those which match the givensubject
.- Specified by:
filterBySubject
in interfaceQuotaSnapshotStore<TableName>
- Parameters:
table
- The filter criteria. Only regions belonging to this parameter will be returned
-
setCurrentState
Description copied from interface:QuotaSnapshotStore
Persists the currentSpaceQuotaSnapshot
for thesubject
.- Specified by:
setCurrentState
in interfaceQuotaSnapshotStore<TableName>
- Parameters:
table
- The object which theSpaceQuotaSnapshot
is being persisted forsnapshot
- The current state of thesubject
-
setRegionUsage
Description copied from interface:QuotaSnapshotStore
Updatesthis
with the latest snapshot of filesystem use by region.- Specified by:
setRegionUsage
in interfaceQuotaSnapshotStore<TableName>
- Parameters:
regionUsage
- A map ofRegionInfo
objects to their filesystem usage in bytes
-