Package org.apache.hadoop.hbase.quotas
Class RegionServerSpaceQuotaManager
java.lang.Object
org.apache.hadoop.hbase.quotas.RegionServerSpaceQuotaManager
A manager for filesystem space quotas in the RegionServer. This class is the centralized point
for what a RegionServer knows about space quotas on tables. For each table, it tracks two
different things: the
SpaceQuotaSnapshot and a SpaceViolationPolicyEnforcement
(which may be null when a quota is not being violated). Both of these are sensitive on when they
were last updated. The {link SpaceQutoaViolationPolicyRefresherChore} periodically runs and
updates the state on this.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate AtomicReference<Map<TableName,SpaceQuotaSnapshot>> private final ConcurrentHashMap<TableName,SpaceViolationPolicyEnforcement> private static final org.slf4j.Loggerprivate RegionSizeReportingChoreprivate RegionSizeStoreprivate final RegionServerServicesprivate SpaceQuotaRefresherChoreprivate boolean -
Constructor Summary
ConstructorsConstructorDescriptionRegionServerSpaceQuotaManager(RegionServerServices rsServices) RegionServerSpaceQuotaManager(RegionServerServices rsServices, SpaceViolationPolicyEnforcementFactory factory) -
Method Summary
Modifier and TypeMethodDescriptionbooleanareCompactionsDisabled(TableName tableName) Returns whether or not compactions should be disabled for the giventableNameper a space quota violation policy.org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.FileArchiveNotificationRequestbuildFileArchiveRequest(TableName tn, Collection<Map.Entry<String, Long>> archivedFiles) Builds the protobuf message to inform the Master of files being archived.(package private) Map<TableName,SpaceViolationPolicyEnforcement> Returns the collection of tables which have quota violation policies enforced on this RegionServer.Copies the lastSpaceQuotaSnapshots that were recorded.voiddisableViolationPolicyEnforcement(TableName tableName) Disables enforcement on any violation policy on the giventableName.voidenforceViolationPolicy(TableName tableName, SpaceQuotaSnapshot snapshot) Enforces the given violationPolicy on the given table in this RegionServer.Creates an object well-suited for the RegionServer to use in verifying active policies.Converts a map of table toSpaceViolationPolicyEnforcements intoSpaceViolationPolicys.(package private) Connection(package private) SpaceViolationPolicyEnforcementFactory(package private) RegionServerServicesReturns theRegionSizeStoretracking filesystem utilization by each region.booleanReturns if theChorehas been started.voidstart()voidstop()voidupdateQuotaSnapshot(Map<TableName, SpaceQuotaSnapshot> newSnapshots) Updates the currentSpaceQuotaSnapshots for the RegionServer.
-
Field Details
-
LOG
-
rsServices
-
spaceQuotaRefresher
-
currentQuotaSnapshots
-
started
-
enforcedPolicies
-
factory
-
regionSizeStore
-
regionSizeReporter
-
-
Constructor Details
-
RegionServerSpaceQuotaManager
-
RegionServerSpaceQuotaManager
RegionServerSpaceQuotaManager(RegionServerServices rsServices, SpaceViolationPolicyEnforcementFactory factory)
-
-
Method Details
-
start
- Throws:
IOException
-
stop
-
isStarted
Returns if theChorehas been started. -
copyQuotaSnapshots
Copies the lastSpaceQuotaSnapshots that were recorded. The current view of what the RegionServer thinks the table's utilization is. -
updateQuotaSnapshot
Updates the currentSpaceQuotaSnapshots for the RegionServer.- Parameters:
newSnapshots- The space quota snapshots.
-
getActiveEnforcements
Creates an object well-suited for the RegionServer to use in verifying active policies. -
getActivePoliciesAsMap
Converts a map of table toSpaceViolationPolicyEnforcements intoSpaceViolationPolicys. -
enforceViolationPolicy
Enforces the given violationPolicy on the given table in this RegionServer. -
disableViolationPolicyEnforcement
Disables enforcement on any violation policy on the giventableName. -
areCompactionsDisabled
Returns whether or not compactions should be disabled for the giventableNameper a space quota violation policy. A convenience method.- Parameters:
tableName- The table to check- Returns:
- True if compactions should be disabled for the table, false otherwise.
-
getRegionSizeStore
Returns theRegionSizeStoretracking filesystem utilization by each region.- Returns:
- A
RegionSizeStoreimplementation.
-
buildFileArchiveRequest
public org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.FileArchiveNotificationRequest buildFileArchiveRequest(TableName tn, Collection<Map.Entry<String, Long>> archivedFiles) Builds the protobuf message to inform the Master of files being archived.- Parameters:
tn- The table the files previously belonged to.archivedFiles- The files and their size in bytes that were archived.- Returns:
- The protobuf representation
-
copyActiveEnforcements
Returns the collection of tables which have quota violation policies enforced on this RegionServer. -
getRegionServerServices
-
getConnection
-
getFactory
-